Skip to content

Commit

Permalink
Switch the layout of the timetable
Browse files Browse the repository at this point in the history
  • Loading branch information
woxtu committed Sep 18, 2023
1 parent 0cc5c86 commit 57fe149
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "trailing-icon 3.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "trailing-icon 4.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Binary file not shown.
33 changes: 25 additions & 8 deletions app-ios/Modules/Sources/Timetable/TimetableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum TimetableRouting: Hashable {
public struct TimetableView<SessionView: View>: View {
@Environment(\.colorScheme) var colorScheme
@StateObject var viewModel: TimetableViewModel = .init()
@State private var isListPresented: Bool = true
private let sessionViewBuilder: ViewProvider<TimetableItem, SessionView>
let gradient = Gradient(stops: [
.init(color: AssetColors.Surface.surfaceGradientTOP.swiftUIColor, location: 0.0),
Expand Down Expand Up @@ -78,13 +79,20 @@ public struct TimetableView<SessionView: View>: View {
.frame(height: shouldCollapse ? 53 : 82)
.animation(.easeInOut(duration: 0.08), value: shouldCollapse)
) {
TimetableListView(
timetableTimeGroupItems: state.timeGroupTimetableItems,
searchWord: "",
onToggleBookmark: { [weak viewModel] in
viewModel?.toggleBookmark($0)
}
)
if isListPresented {
TimetableListView(
timetableTimeGroupItems: state.timeGroupTimetableItems,
searchWord: "",
onToggleBookmark: { [weak viewModel] in
viewModel?.toggleBookmark($0)
}
)
} else {
TimetableGridView(
day: viewModel.state.selectedDay,
timetableRoomGroupItems: state.roomGroupTimetableItems
)
}
}
}
.background(AssetColors.Surface.surface.swiftUIColor)
Expand Down Expand Up @@ -132,7 +140,16 @@ public struct TimetableView<SessionView: View>: View {
.buttonStyle(.plain)
}
ToolbarItem {
Assets.Icons.gridView.swiftUIImage
Button {
isListPresented.toggle()
} label: {
if isListPresented {
Assets.Icons.gridView.swiftUIImage
} else {
Assets.Icons.listView.swiftUIImage
}
}
.buttonStyle(.plain)
}
}
}
Expand Down

0 comments on commit 57fe149

Please sign in to comment.