From 54331440b33191103aeffac4b6031fea68e63e85 Mon Sep 17 00:00:00 2001 From: CHARLES BOND Date: Sun, 14 Jul 2024 11:13:58 +0900 Subject: [PATCH 1/9] Added top bar place holder. Added grid view placeholder. Icons now switch between modes when clicked. Search icon is just placeholder. Issue: Title alignment seems off. --- .../Sources/TimetableFeature/SampleData.swift | 17 ++-- .../TimetableFeature/TimetableListView.swift | 82 +++++++++++++++---- .../TimetableFeature/TimetableReducer.swift | 8 +- .../Tests/TimetableTests/TimetableTests.swift | 2 +- 4 files changed, 81 insertions(+), 28 deletions(-) diff --git a/app-ios/Sources/TimetableFeature/SampleData.swift b/app-ios/Sources/TimetableFeature/SampleData.swift index a56f3df3a..306509378 100644 --- a/app-ios/Sources/TimetableFeature/SampleData.swift +++ b/app-ios/Sources/TimetableFeature/SampleData.swift @@ -3,9 +3,14 @@ import Foundation public enum DayTab: String, CaseIterable, Identifiable { public var id : RawValue { rawValue } - case day1 = "Day1" - case day2 = "Day2" - case day3 = "Day3" + case workday = "Workday" + case day1 = "Day 1" + case day2 = "Day 2" +} + +public enum TimetableMode { + case List + case Grid } public struct TimetableTimeGroupItems: Identifiable, Equatable, Hashable { @@ -44,7 +49,7 @@ public struct TimetableItem: Equatable, Hashable { } struct SampleData { - let day1Results = [ + let workdayResults = [ TimetableTimeGroupItems(startsTimeString:"12:00", endsTimeString:"13:00", items: [ TimetableItem( id: "", @@ -121,7 +126,7 @@ struct SampleData { ]) ] - let day2Results = [ + let day1Results = [ TimetableTimeGroupItems(startsTimeString:"12:00", endsTimeString:"13:00", items: [ TimetableItem( id: "", @@ -194,7 +199,7 @@ struct SampleData { ]) ] - let day3Results = [ + let day2Results = [ TimetableTimeGroupItems(startsTimeString:"12:00", endsTimeString:"13:00", items: [ TimetableItem( id: "", diff --git a/app-ios/Sources/TimetableFeature/TimetableListView.swift b/app-ios/Sources/TimetableFeature/TimetableListView.swift index ba9c493f7..3e92116aa 100644 --- a/app-ios/Sources/TimetableFeature/TimetableListView.swift +++ b/app-ios/Sources/TimetableFeature/TimetableListView.swift @@ -8,25 +8,73 @@ public struct TimetableView: View { self.store = store } + @State var timetableMode = TimetableMode.List + @State var switchModeIcon: String = "square.grid.2x2" + public var body: some View { - VStack { - HStack { - ForEach(DayTab.allCases) { tabItem in - Button(action: { - store.send(.selectDay(tabItem)) - }, label: { - //TODO: Only selected button should be green and underlined - Text(tabItem.rawValue).foregroundStyle(Color(.greenSelectColorset)) - .underline() - }) + NavigationView { + VStack { + HStack { + ForEach(DayTab.allCases) { tabItem in + Button(action: { + store.send(.selectDay(tabItem)) + }, label: { + //TODO: Only selected button should be green and underlined + Text(tabItem.rawValue).foregroundStyle(Color(.greenSelectColorset)) + .underline() + }) + } + Spacer() + }.padding(5) + switch(timetableMode) { + case TimetableMode.List: + TimetableListView(store: store) + case TimetableMode.Grid: + Text("Grid view placeholder") + .foregroundStyle(Color(.onSurfaceColorset)) } Spacer() - }.padding(5) - TimetableListView(store: store) - Spacer() + } + .background(Color(.backgroundColorset)) + .frame(maxWidth: .infinity) + .toolbar{ + ToolbarItem(placement: .topBarLeading) { + Text("Timetable") + .font(.title) + .foregroundStyle(Color(.onSurfaceColorset)) + + } + ToolbarItem(placement:.topBarTrailing) { + HStack { + Button { + // TODO: Search? + } label: { + Group { + Image(systemName:"magnifyingglass").foregroundStyle(Color(.onSurfaceColorset)) + } + .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: { + Group { + Image(systemName:switchModeIcon).foregroundStyle(Color(.onSurfaceColorset)) + } + .frame(width: 40, height: 40) + } + } + } + + } } - .background(Color(.backgroundColorset)) - .frame(maxWidth: .infinity) } } @@ -134,7 +182,7 @@ struct PhotoView: View { #Preview { TimetableView( - store: .init(initialState: .init(timetableItems: SampleData.init().day1Results), + store: .init(initialState: .init(timetableItems: SampleData.init().workdayResults), reducer: { TimetableReducer() }) ) } @@ -143,7 +191,7 @@ struct PhotoView: View { TimetableListView( store: .init( initialState: - .init(timetableItems: SampleData.init().day1Results), + .init(timetableItems: SampleData.init().workdayResults), reducer: { TimetableReducer() } ) ) diff --git a/app-ios/Sources/TimetableFeature/TimetableReducer.swift b/app-ios/Sources/TimetableFeature/TimetableReducer.swift index f040c8313..6065c2471 100644 --- a/app-ios/Sources/TimetableFeature/TimetableReducer.swift +++ b/app-ios/Sources/TimetableFeature/TimetableReducer.swift @@ -25,21 +25,21 @@ public struct TimetableReducer { Reduce { state, action in switch action { case .onAppear: - state.timetableItems = sampleData.day1Results + state.timetableItems = sampleData.workdayResults return .none case .selectDay(let dayTab): //TODO: Replace with real data switch dayTab { + case .workday: + state.timetableItems = sampleData.workdayResults + return .none case .day1: state.timetableItems = sampleData.day1Results return .none case .day2: state.timetableItems = sampleData.day2Results return .none - case .day3: - state.timetableItems = sampleData.day3Results - return .none } } } diff --git a/app-ios/Tests/TimetableTests/TimetableTests.swift b/app-ios/Tests/TimetableTests/TimetableTests.swift index 8a2534948..3953cf086 100644 --- a/app-ios/Tests/TimetableTests/TimetableTests.swift +++ b/app-ios/Tests/TimetableTests/TimetableTests.swift @@ -8,7 +8,7 @@ final class TimetableTests: XCTestCase { TimetableReducer() } await store.send(.onAppear) { - $0.timetableItems = SampleData().day1Results + $0.timetableItems = SampleData().workdayResults } } } From 2ad1b52797b1b1c097bcd349c1106d918c105b86 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 19 Jul 2024 21:39:49 +0900 Subject: [PATCH 2/9] Update app-ios/Sources/TimetableFeature/SampleData.swift Co-authored-by: Ryoya Ito --- app-ios/Sources/TimetableFeature/SampleData.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app-ios/Sources/TimetableFeature/SampleData.swift b/app-ios/Sources/TimetableFeature/SampleData.swift index 306509378..1c2a6e775 100644 --- a/app-ios/Sources/TimetableFeature/SampleData.swift +++ b/app-ios/Sources/TimetableFeature/SampleData.swift @@ -9,8 +9,8 @@ public enum DayTab: String, CaseIterable, Identifiable { } public enum TimetableMode { - case List - case Grid + case list + case grid } public struct TimetableTimeGroupItems: Identifiable, Equatable, Hashable { From 81bbc4f4767d62bbc789956de547614a9a2985d1 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 19 Jul 2024 21:40:10 +0900 Subject: [PATCH 3/9] Update app-ios/Sources/TimetableFeature/TimetableListView.swift Co-authored-by: Ryoya Ito --- app-ios/Sources/TimetableFeature/TimetableListView.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app-ios/Sources/TimetableFeature/TimetableListView.swift b/app-ios/Sources/TimetableFeature/TimetableListView.swift index d3d48b2a1..25de044e2 100644 --- a/app-ios/Sources/TimetableFeature/TimetableListView.swift +++ b/app-ios/Sources/TimetableFeature/TimetableListView.swift @@ -65,9 +65,7 @@ public struct TimetableView: View { switchModeIcon = "square.grid.2x2" } } label: { - Group { - Image(systemName:switchModeIcon).foregroundStyle(Color(.onSurfaceColorset)) - } + Image(systemName:switchModeIcon).foregroundStyle(Color(.onSurfaceColorset)) .frame(width: 40, height: 40) } } From b9fc6ff6e099c6f8d42c33d358b7732f19502c66 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 19 Jul 2024 21:40:18 +0900 Subject: [PATCH 4/9] Update app-ios/Sources/TimetableFeature/TimetableListView.swift Co-authored-by: Ryoya Ito --- app-ios/Sources/TimetableFeature/TimetableListView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-ios/Sources/TimetableFeature/TimetableListView.swift b/app-ios/Sources/TimetableFeature/TimetableListView.swift index 25de044e2..f1ca8a4bf 100644 --- a/app-ios/Sources/TimetableFeature/TimetableListView.swift +++ b/app-ios/Sources/TimetableFeature/TimetableListView.swift @@ -56,7 +56,7 @@ public struct TimetableView: View { } Button { - switch(timetableMode){ + switch timetableMode { case .List: timetableMode = .Grid switchModeIcon = "list.bullet.indent" From 01f2bee35970189dba6e7d79977fc91e4465bd79 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 19 Jul 2024 22:07:49 +0900 Subject: [PATCH 5/9] Update app-ios/Sources/TimetableFeature/TimetableListView.swift Co-authored-by: Ryoya Ito --- app-ios/Sources/TimetableFeature/TimetableListView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-ios/Sources/TimetableFeature/TimetableListView.swift b/app-ios/Sources/TimetableFeature/TimetableListView.swift index f1ca8a4bf..16ed6d5d7 100644 --- a/app-ios/Sources/TimetableFeature/TimetableListView.swift +++ b/app-ios/Sources/TimetableFeature/TimetableListView.swift @@ -26,7 +26,7 @@ public struct TimetableView: View { } Spacer() }.padding(5) - switch(timetableMode) { + switch timetableMode { case TimetableMode.List: TimetableListView(store: store) case TimetableMode.Grid: From 93ac7de09f82f161d81f4f605bd975d092a91deb Mon Sep 17 00:00:00 2001 From: CHARLES BOND Date: Fri, 19 Jul 2024 23:52:43 +0900 Subject: [PATCH 6/9] Fixes to match requested changes in pull request. --- .../Sources/TimetableFeature/SampleData.swift | 2 +- .../TimetableFeature/TimetableListView.swift | 16 ++++++++-------- .../TimetableFeature/TimetableReducer.swift | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app-ios/Sources/TimetableFeature/SampleData.swift b/app-ios/Sources/TimetableFeature/SampleData.swift index 1c2a6e775..283392939 100644 --- a/app-ios/Sources/TimetableFeature/SampleData.swift +++ b/app-ios/Sources/TimetableFeature/SampleData.swift @@ -3,7 +3,7 @@ import Foundation public enum DayTab: String, CaseIterable, Identifiable { public var id : RawValue { rawValue } - case workday = "Workday" + case workshopDay = "WorkshopDay" case day1 = "Day 1" case day2 = "Day 2" } diff --git a/app-ios/Sources/TimetableFeature/TimetableListView.swift b/app-ios/Sources/TimetableFeature/TimetableListView.swift index 16ed6d5d7..35a05f1fe 100644 --- a/app-ios/Sources/TimetableFeature/TimetableListView.swift +++ b/app-ios/Sources/TimetableFeature/TimetableListView.swift @@ -8,11 +8,11 @@ public struct TimetableView: View { self.store = store } - @State var timetableMode = TimetableMode.List + @State var timetableMode = TimetableMode.list @State var switchModeIcon: String = "square.grid.2x2" public var body: some View { - NavigationView { + NavigationStack { VStack { HStack { ForEach(DayTab.allCases) { tabItem in @@ -27,9 +27,9 @@ public struct TimetableView: View { Spacer() }.padding(5) switch timetableMode { - case TimetableMode.List: + case TimetableMode.list: TimetableListView(store: store) - case TimetableMode.Grid: + case TimetableMode.grid: Text("Grid view placeholder") .foregroundStyle(Color(.onSurfaceColorset)) } @@ -57,11 +57,11 @@ public struct TimetableView: View { Button { switch timetableMode { - case .List: - timetableMode = .Grid + case .list: + timetableMode = .grid switchModeIcon = "list.bullet.indent" - case .Grid: - timetableMode = .List + case .grid: + timetableMode = .list switchModeIcon = "square.grid.2x2" } } label: { diff --git a/app-ios/Sources/TimetableFeature/TimetableReducer.swift b/app-ios/Sources/TimetableFeature/TimetableReducer.swift index ebb6a14d3..19b85bc24 100644 --- a/app-ios/Sources/TimetableFeature/TimetableReducer.swift +++ b/app-ios/Sources/TimetableFeature/TimetableReducer.swift @@ -38,7 +38,7 @@ public struct TimetableReducer { //TODO: Replace with real data switch dayTab { - case .workday: + case .workshopDay: state.timetableItems = sampleData.workdayResults return .none case .day1: From 44f9aafe2dc755a23186ce27d440d2cb54e4cf16 Mon Sep 17 00:00:00 2001 From: CHARLES BOND Date: Sat, 20 Jul 2024 10:02:45 +0900 Subject: [PATCH 7/9] Adusted color references to match rest of project. --- .../TimetableFeature/TimetableListView.swift | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/app-ios/Sources/TimetableFeature/TimetableListView.swift b/app-ios/Sources/TimetableFeature/TimetableListView.swift index 35a05f1fe..6c290a2ed 100644 --- a/app-ios/Sources/TimetableFeature/TimetableListView.swift +++ b/app-ios/Sources/TimetableFeature/TimetableListView.swift @@ -1,5 +1,6 @@ import ComposableArchitecture import SwiftUI +import Theme public struct TimetableView: View { private let store: StoreOf @@ -20,7 +21,8 @@ public struct TimetableView: View { store.send(.view(.selectDay(tabItem))) }, label: { //TODO: Only selected button should be green and underlined - Text(tabItem.rawValue).foregroundStyle(Color(.greenSelectColorset)) + Text(tabItem.rawValue).foregroundStyle( + AssetColors.Custom.arcticFox.swiftUIColor) .underline() }) } @@ -31,17 +33,18 @@ public struct TimetableView: View { TimetableListView(store: store) case TimetableMode.grid: Text("Grid view placeholder") - .foregroundStyle(Color(.onSurfaceColorset)) + .foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) } Spacer() } - .background(Color(.backgroundColorset)) + + .background(AssetColors.Surface.surface.swiftUIColor) .frame(maxWidth: .infinity) .toolbar{ ToolbarItem(placement: .topBarLeading) { Text("Timetable") .font(.title) - .foregroundStyle(Color(.onSurfaceColorset)) + .foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) } ToolbarItem(placement:.topBarTrailing) { @@ -50,7 +53,7 @@ public struct TimetableView: View { // TODO: Search? } label: { Group { - Image(systemName:"magnifyingglass").foregroundStyle(Color(.onSurfaceColorset)) + Image(systemName:"magnifyingglass").foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) } .frame(width: 40, height: 40) } @@ -65,7 +68,7 @@ public struct TimetableView: View { switchModeIcon = "square.grid.2x2" } } label: { - Image(systemName:switchModeIcon).foregroundStyle(Color(.onSurfaceColorset)) + Image(systemName:switchModeIcon).foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) .frame(width: 40, height: 40) } } @@ -97,7 +100,7 @@ struct TimetableListView: View { .onAppear { store.send(.onAppear) - }.background(Color(.backgroundColorset)) + }.background(AssetColors.Surface.surface.swiftUIColor) } } } @@ -112,7 +115,7 @@ struct TimeGroupMiniList: View { Text("|") Text(contents.endsTimeString) Spacer() - }.padding(10).foregroundStyle(Color(.onSurfaceColorset)) + }.padding(10).foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) VStack { ForEach(contents.items, id: \.self) { item in ListViewItem(listItem: item) @@ -134,7 +137,7 @@ struct ListViewItem: View { TagView(tagText: lang, highlight: false) } Spacer() - Image(systemName: listItem.isFavorite ? "heart.fill" : "heart").foregroundStyle(Color(.onSurfaceColorset)) + Image(systemName: listItem.isFavorite ? "heart.fill" : "heart").foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) } Text(listItem.title).font(.title) ForEach(listItem.speakers, id: \.self){ speaker in @@ -143,10 +146,10 @@ struct ListViewItem: View { } - }.foregroundStyle(Color(.onSurfaceColorset)).padding(10) + }.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor).padding(10) .overlay( RoundedRectangle(cornerRadius: 5) - .stroke(Color(.onSurfaceColorset), lineWidth: 1) + .stroke(AssetColors.Surface.onSurface.swiftUIColor, lineWidth: 1) ) } } @@ -157,14 +160,14 @@ struct TagView: View { var body: some View { HStack { if highlight { - Image(systemName: "diamond.fill").resizable().frame(width: 11,height: 11).foregroundStyle(Color(.greenSelectColorset)) + Image(systemName: "diamond.fill").resizable().frame(width: 11,height: 11).foregroundStyle(AssetColors.Custom.arcticFox.swiftUIColor) .padding(-3) } - Text(tagText).foregroundStyle(highlight ? Color(.greenSelectColorset) : Color(.onSurfaceColorset)) + Text(tagText).foregroundStyle(highlight ? AssetColors.Custom.arcticFox.swiftUIColor : AssetColors.Surface.onSurface.swiftUIColor) } .padding( EdgeInsets(top: 2,leading: 7, bottom: 2, trailing: 7)) - .border(highlight ? Color(.greenSelectColorset) : Color(.onSurfaceColorset)) + .border(highlight ? AssetColors.Custom.arcticFox.swiftUIColor : AssetColors.Surface.onSurface.swiftUIColor) .padding(-2) } } @@ -176,7 +179,7 @@ struct PhotoView: View { var body: some View { HStack { - Image(systemName:photo).resizable().frame(width: 32,height: 32).foregroundStyle(Color(.greenSelectColorset)) + Image(systemName:photo).resizable().frame(width: 32,height: 32).foregroundStyle(AssetColors.Custom.arcticFox.swiftUIColor) Text(name) } } From cc11d664632abbbd1ae65c6e88dbfcc686726302 Mon Sep 17 00:00:00 2001 From: CHARLES BOND Date: Sat, 20 Jul 2024 10:10:27 +0900 Subject: [PATCH 8/9] Updated some text styles (others need spec verification first) --- app-ios/Sources/TimetableFeature/TimetableListView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app-ios/Sources/TimetableFeature/TimetableListView.swift b/app-ios/Sources/TimetableFeature/TimetableListView.swift index 6c290a2ed..5717da7f0 100644 --- a/app-ios/Sources/TimetableFeature/TimetableListView.swift +++ b/app-ios/Sources/TimetableFeature/TimetableListView.swift @@ -43,7 +43,8 @@ public struct TimetableView: View { .toolbar{ ToolbarItem(placement: .topBarLeading) { Text("Timetable") - .font(.title) + //.font(.title) + .textStyle(.headlineMedium) .foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) } From 43127d4ac2b3fadcdcfd32bb21d709f0460a6c12 Mon Sep 17 00:00:00 2001 From: CHARLES BOND Date: Sun, 21 Jul 2024 14:37:13 +0900 Subject: [PATCH 9/9] remvoed commented out code. --- app-ios/Sources/TimetableFeature/TimetableListView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/app-ios/Sources/TimetableFeature/TimetableListView.swift b/app-ios/Sources/TimetableFeature/TimetableListView.swift index 5717da7f0..782091b1e 100644 --- a/app-ios/Sources/TimetableFeature/TimetableListView.swift +++ b/app-ios/Sources/TimetableFeature/TimetableListView.swift @@ -43,7 +43,6 @@ public struct TimetableView: View { .toolbar{ ToolbarItem(placement: .topBarLeading) { Text("Timetable") - //.font(.title) .textStyle(.headlineMedium) .foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor)