diff --git a/iOS/RollTheDice/RollTheDice.xcodeproj/project.pbxproj b/iOS/RollTheDice/RollTheDice.xcodeproj/project.pbxproj index d2c4dcb0..9c887cb2 100644 --- a/iOS/RollTheDice/RollTheDice.xcodeproj/project.pbxproj +++ b/iOS/RollTheDice/RollTheDice.xcodeproj/project.pbxproj @@ -7,11 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 357666102BBD4BF6002C226A /* StatisticsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3576660F2BBD4BF6002C226A /* StatisticsListView.swift */; }; + 357666102BBD4BF6002C226A /* ReportListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3576660F2BBD4BF6002C226A /* ReportListView.swift */; }; 357666132BBD54AA002C226A /* SplashView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 357666122BBD54AA002C226A /* SplashView.swift */; }; - 357666152BBD5C04002C226A /* FieldStatisticsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 357666142BBD5C04002C226A /* FieldStatisticsView.swift */; }; - 357666172BBD5C5B002C226A /* DailyStatisticsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 357666162BBD5C5B002C226A /* DailyStatisticsView.swift */; }; - 3576661B2BBD65C3002C226A /* FieldStatisticsReportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3576661A2BBD65C3002C226A /* FieldStatisticsReportView.swift */; }; 357FC6EA2BCE866B00AD8915 /* DetailCardNews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 357FC6E92BCE866B00AD8915 /* DetailCardNews.swift */; }; 35C71BF22B79F39900F777D1 /* ExyteChat in Frameworks */ = {isa = PBXBuildFile; productRef = 35C71BF12B79F39900F777D1 /* ExyteChat */; }; 6C32379F2B7C376D00B699AB /* Bookmark.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C32379E2B7C376D00B699AB /* Bookmark.swift */; }; @@ -58,6 +55,12 @@ 6CDB29FB2BAA07B10081037B /* GPTChatViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CDB29FA2BAA07B10081037B /* GPTChatViewModel.swift */; }; 6CDB29FD2BAA07FD0081037B /* GPTChatView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CDB29FC2BAA07FD0081037B /* GPTChatView.swift */; }; 6CDB29FF2BAA08280081037B /* GPTChatListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CDB29FE2BAA08280081037B /* GPTChatListViewModel.swift */; }; + 6CE1030C2BD56A4000498AA4 /* TypeReportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE1030B2BD56A4000498AA4 /* TypeReportView.swift */; }; + 6CE1030E2BD56A5200498AA4 /* TypeReportModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE1030D2BD56A5200498AA4 /* TypeReportModel.swift */; }; + 6CE103102BD56A5B00498AA4 /* TypeReportViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE1030F2BD56A5B00498AA4 /* TypeReportViewModel.swift */; }; + 6CE103132BD56B1200498AA4 /* DailyReportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE103122BD56B1200498AA4 /* DailyReportView.swift */; }; + 6CE103152BD56CA800498AA4 /* DailyBarChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE103142BD56CA800498AA4 /* DailyBarChartView.swift */; }; + 6CE1031A2BD57A2500498AA4 /* DebateSummaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE103192BD57A2500498AA4 /* DebateSummaryView.swift */; }; 6CE2AC122BD43FB900416A02 /* SignInView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE2AC112BD43FB900416A02 /* SignInView.swift */; }; 6CE2AC1B2BD444BB00416A02 /* OpenAI in Frameworks */ = {isa = PBXBuildFile; productRef = 6CE2AC1A2BD444BB00416A02 /* OpenAI */; settings = {ATTRIBUTES = (Required, ); }; }; 6CF130AD2BAB0C4400A437B6 /* AuthenticationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CF130AC2BAB0C4400A437B6 /* AuthenticationViewModel.swift */; }; @@ -75,11 +78,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 3576660F2BBD4BF6002C226A /* StatisticsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticsListView.swift; sourceTree = ""; }; + 3576660F2BBD4BF6002C226A /* ReportListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportListView.swift; sourceTree = ""; }; 357666122BBD54AA002C226A /* SplashView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashView.swift; sourceTree = ""; }; - 357666142BBD5C04002C226A /* FieldStatisticsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FieldStatisticsView.swift; sourceTree = ""; }; - 357666162BBD5C5B002C226A /* DailyStatisticsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyStatisticsView.swift; sourceTree = ""; }; - 3576661A2BBD65C3002C226A /* FieldStatisticsReportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FieldStatisticsReportView.swift; sourceTree = ""; }; 357FC6E92BCE866B00AD8915 /* DetailCardNews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailCardNews.swift; sourceTree = ""; }; 6C32379E2B7C376D00B699AB /* Bookmark.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bookmark.swift; sourceTree = ""; }; 6C3237A02B7C377600B699AB /* BookmarkViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkViewModel.swift; sourceTree = ""; }; @@ -127,6 +127,12 @@ 6CDB29FA2BAA07B10081037B /* GPTChatViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GPTChatViewModel.swift; sourceTree = ""; }; 6CDB29FC2BAA07FD0081037B /* GPTChatView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GPTChatView.swift; sourceTree = ""; }; 6CDB29FE2BAA08280081037B /* GPTChatListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GPTChatListViewModel.swift; sourceTree = ""; }; + 6CE1030B2BD56A4000498AA4 /* TypeReportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeReportView.swift; sourceTree = ""; }; + 6CE1030D2BD56A5200498AA4 /* TypeReportModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeReportModel.swift; sourceTree = ""; }; + 6CE1030F2BD56A5B00498AA4 /* TypeReportViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypeReportViewModel.swift; sourceTree = ""; }; + 6CE103122BD56B1200498AA4 /* DailyReportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyReportView.swift; sourceTree = ""; }; + 6CE103142BD56CA800498AA4 /* DailyBarChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBarChartView.swift; sourceTree = ""; }; + 6CE103192BD57A2500498AA4 /* DebateSummaryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebateSummaryView.swift; sourceTree = ""; }; 6CE2AC112BD43FB900416A02 /* SignInView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInView.swift; sourceTree = ""; }; 6CF130AC2BAB0C4400A437B6 /* AuthenticationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationViewModel.swift; sourceTree = ""; }; 6CF130AE2BAB0C4F00A437B6 /* AuthenticatedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticatedView.swift; sourceTree = ""; }; @@ -155,16 +161,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 3576660D2BBD4A09002C226A /* Statistics */ = { - isa = PBXGroup; - children = ( - 3576660F2BBD4BF6002C226A /* StatisticsListView.swift */, - 357666182BBD6540002C226A /* FieldStatistics */, - 357666192BBD655A002C226A /* DailyStatistics */, - ); - path = Statistics; - sourceTree = ""; - }; 357666112BBD5494002C226A /* Splah */ = { isa = PBXGroup; children = ( @@ -173,23 +169,6 @@ path = Splah; sourceTree = ""; }; - 357666182BBD6540002C226A /* FieldStatistics */ = { - isa = PBXGroup; - children = ( - 357666142BBD5C04002C226A /* FieldStatisticsView.swift */, - 3576661A2BBD65C3002C226A /* FieldStatisticsReportView.swift */, - ); - path = FieldStatistics; - sourceTree = ""; - }; - 357666192BBD655A002C226A /* DailyStatistics */ = { - isa = PBXGroup; - children = ( - 357666162BBD5C5B002C226A /* DailyStatisticsView.swift */, - ); - path = DailyStatistics; - sourceTree = ""; - }; 6C32379D2B7C374E00B699AB /* BookmarkCard */ = { isa = PBXGroup; children = ( @@ -293,12 +272,12 @@ 6C7704882B722647001B17CB /* View */ = { isa = PBXGroup; children = ( + 6CE103092BD56A2B00498AA4 /* Report */, 357666112BBD5494002C226A /* Splah */, 6CF130AB2BAB0C2D00A437B6 /* Authentication */, 6CE2AC102BD43FA800416A02 /* SignIn */, 6C454A762B9DA62C006FD9D0 /* SignUp */, 6C77048A2B72267E001B17CB /* MainTab */, - 3576660D2BBD4A09002C226A /* Statistics */, 6C77048D2B7229A3001B17CB /* News */, 6C7704902B7229B6001B17CB /* Debate */, 6C7704932B7229C4001B17CB /* Bookmark */, @@ -328,6 +307,7 @@ 6C7704902B7229B6001B17CB /* Debate */ = { isa = PBXGroup; children = ( + 6CE103182BD57A1600498AA4 /* Summary */, 6CDB29F72BAA06FB0081037B /* ChatGPT */, 6C3237B32B7C433000B699AB /* ChatType */, ); @@ -441,6 +421,43 @@ path = ChatGPT; sourceTree = ""; }; + 6CE103092BD56A2B00498AA4 /* Report */ = { + isa = PBXGroup; + children = ( + 3576660F2BBD4BF6002C226A /* ReportListView.swift */, + 6CE103112BD56AF700498AA4 /* Daily */, + 6CE1030A2BD56A3200498AA4 /* Type */, + ); + path = Report; + sourceTree = ""; + }; + 6CE1030A2BD56A3200498AA4 /* Type */ = { + isa = PBXGroup; + children = ( + 6CE1030B2BD56A4000498AA4 /* TypeReportView.swift */, + 6CE1030D2BD56A5200498AA4 /* TypeReportModel.swift */, + 6CE1030F2BD56A5B00498AA4 /* TypeReportViewModel.swift */, + ); + path = Type; + sourceTree = ""; + }; + 6CE103112BD56AF700498AA4 /* Daily */ = { + isa = PBXGroup; + children = ( + 6CE103122BD56B1200498AA4 /* DailyReportView.swift */, + 6CE103142BD56CA800498AA4 /* DailyBarChartView.swift */, + ); + path = Daily; + sourceTree = ""; + }; + 6CE103182BD57A1600498AA4 /* Summary */ = { + isa = PBXGroup; + children = ( + 6CE103192BD57A2500498AA4 /* DebateSummaryView.swift */, + ); + path = Summary; + sourceTree = ""; + }; 6CE2AC102BD43FA800416A02 /* SignIn */ = { isa = PBXGroup; children = ( @@ -606,7 +623,9 @@ files = ( 6C454A882B9DB6C2006FD9D0 /* CustomNavigationBar.swift in Sources */, 6CF130BF2BAB783300A437B6 /* APIConstants.swift in Sources */, + 6CE103102BD56A5B00498AA4 /* TypeReportViewModel.swift in Sources */, 6CF130C52BAB79DE00A437B6 /* RollTheDiceAPI.swift in Sources */, + 6CE103132BD56B1200498AA4 /* DailyReportView.swift in Sources */, 6C454A7A2B9DA67C006FD9D0 /* SignUpViewModel.swift in Sources */, 6C3237AA2B7C381500B699AB /* NewsView.swift in Sources */, 6CF130C92BAB7CC200A437B6 /* BaseTargetType.swift in Sources */, @@ -614,11 +633,10 @@ 6CF130AD2BAB0C4400A437B6 /* AuthenticationViewModel.swift in Sources */, 6CDB29F92BAA07350081037B /* GPTChat.swift in Sources */, 6CDB29FD2BAA07FD0081037B /* GPTChatView.swift in Sources */, - 357666102BBD4BF6002C226A /* StatisticsListView.swift in Sources */, + 357666102BBD4BF6002C226A /* ReportListView.swift in Sources */, 6C3237A12B7C377600B699AB /* BookmarkViewModel.swift in Sources */, 6C3237AC2B7C382200B699AB /* News.swift in Sources */, - 3576661B2BBD65C3002C226A /* FieldStatisticsReportView.swift in Sources */, - 357666152BBD5C04002C226A /* FieldStatisticsView.swift in Sources */, + 6CE1030E2BD56A5200498AA4 /* TypeReportModel.swift in Sources */, 357FC6EA2BCE866B00AD8915 /* DetailCardNews.swift in Sources */, 6CC4DDC92B5574670080E7E8 /* ContentView.swift in Sources */, 6C3237A52B7C37D100B699AB /* BookmarkView.swift in Sources */, @@ -634,7 +652,6 @@ 6CF130B22BAB74BA00A437B6 /* NewsService.swift in Sources */, 6C3237B22B7C385000B699AB /* NewsListViewModel.swift in Sources */, 6C454A782B9DA657006FD9D0 /* SignUpQuestionView.swift in Sources */, - 357666172BBD5C5B002C226A /* DailyStatisticsView.swift in Sources */, 6CA901962BA2EC0100E20259 /* Font.swift in Sources */, 6CF130C22BAB786600A437B6 /* APIHeaderManager.swift in Sources */, 6CDB29FB2BAA07B10081037B /* GPTChatViewModel.swift in Sources */, @@ -642,12 +659,15 @@ 6C454A7E2B9DAA3F006FD9D0 /* SignUpFinishView.swift in Sources */, 6C7704A12B722CEB001B17CB /* ProfileView.swift in Sources */, 6C3237B72B7C434600B699AB /* ChatType.swift in Sources */, + 6CE103152BD56CA800498AA4 /* DailyBarChartView.swift in Sources */, 6CE2AC122BD43FB900416A02 /* SignInView.swift in Sources */, 6CC4DDC72B5574670080E7E8 /* RollTheDiceApp.swift in Sources */, 6C77048C2B722686001B17CB /* MainTabView.swift in Sources */, 6C7704992B722A20001B17CB /* MainTabViewModel.swift in Sources */, 6C454A7C2B9DA71C006FD9D0 /* SignUpView.swift in Sources */, 6CF130C72BAB7B9800A437B6 /* RollTheDiceAPINews.swift in Sources */, + 6CE1031A2BD57A2500498AA4 /* DebateSummaryView.swift in Sources */, + 6CE1030C2BD56A4000498AA4 /* TypeReportView.swift in Sources */, 6C77049D2B722CE0001B17CB /* BookmarkListView.swift in Sources */, 6C77049B2B722A5A001B17CB /* TabType.swift in Sources */, ); diff --git a/iOS/RollTheDice/RollTheDice/RollTheDiceApp.swift b/iOS/RollTheDice/RollTheDice/RollTheDiceApp.swift index 20d1db1f..1997d440 100644 --- a/iOS/RollTheDice/RollTheDice/RollTheDiceApp.swift +++ b/iOS/RollTheDice/RollTheDice/RollTheDiceApp.swift @@ -14,6 +14,7 @@ struct RollTheDiceApp: App { @StateObject private var pathModel = PathModel() @StateObject var newsListViewModel = NewsListViewModel() + @StateObject var bookmarkListViewModel = BookmarkListViewModel() var body: some Scene { WindowGroup { @@ -23,6 +24,7 @@ struct RollTheDiceApp: App { MainTabView(newsListViewModel: newsListViewModel) .navigationDestination(for: PathType.self, destination: { pathType in + // 각 뷰마다 .navigationBarBackButtonHidden() 설정하기! switch pathType { case .chatView(isAiMode: true) : GPTChatView() @@ -31,11 +33,25 @@ struct RollTheDiceApp: App { case .chatView(isAiMode: false): Text("user") .navigationBarBackButtonHidden() + case .detailNewsView: + DetailCardNews() + case .typeReportView: + TypeReportView() + case .dailyReportView: + DailyReportView() + case .bookmarkView: + BookmarkListView(bookmarkListViewModel: bookmarkListViewModel) + case .mypageView: + Text("mypageView") + case .debateSummaryView: + DebateSummaryView() } }) } + .environmentObject(pathModel) + } else { SignUpView() } diff --git a/iOS/RollTheDice/RollTheDice/Source/Model/Path/PathType.swift b/iOS/RollTheDice/RollTheDice/Source/Model/Path/PathType.swift index 7cd3d0f5..2ec6fb10 100644 --- a/iOS/RollTheDice/RollTheDice/Source/Model/Path/PathType.swift +++ b/iOS/RollTheDice/RollTheDice/Source/Model/Path/PathType.swift @@ -9,4 +9,13 @@ import Foundation enum PathType: Hashable { case chatView(isAiMode: Bool) + case detailNewsView // 뉴스 자세히 보기 + + case typeReportView // 분야별 뉴스 통계 + case dailyReportView // 요일별 뉴스 관람 개수 통계 + + case debateSummaryView // 토론 요약 페이지 뷰 + + case bookmarkView // 북마크뷰 + case mypageView // 마이페이지뷰 } diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Bookmark/BookmarkListView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Bookmark/BookmarkListView.swift index f652615a..ad0be59d 100644 --- a/iOS/RollTheDice/RollTheDice/Source/View/Bookmark/BookmarkListView.swift +++ b/iOS/RollTheDice/RollTheDice/Source/View/Bookmark/BookmarkListView.swift @@ -8,43 +8,87 @@ import SwiftUI struct BookmarkListView: View { - @EnvironmentObject var bookmarkListViewModel : BookmarkListViewModel + @EnvironmentObject var pathModel: PathModel + @StateObject var bookmarkListViewModel : BookmarkListViewModel @State var selectedIndex: Int = 0 + var columns: [GridItem] = [ GridItem(), GridItem()] + var body: some View { ZStack { Color.backgroundDark.ignoresSafeArea(.all) - BookmarkListContentView() - .padding(.leading, 20) + ZStack { + bookmarkListView +// BookmarkListContentView() + .padding(.leading, 20) + VStack(spacing: 0) { + + CustomNavigationBar( + title: "북마크", + isDisplayLeadingBtn: true, + leadingItems: + [ + (Image(.chevronLeft), { pathModel.paths.popLast() }), + ] + ) + + Spacer() + + } + + Spacer() + } } + .navigationBarBackButtonHidden() } - private struct BookmarkListContentView: View { - @EnvironmentObject var bookmarkListViewModel: BookmarkListViewModel - var columns: [GridItem] = [ GridItem(), GridItem() ] + var bookmarkListView: some View { - fileprivate var body: some View { - ScrollViewReader { value in - ScrollView(.horizontal, showsIndicators: false) { - LazyHGrid(rows: columns, spacing: 10) { - ForEach(bookmarkListViewModel.bookmarkList, id: \.self) { bookmark in - BookmarkView(bookmark: bookmark) + + ScrollViewReader { value in + ScrollView(.horizontal, showsIndicators: false) { + LazyHGrid(rows: columns, spacing: 10) { + ForEach(bookmarkListViewModel.bookmarkList, id: \.self) { bookmark in + BookmarkView(bookmark: bookmark) // .onTapGesture { // withAnimation { // selectedIndex = index // value.scrollTo(index) // } // } - } } - .padding(.vertical, 90) } + .padding(.vertical, 90) } } } + +// private struct BookmarkListContentView: View { +// @StateObject var bookmarkListViewModel: BookmarkListViewModel +// var columns: [GridItem] = [ GridItem(), GridItem()] +// +// fileprivate var body: some View { +// ScrollViewReader { value in +// ScrollView(.horizontal, showsIndicators: false) { +// LazyHGrid(rows: columns, spacing: 10) { +// ForEach(bookmarkListViewModel.bookmarkList, id: \.self) { bookmark in +// BookmarkView(bookmark: bookmark) +//// .onTapGesture { +//// withAnimation { +//// selectedIndex = index +//// value.scrollTo(index) +//// } +//// } +// } +// } +// .padding(.vertical, 90) +// } +// } +// } +// } } #Preview { - BookmarkListView() + BookmarkListView(bookmarkListViewModel: BookmarkListViewModel()) .environmentObject(BookmarkListViewModel()) } diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Debate/ChatType/ChatTypeView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Debate/ChatType/ChatTypeView.swift index 9c43fc90..f93b8c35 100644 --- a/iOS/RollTheDice/RollTheDice/Source/View/Debate/ChatType/ChatTypeView.swift +++ b/iOS/RollTheDice/RollTheDice/Source/View/Debate/ChatType/ChatTypeView.swift @@ -9,90 +9,143 @@ import SwiftUI struct ChatTypeView: View { @EnvironmentObject private var pathModel: PathModel - @State var isSelected: Bool = false +// @State var isSelected: Bool = false var body: some View { ZStack { Color.backgroundDark.ignoresSafeArea(.all) - ChatTypeContentView(isSelected: $isSelected) + VStack { + CustomNavigationBar( + isDisplayTrailingBtn: true, + trailingItems: [ + (Image(.bookmarkfill), { pathModel.paths.append(.bookmarkView)}), + (Image(.profileWhite), { pathModel.paths.append(.mypageView)}) + ] + ) + Spacer() + recentReadNewsView + Spacer() + + chatListView + + + } + } } - private struct ChatTypeContentView: View { - - @Binding var isSelected: Bool - @EnvironmentObject private var pathModel: PathModel - - fileprivate var body: some View { + var recentReadNewsView: some View { + VStack(alignment: .leading) { + Text("최근에 본 뉴스") + .foregroundStyle(.gray01) + .font(.pretendardBold32) HStack { Button { - isSelected.toggle() - pathModel.paths.append(.chatView(isAiMode: true)) + // isSelected.toggle() + // pathModel.paths.append(.chatView(isAiMode: true)) } label: { RoundedRectangle(cornerRadius: 15) .foregroundStyle(.primary01) - .frame(width: 350, height: 400) - + .frame(width: 200, height: 200) + .overlay { VStack { HStack { - Text("Chat GPT랑\n토론하기") + Text("기사제목") .multilineTextAlignment(.leading) - .font(.system(size: 40, weight: .bold)) + .font(.pretendardBold24) .foregroundStyle(.basicWhite) - - Spacer() } - - Spacer() - + } + } + } + + Button { + // isSelected.toggle() + // pathModel.paths.append(.chatView(isAiMode: true)) + } label: { + RoundedRectangle(cornerRadius: 15) + .foregroundStyle(.primary01) + .frame(width: 200, height: 200) + + .overlay { + VStack { HStack { - Spacer() - Text("🤖") - .font(.system(size: 100)) + Text("기사제목") + .multilineTextAlignment(.leading) + .font(.pretendardBold24) + .foregroundStyle(.basicWhite) } } - .padding(.horizontal, 35) - .padding(.bottom, 35) - .padding(.top, 45) - - } } Button { - pathModel.paths.append(.chatView(isAiMode: false)) + // isSelected.toggle() + // pathModel.paths.append(.chatView(isAiMode: true)) } label: { RoundedRectangle(cornerRadius: 15) - .foregroundStyle(.gray01) - .frame(width: 350, height: 400) - + .foregroundStyle(.primary01) + .frame(width: 200, height: 200) + .overlay { VStack { HStack { - Spacer() - Text("인간이랑\n토론하기") - .multilineTextAlignment(.trailing) - .font(.system(size: 40, weight: .bold)) - .foregroundStyle(.primary01) + Text("기사제목") + .multilineTextAlignment(.leading) + .font(.pretendardBold24) + .foregroundStyle(.basicWhite) } - - Spacer() - + } + } + } + } + } + } + + var chatListView: some View { + VStack(alignment: .leading) { + + Text("채팅 목록") + .foregroundStyle(.gray01) + .font(.pretendardBold32) + + ScrollView { + HStack { + Button { + // isSelected.toggle() + // pathModel.paths.append(.chatView(isAiMode: true)) + } label: { + RoundedRectangle(cornerRadius: 15) + .foregroundStyle(.primary01) + .frame(width: 600, height: 100) + + .overlay { HStack { - Text("🫶") - .font(.system(size: 100)) + Text("기사제목") + .multilineTextAlignment(.leading) + .font(.pretendardBold24) + .foregroundStyle(.basicWhite) + Spacer() + + } } - .padding(.horizontal, 35) - .padding(.bottom, 35) - .padding(.top, 45) - } + } + Button { + pathModel.paths.append(.debateSummaryView) + } label: { + + Image(.chevronRight) + .padding(10) + .background(.basicBlack) + } } } } } + } #Preview { diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Debate/Summary/DebateSummaryView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Debate/Summary/DebateSummaryView.swift new file mode 100644 index 00000000..8c17b97c --- /dev/null +++ b/iOS/RollTheDice/RollTheDice/Source/View/Debate/Summary/DebateSummaryView.swift @@ -0,0 +1,114 @@ +// +// DebateSummaryView.swift +// RollTheDice +// +// Created by Subeen on 4/22/24. +// + +import SwiftUI + +struct DebateSummaryView: View { + @EnvironmentObject var pathModel: PathModel + + var body: some View { + ZStack { + Color.backgroundDark.ignoresSafeArea(.all) + + VStack { + CustomNavigationBar(title: "토론요약", isDisplayLeadingBtn: true, leadingItems: [(Image(.chevronLeft), { pathModel.paths.popLast() })]) + + sumView + + } + } + .navigationBarBackButtonHidden() + } + + var sumView: some View { + HStack(spacing: 0) { + Rectangle() + .foregroundStyle( + LinearGradient(colors: [.gray02, .gray02, .gray04], startPoint: .leading, endPoint: .trailing) + + ) + .frame(width: 88) + .clipShape(UnevenRoundedRectangle(topLeadingRadius: 20, topTrailingRadius: 20)) + + ZStack { + + UnevenRoundedRectangle(topLeadingRadius: 20, topTrailingRadius: 20) + .offset(x: 30, y: 20) + .foregroundStyle(.gray05) + .padding(.bottom, 20) + Rectangle() + .foregroundStyle( + LinearGradient(colors: [.gray03, .gray02, .gray02, .gray02, .gray02, .gray02, .gray02], startPoint: .leading, endPoint: .trailing) + + ) + .clipShape(UnevenRoundedRectangle(topLeadingRadius: 20, topTrailingRadius: 20)) + .overlay { + UnevenRoundedRectangle(topLeadingRadius: 20, topTrailingRadius: 20) + .stroke(.gray07, lineWidth: 1.0) + } + + + } + // TODO: 말풍선 수정하기 + .overlay { + VStack(spacing: 20) { + Rectangle() + .frame(height: 1) + + Text("“ 이번 토론의 핵심 내용을 알려줄게요! ”") + .font(.pretendardBold40) + .padding(.top, 40) + + HStack(alignment: .top, spacing: 0) { + UnevenRoundedRectangle(topLeadingRadius: 60, bottomLeadingRadius: 60, bottomTrailingRadius: 60) + .foregroundStyle(.gray03) + .overlay { + Text("요약") + + } + ZStack(alignment: .topLeading) { + Rectangle() + .frame(width: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, height: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/) + .foregroundStyle(.gray03) + Circle() + + .trim(from: 0.5, to: 1) + +// .trim(from: 0, to: 0.5) + .frame(width: 200, height: 200) +// .clipped() + .foregroundStyle(.gray02) + + } + + + Image(.scoopGray01) + .resizable() + .scaledToFit() + .frame(height: 400) + +// .frame(height: 350, alignment: .top) +// .clipped() + } + .padding(.horizontal, 40) + + Spacer() + Rectangle() + .frame(height: 1) + } + .padding(.horizontal, 40) + .padding(.vertical, 40) + } + } + .padding(.top, 60) + .padding(.horizontal, 110) + } +} + +#Preview { + DebateSummaryView() +} diff --git a/iOS/RollTheDice/RollTheDice/Source/View/MainTab/MainTabView.swift b/iOS/RollTheDice/RollTheDice/Source/View/MainTab/MainTabView.swift index 6c9d2d26..bd9ca7d9 100644 --- a/iOS/RollTheDice/RollTheDice/Source/View/MainTab/MainTabView.swift +++ b/iOS/RollTheDice/RollTheDice/Source/View/MainTab/MainTabView.swift @@ -18,30 +18,39 @@ struct MainTabView: View { ZStack { Color.backgroundDark .ignoresSafeArea(.all) - - TabView(selection: $mainTabViewModel.selectedTabItem) { + VStack { + CustomNavigationBar( + isDisplayTrailingBtn: true, + trailingItems: [ + (Image(.bookmarkfill), { pathModel.paths.append(.bookmarkView)}), + (Image(.profileWhite), { pathModel.paths.append(.mypageView)}) + ] + ) - StatisticsListView() - .tabItem { - Image(systemName: "list.bullet.rectangle") - } - .tag(0) - - NewsListView(newsListViewModel: newsListViewModel) - .tabItem { - Image(systemName: "square.3.layers.3d.down.left") - } -// .environmentObject(newsListViewModel) - .tag(1) - - ChatTypeView() -// .environmentObject(pathModel) - .tabItem { - Image(systemName: "message") - } -// .environmentObject(pathModel) - .tag(2) - + TabView(selection: $mainTabViewModel.selectedTabItem) { + + ReportListView() + .tabItem { + Image(systemName: "list.bullet.rectangle") + } + .tag(0) + + NewsListView(newsListViewModel: newsListViewModel) + .tabItem { + Image(systemName: "square.3.layers.3d.down.left") + } + // .environmentObject(newsListViewModel) + .tag(1) + + ChatTypeView() + // .environmentObject(pathModel) + .tabItem { + Image(systemName: "message") + } + // .environmentObject(pathModel) + .tag(2) + + } } } } diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Report/Daily/DailyBarChartView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Report/Daily/DailyBarChartView.swift new file mode 100644 index 00000000..62b7b0e4 --- /dev/null +++ b/iOS/RollTheDice/RollTheDice/Source/View/Report/Daily/DailyBarChartView.swift @@ -0,0 +1,135 @@ +// +// DailyBarChartView.swift +// RollTheDice +// +// Created by Subeen on 4/22/24. +// + + +import SwiftUI +import Charts + +struct DailyBarChartView: View { + + @State var selectedDay: Date? + @State var selectedView: Int? + + var previews: [DailyViews] = [ + .init(dateStr: "1월 1일", views: 32), + .init(dateStr: "1월 2일", views: 2), + .init(dateStr: "1월 3일", views: 300), + .init(dateStr: "1월 4일", views: 999), + .init(dateStr: "1월 5일", views: 12), + .init(dateStr: "1월 6일", views: 1), + .init(dateStr: "1월 7일", views: 99), + ] + + // TODO: 평균 기사 개수 구하는 함수 작성 + var avg: Double = 99.9 + + var body: some View { + VStack(alignment: .leading) { + HStack { + VStack(alignment: .leading) { + Text("이번주 평균") + .foregroundStyle(.gray04) + .font(.pretendardBold12) + HStack { + Text("\(avg)") + .foregroundStyle(.basicWhite) + .font(.pretendardBold40) + Text("기사") + .foregroundStyle(.gray04) + .font(.pretendardBold12) + } + } + Spacer() + } + + Chart{ + ForEach(previews) { day in + BarMark( + x: .value("Day", day.date, unit: .day), + y: .value("Views", day.views) + + ) + .foregroundStyle(.orange) + } + + if let selectedView = selectedView { + RuleMark( +// x: .value("Day", selectedDay!) + y: .value("Views", selectedView) + ) + .annotation( + position: .top, + alignment: .leading, + overflowResolution: .init( + x: .fit(to: .chart), + y: .disabled + ) + ) { +// Text("\(previews[selectedDay])") + Text("\(selectedView)") + } + } + } + + .padding(.horizontal, 20) + .chartXAxis { + AxisMarks(values: .stride(by: .day)) + } +// .chartYAxis { +// AxisMarks(preset: .extended, position: .leading) +// } + .chartYAxis(.hidden) + .chartXSelection(value: $selectedDay) + .chartYSelection(value: $selectedView) +// .chartOverlay { proxy in +// GeometryReader { geometry in +// Rectangle().fill(.clear).contentShape(Rectangle()) +// .onTapGesture { value in +//// let posX = +// } +// .gesture( +// DragGesture() +// .onChanged { value in +// let origin = geometry[proxy.plotFrame!].origin +// let location = CGPoint( +// x: value.location.x - origin.x, +// y: value.location.y - origin.y +// ) +// +// selectedDay = proxy.value(atX: location.x, as: Date.self)! +// let (date, view) = proxy.value(at: location, as: (Date, Int).self)! +// print("Location \(date), \(view)") +// } +// ) +// +// } +// } + } + .frame(width: 440, height: 300) + } +} + + +struct DailyViews: Identifiable { + let id = UUID() + let dateStr: String // DateFormatter로 변환 + let views: Int + + var date: Date { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "MM월 dd일" + + let convertedDate = dateFormatter.date(from: dateStr)! + + return convertedDate + } +} + + +#Preview { + DailyBarChartView() +} diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Report/Daily/DailyReportView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Report/Daily/DailyReportView.swift new file mode 100644 index 00000000..3bbf9246 --- /dev/null +++ b/iOS/RollTheDice/RollTheDice/Source/View/Report/Daily/DailyReportView.swift @@ -0,0 +1,104 @@ +// +// DailyReportView.swift +// RollTheDice +// +// Created by Subeen on 4/22/24. +// + +import SwiftUI + + +struct DailyReportView: View { + var body: some View { + ZStack { + Color.backgroundDark.ignoresSafeArea(.all) + + VStack { +// CustomNavigationBar(title: "요일별 뉴스 관람 개수 통계", isDisplayLeadingBtn: true, leadingItems: [(Image(.chevronLeft), {})]) + + Spacer() + + HStack { + statisticsView + reportView + } + .frame(height: 500) + .padding(.horizontal, 110) + + Spacer() + } + + } + } + + + /// 데일리 막대 그래프 + var statisticsView: some View { + RoundedRectangle(cornerRadius: 16) + .stroke(.basicWhite, lineWidth: /*@START_MENU_TOKEN@*/1.0/*@END_MENU_TOKEN@*/) + .background(.gray07) + .overlay { + DailyBarChartView() + } + } + + // TODO : 배치 바꾸기!! + /// 상단 막대 + 분야별 뉴스 통계 박스 + 통계 글 + 캐릭터 + /// 하단 막대 + /// 각각 묶어서 ZStack에 배치하기 + var reportView: some View { + RoundedRectangle(cornerRadius: 16) + .foregroundStyle(.gray02) + .overlay { + ZStack { + VStack { + Rectangle() + .frame(height: 1) + + + Rectangle() + .stroke(lineWidth: /*@START_MENU_TOKEN@*/1.0/*@END_MENU_TOKEN@*/) + .frame(height: 52) + .overlay { + Text("요일별 뉴스 관람 개수 통계") + .font(.pretendardBold24) + .foregroundStyle(.gray06) + } + .padding(.vertical, 20) + + + HStack { + Text("안녕하세요. 이것은 통계입니다. 안녕하세요. 이것은 통계입니다. ") + .multilineTextAlignment(.leading) + + Spacer() + } + .padding(.horizontal, 4) + + Spacer() + + Rectangle() + .frame(height: 1) + } + .padding(.vertical, 34) + .padding(.horizontal, 24) + .foregroundStyle(.gray06) + + HStack { + Spacer() + VStack { + Spacer() + Image(.scoopGray04) + .aspectRatio(0.5, contentMode: .fill) + .frame(height: 250, alignment: .top) + .clipped() + } + } + } + } + } +} + +#Preview { + DailyReportView() +} diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Statistics/StatisticsListView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Report/ReportListView.swift similarity index 91% rename from iOS/RollTheDice/RollTheDice/Source/View/Statistics/StatisticsListView.swift rename to iOS/RollTheDice/RollTheDice/Source/View/Report/ReportListView.swift index 179b5975..0f298953 100644 --- a/iOS/RollTheDice/RollTheDice/Source/View/Statistics/StatisticsListView.swift +++ b/iOS/RollTheDice/RollTheDice/Source/View/Report/ReportListView.swift @@ -8,7 +8,7 @@ import SwiftUI -struct StatisticsListView: View { +struct ReportListView: View { @State private var selectedSegment = 0 @@ -41,9 +41,9 @@ struct StatisticsListView: View { Spacer() if selectedSegment == 0 { - FieldStatisticsListView() + TypeReportView() } else if selectedSegment == 1 { - DailyStatisticsView() + DailyReportView() } @@ -58,5 +58,5 @@ struct StatisticsListView: View { } #Preview { - StatisticsListView() + ReportListView() } diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportModel.swift b/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportModel.swift new file mode 100644 index 00000000..e429c173 --- /dev/null +++ b/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportModel.swift @@ -0,0 +1,21 @@ +// +// TypeReport.swift +// RollTheDice +// +// Created by Subeen on 4/21/24. +// + +import Foundation + +struct TypeReport { + var typeReportList: [[NewsType : Double]] +} + +enum NewsType { + case politics // 정치 + case economy // 경제 + case society // 사회 + case living // 생활/문화 + case world // 세계 + case science // IT/과학 +} diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportView.swift new file mode 100644 index 00000000..edb012e1 --- /dev/null +++ b/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportView.swift @@ -0,0 +1,98 @@ +// +// TypeReportView.swift +// RollTheDice +// +// Created by Subeen on 4/21/24. +// + +import SwiftUI + +struct TypeReportView: View { + var body: some View { + ZStack { + Color.backgroundDark.ignoresSafeArea(.all) + + VStack { +// CustomNavigationBar(title: "분야별 레포트", isDisplayLeadingBtn: true, leadingItems: [(Image(.chevronLeft), {})]) + + Spacer() + + HStack { + statisticsView + reportView + } + .frame(height: 500) + .padding(.horizontal, 110) + + Spacer() + } + + } + } + + var statisticsView: some View { + RoundedRectangle(cornerRadius: 16) + .stroke(.basicWhite, lineWidth: /*@START_MENU_TOKEN@*/1.0/*@END_MENU_TOKEN@*/) + .background(.gray07) + } + + // TODO : 배치 바꾸기!! + /// 상단 막대 + 분야별 뉴스 통계 박스 + 통계 글 + 캐릭터 + /// 하단 막대 + /// 각각 묶어서 ZStack에 배치하기 + var reportView: some View { + RoundedRectangle(cornerRadius: 16) + .foregroundStyle(.gray02) + .overlay { + ZStack { + VStack { + Rectangle() + .frame(height: 1) + + + Rectangle() + .stroke(lineWidth: /*@START_MENU_TOKEN@*/1.0/*@END_MENU_TOKEN@*/) + .frame(height: 52) + .overlay { + Text("분야별 뉴스 통계") + .font(.pretendardBold24) + .foregroundStyle(.gray06) + } + .padding(.vertical, 20) + + + HStack { + Text("안녕하세요. 이것은 통계입니다. 안녕하세요. 이것은 통계입니다. ") + .multilineTextAlignment(.leading) + Spacer() + } + .padding(.horizontal, 4) + + Spacer() + + Rectangle() + .frame(height: 1) + } + .padding(.vertical, 34) + .padding(.horizontal, 24) + .foregroundStyle(.gray06) + + HStack { + Spacer() + VStack { + Spacer() + Image(.scoopGray04) + .aspectRatio(0.5, contentMode: .fill) + .frame(height: 250, alignment: .top) + .clipped() + } +// Spacer() + } + } + } + } +} + +#Preview { + TypeReportView() +} diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportViewModel.swift b/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportViewModel.swift new file mode 100644 index 00000000..6c77c825 --- /dev/null +++ b/iOS/RollTheDice/RollTheDice/Source/View/Report/Type/TypeReportViewModel.swift @@ -0,0 +1,27 @@ +// +// TypeReportViewModel.swift +// RollTheDice +// +// Created by Subeen on 4/21/24. +// + +import Foundation + +class TypeReportViewModel: ObservableObject { + @Published var typeReportList: TypeReport + + init( + typeReportList: TypeReport = .init( + typeReportList: [ + [NewsType.economy : 10.0], + [NewsType.living : 20.0], + [NewsType.politics : 30.0], + [NewsType.science : 5.0], + [NewsType.society : 5.0], + [NewsType.world : 30.0], + ] + ) + ) { + self.typeReportList = typeReportList + } +} diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Statistics/DailyStatistics/DailyStatisticsView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Statistics/DailyStatistics/DailyStatisticsView.swift deleted file mode 100644 index e8f1e3c6..00000000 --- a/iOS/RollTheDice/RollTheDice/Source/View/Statistics/DailyStatistics/DailyStatisticsView.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// DailyStatisticsView.swift -// RollTheDice -// -// Created by 신예진 on 4/3/24. -// - -import Foundation -import SwiftUI - -struct DailyStatisticsView: View { - - var body: some View { - ZStack{ - Color.backgroundDark - .ignoresSafeArea(.all) - - ScrollView(.horizontal){ - - HStack{ - - VStack{ - Image("graph2") - - Spacer() - .frame(height: 50) - - Text("뉴스관람빈도") - .bold() - .font(.system(size: 20)) - } - - Spacer() - .frame(width: 100) - - } - - } - - } - } - -} - -#Preview { - DailyStatisticsView() -} diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Statistics/FieldStatistics/FieldStatisticsReportView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Statistics/FieldStatistics/FieldStatisticsReportView.swift deleted file mode 100644 index b45cafec..00000000 --- a/iOS/RollTheDice/RollTheDice/Source/View/Statistics/FieldStatistics/FieldStatisticsReportView.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// FieldStatisticsReportView.swift -// RollTheDice -// -// Created by 신예진 on 4/3/24. -// - -import SwiftUI - -struct FieldStatisticsListView: View { - - var body: some View { - ZStack { - Rectangle() - .fill(Color.white) - .frame(width: 1000, height: 500) - .cornerRadius(10) - .shadow(radius: 5) - - VStack { - - Image("graph1") - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 500, height: 500) - - HStack{ - Text("텍스트 예시") - .font(.title) - .foregroundColor(.black) - - } - - } - .padding() - - Spacer() - - - - - - - } - } -} - -struct FieldStatisticsListView_Previews: PreviewProvider { - static var previews: some View { - FieldStatisticsListView() - } -} diff --git a/iOS/RollTheDice/RollTheDice/Source/View/Statistics/FieldStatistics/FieldStatisticsView.swift b/iOS/RollTheDice/RollTheDice/Source/View/Statistics/FieldStatistics/FieldStatisticsView.swift deleted file mode 100644 index c5a6c2e6..00000000 --- a/iOS/RollTheDice/RollTheDice/Source/View/Statistics/FieldStatistics/FieldStatisticsView.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// FieldStatisticsView.swift -// RollTheDice -// -// Created by 신예진 on 4/3/24. -// - - -import SwiftUI - -struct FieldStatisticsView: View { - - var body: some View { - ZStack{ - Color.backgroundDark - .ignoresSafeArea(.all) - - ScrollView(.horizontal){ - - HStack{ - - VStack{ - Image("graph1") - - Spacer() - .frame(height: 50) - - Text("유저관심사반영") - .bold() - .font(.system(size: 20)) - } - - Spacer() - .frame(width: 100) - - } - - - - } - - } - - } - -} - -#Preview { - FieldStatisticsView() -}