Skip to content

Commit

Permalink
Merge pull request #161 from DroidKaigi/fix/timetable_list_crash
Browse files Browse the repository at this point in the history
  • Loading branch information
shin-usu authored Jul 26, 2024
2 parents 1634c18 + 95c588f commit 61cd195
Showing 1 changed file with 52 additions and 54 deletions.
106 changes: 52 additions & 54 deletions app-ios/Sources/TimetableFeature/TimetableListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,68 +13,66 @@ public struct TimetableView: View {
@State var switchModeIcon: String = "square.grid.2x2"

public var body: some View {
NavigationStack {
VStack {
HStack {
ForEach(DayTab.allCases) { tabItem in
Button(action: {
store.send(.view(.selectDay(tabItem)))
}, label: {
//TODO: Only selected button should be green and underlined
Text(tabItem.rawValue).foregroundStyle(
AssetColors.Custom.arcticFox.swiftUIColor)
.underline()
})
}
Spacer()
}.padding(5)
switch timetableMode {
case TimetableMode.list:
TimetableListView(store: store)
case TimetableMode.grid:
Text("Grid view placeholder")
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
VStack {
HStack {
ForEach(DayTab.allCases) { tabItem in
Button(action: {
store.send(.view(.selectDay(tabItem)))
}, label: {
//TODO: Only selected button should be green and underlined
Text(tabItem.rawValue).foregroundStyle(
AssetColors.Custom.arcticFox.swiftUIColor)
.underline()
})
}
Spacer()
}.padding(5)
switch timetableMode {
case TimetableMode.list:
TimetableListView(store: store)
case TimetableMode.grid:
Text("Grid view placeholder")
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
}

.background(AssetColors.Surface.surface.swiftUIColor)
.frame(maxWidth: .infinity)
.toolbar{
ToolbarItem(placement: .topBarLeading) {
Text("Timetable")
.textStyle(.headlineMedium)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)

}
ToolbarItem(placement:.topBarTrailing) {
HStack {
Button {
// TODO: Search?
} label: {
Group {
Image(systemName:"magnifyingglass").foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
}
.frame(width: 40, height: 40)
Spacer()
}

.background(AssetColors.Surface.surface.swiftUIColor)
.frame(maxWidth: .infinity)
.toolbar{
ToolbarItem(placement: .topBarLeading) {
Text("Timetable")
.textStyle(.headlineMedium)
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)

}
ToolbarItem(placement:.topBarTrailing) {
HStack {
Button {
// TODO: Search?
} label: {
Group {
Image(systemName:"magnifyingglass").foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
}

Button {
switch timetableMode {
case .list:
timetableMode = .grid
switchModeIcon = "list.bullet.indent"
case .grid:
timetableMode = .list
switchModeIcon = "square.grid.2x2"
}
} label: {
Image(systemName:switchModeIcon).foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.frame(width: 40, height: 40)
.frame(width: 40, height: 40)
}

Button {
switch timetableMode {
case .list:
timetableMode = .grid
switchModeIcon = "list.bullet.indent"
case .grid:
timetableMode = .list
switchModeIcon = "square.grid.2x2"
}
} label: {
Image(systemName:switchModeIcon).foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)
.frame(width: 40, height: 40)
}
}

}

}
}
}
Expand Down

0 comments on commit 61cd195

Please sign in to comment.