Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ry-itto committed Sep 11, 2024
1 parent a4906df commit 6ee79d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
20 changes: 9 additions & 11 deletions app-ios/Sources/TimetableFeature/TimetableReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public struct TimetableReducer : Sendable{

@ObservableState
public struct State: Equatable {
var selectedDay: DayTab = .day1
var timetableItems: [TimetableTimeGroupItems] = [] //Should be simple objects

public init(timetableItems: [TimetableTimeGroupItems] = []) {
Expand Down Expand Up @@ -70,14 +71,13 @@ public struct TimetableReducer : Sendable{

case let .requestDay(dayTab):
return .run { send in
let internalDay: DroidKaigi2024Day = switch dayTab {
case DayTab.day1:
DroidKaigi2024Day.conferenceDay1
case DayTab.day2:
DroidKaigi2024Day.conferenceDay2
}

for try await timetables in try timetableClient.streamTimetable() {
let internalDay: DroidKaigi2024Day = switch dayTab {
case DayTab.day1:
DroidKaigi2024Day.conferenceDay1
case DayTab.day2:
DroidKaigi2024Day.conferenceDay2
}
await send(.response(.success(timetables.dayTimetable(droidKaigi2024Day: internalDay).contents)))
}
}
Expand All @@ -92,7 +92,8 @@ public struct TimetableReducer : Sendable{
case .view(.timetableItemTapped), .view(.searchTapped):
return .none
case .view(.selectDay(let dayTab)):

state.selectedDay = dayTab

return .run { send in
await send(.requestDay(dayTab))
}
Expand All @@ -113,6 +114,3 @@ public struct TimetableReducer : Sendable{
}
}
}



Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,18 @@ public struct TimetableView: View {

@State private var timetableMode = TimetableMode.list
@State private var switchModeIcon: ImageResource = .icGrid
@State private var selectedTab: DayTab = DayTab.day1

public var body: some View {
VStack {
HStack {
ForEach(DayTab.allCases) { tabItem in
Button(action: {
store.send(.view(.selectDay(tabItem)))
selectedTab = tabItem
}, label: {
HStack(spacing: 6) {
Text(tabItem.rawValue).textStyle(.titleMedium).underline(selectedTab == tabItem)
Text(tabItem.rawValue).textStyle(.titleMedium).underline(store.selectedDay == tabItem)
}
.foregroundStyle(selectedTab == tabItem ? AssetColors.Custom.iguana.swiftUIColor : AssetColors.Surface.onSurface.swiftUIColor)
.foregroundStyle(store.selectedDay == tabItem ? AssetColors.Custom.iguana.swiftUIColor : AssetColors.Surface.onSurface.swiftUIColor)
.padding(6)
})
}
Expand Down Expand Up @@ -59,7 +57,7 @@ public struct TimetableView: View {
}
.frame(width: 40, height: 40)
}

Button {
switch timetableMode {
case .list:
Expand Down

0 comments on commit 6ee79d4

Please sign in to comment.