Skip to content

Commit

Permalink
Merge pull request #710 from aqua-ix/ios-remove-workshop-day-tab-from…
Browse files Browse the repository at this point in the history
…-favorite-view

[iOS] Favorite Feature: Remove Workshop Day tab
  • Loading branch information
MrSmart00 authored Aug 24, 2024
2 parents ac5421d + eef98f0 commit 390a995
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
16 changes: 11 additions & 5 deletions app-ios/Sources/CommonComponents/SelectionChips.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ import Theme
public struct SelectionChips<SelectableCase: Selectable>: View where SelectableCase.AllCases: RandomAccessCollection {
@Binding public var selected: SelectableCase?
public var notSelectedTitle: String?
public let options: [SelectableCase]

public init(selected: Binding<SelectableCase?>, notSelectedTitle: String? = nil) {
self._selected = selected
self.notSelectedTitle = notSelectedTitle
}
public init(
selected: Binding<SelectableCase?>,
notSelectedTitle: String? = nil,
options: [SelectableCase] = SelectableCase.allCases as! [SelectableCase]
) {
self._selected = selected
self.notSelectedTitle = notSelectedTitle
self.options = options
}

public var body: some View {
ScrollView(.horizontal) {
Expand All @@ -24,7 +30,7 @@ public struct SelectionChips<SelectableCase: Selectable>: View where SelectableC
}
}

ForEach(SelectableCase.allCases) { selection in
ForEach(options) { selection in
SelectionChip(
title: selection.caseTitle,
isMultiSelect: false,
Expand Down
7 changes: 6 additions & 1 deletion app-ios/Sources/FavoriteFeature/FavoriteView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public struct FavoriteView: View {
private var daySelection: some View {
SelectionChips<DroidKaigi2024Day>(
selected: $store.selectedDay.sending(\.view.selectedDayChanged),
notSelectedTitle: String(localized: "All", bundle: .module)
notSelectedTitle: String(localized: "All", bundle: .module),
options: DroidKaigi2024Day.options
)
}
}
Expand Down Expand Up @@ -105,6 +106,10 @@ extension DroidKaigi2024Day {
String(localized: "9/13", bundle: .module)
}
}

public static var options: [DroidKaigi2024Day] {
[.conferenceDay1, .conferenceDay2]
}
}

#Preview {
Expand Down

0 comments on commit 390a995

Please sign in to comment.