diff --git a/Spon-us.xcodeproj/project.pbxproj b/Spon-us.xcodeproj/project.pbxproj index 390f47e..f7dc067 100644 --- a/Spon-us.xcodeproj/project.pbxproj +++ b/Spon-us.xcodeproj/project.pbxproj @@ -115,6 +115,8 @@ DF498F272B79B45D00ADE078 /* KeyChainManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF498F262B79B45D00ADE078 /* KeyChainManager.swift */; }; DF498F2A2B7CDDA200ADE078 /* MyAnnouncementsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF498F292B7CDDA200ADE078 /* MyAnnouncementsModel.swift */; }; DF498F2C2B7CDDB200ADE078 /* MyAnnouncementsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF498F2B2B7CDDB200ADE078 /* MyAnnouncementsViewModel.swift */; }; + DF498F2E2B7DF4F600ADE078 /* LogoutModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF498F2D2B7DF4F500ADE078 /* LogoutModel.swift */; }; + DF498F302B7DF50200ADE078 /* LogoutViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF498F2F2B7DF50200ADE078 /* LogoutViewModel.swift */; }; DF90A5AB2B64EB5500BC54D0 /* TermsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF90A5AA2B64EB5500BC54D0 /* TermsView.swift */; }; DF90A5AD2B664E5A00BC54D0 /* ProcessingPolicyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF90A5AC2B664E5A00BC54D0 /* ProcessingPolicyView.swift */; }; DF90A5B02B664E9600BC54D0 /* GatherAndUsageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF90A5AF2B664E9600BC54D0 /* GatherAndUsageView.swift */; }; @@ -204,6 +206,8 @@ DF498F262B79B45D00ADE078 /* KeyChainManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyChainManager.swift; sourceTree = ""; }; DF498F292B7CDDA200ADE078 /* MyAnnouncementsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyAnnouncementsModel.swift; sourceTree = ""; }; DF498F2B2B7CDDB200ADE078 /* MyAnnouncementsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyAnnouncementsViewModel.swift; sourceTree = ""; }; + DF498F2D2B7DF4F500ADE078 /* LogoutModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogoutModel.swift; sourceTree = ""; }; + DF498F2F2B7DF50200ADE078 /* LogoutViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogoutViewModel.swift; sourceTree = ""; }; DF90A5AA2B64EB5500BC54D0 /* TermsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsView.swift; sourceTree = ""; }; DF90A5AC2B664E5A00BC54D0 /* ProcessingPolicyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcessingPolicyView.swift; sourceTree = ""; }; DF90A5AF2B664E9600BC54D0 /* GatherAndUsageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GatherAndUsageView.swift; sourceTree = ""; }; @@ -291,10 +295,10 @@ 100A1E352B7348DB00AAC1E8 /* Model */ = { isa = PBXGroup; children = ( + 100A1E362B734DA500AAC1E8 /* Onboarding */, DF498F282B7CDD8200ADE078 /* Portfolio */, 806AF8712B7B84F2008F7F62 /* Announcement */, 806AF8682B79D985008F7F62 /* Category */, - 100A1E362B734DA500AAC1E8 /* Onboarding */, 10025B422B7C139300DCCC5A /* ReceivedOffer */, 10025B352B7B7B8700DCCC5A /* SendOffer */, 107D6E672B7A821D005B6261 /* MyPage */, @@ -311,6 +315,8 @@ DFB22ED82B767003007903DF /* JoinViewModel.swift */, DF498F222B791EA800ADE078 /* LoginModel.swift */, DF498F242B791EB400ADE078 /* LoginViewModel.swift */, + DF498F2D2B7DF4F500ADE078 /* LogoutModel.swift */, + DF498F2F2B7DF50200ADE078 /* LogoutViewModel.swift */, ); path = Onboarding; sourceTree = ""; @@ -723,6 +729,7 @@ 10EBD8112B6FD6D60082CD8E /* ProfileEditView.swift in Sources */, 3B81BCB62B622EEA0067E9CB /* Extension.swift in Sources */, 107D6E692B7A8273005B6261 /* OrganizationModel.swift in Sources */, + DF498F302B7DF50200ADE078 /* LogoutViewModel.swift in Sources */, 100D38B32B4EF15600498977 /* HomeView.swift in Sources */, 10C8AC632B5C34C400B40547 /* CompanyPostView.swift in Sources */, DF3AD3DF2B61626300DBFCCC /* OnBoardingView.swift in Sources */, @@ -739,6 +746,7 @@ DF498F2A2B7CDDA200ADE078 /* MyAnnouncementsModel.swift in Sources */, DF90A5B02B664E9600BC54D0 /* GatherAndUsageView.swift in Sources */, 806AF8732B7B8504008F7F62 /* AnnouncementViewModel.swift in Sources */, + DF498F2E2B7DF4F600ADE078 /* LogoutModel.swift in Sources */, 10EBD80D2B6F783F0082CD8E /* HonorInfoEditView.swift in Sources */, 100A1E3A2B734DDE00AAC1E8 /* EmailViewModel.swift in Sources */, 1031EC7C2B68B9F20016655B /* AnnouncementView.swift in Sources */, diff --git a/Spon-us/Model/Onboarding/LogoutModel.swift b/Spon-us/Model/Onboarding/LogoutModel.swift new file mode 100644 index 0000000..e96582a --- /dev/null +++ b/Spon-us/Model/Onboarding/LogoutModel.swift @@ -0,0 +1,16 @@ +// +// LogoutModel.swift +// Spon-us +// +// Created by 박현수 on 2/15/24. +// + +import Foundation + +struct LogoutModel200: Codable { + let statusCode, message, content: String +} + +struct LogoutModel400: Codable { + let statusCode, message: String +} diff --git a/Spon-us/Model/Onboarding/LogoutViewModel.swift b/Spon-us/Model/Onboarding/LogoutViewModel.swift new file mode 100644 index 0000000..e5008f8 --- /dev/null +++ b/Spon-us/Model/Onboarding/LogoutViewModel.swift @@ -0,0 +1,47 @@ +// +// LogoutViewModel.swift +// Spon-us +// +// Created by 박현수 on 2/15/24. +// + +import Foundation +import Moya + +class LogoutViewModel: ObservableObject { + @Published var logoutModel200: LogoutModel200? + @Published var logoutModel400: LogoutModel400? + let provider = MoyaProvider(plugins: [NetworkLoggerPlugin()]) + + func getLogout(completion: @escaping (Bool) -> Void) { + provider.request(.getLogout) { result in + switch result { + case let .success(response): + switch response.statusCode { + case 200: + do { + let logoutResponse = try response.map(LogoutModel200.self) + self.logoutModel200 = logoutResponse + completion(true) + } + catch { + print("200Error") + } + case 400: + do { + let logoutResponse = try response.map(LogoutModel400.self) + self.logoutModel400 = logoutResponse + completion(false) + } + catch { + print("400Error") + } + default: + print("Unexpected StatusCode") + } + case let .failure(response): + print("response error") + } + } + } +} diff --git a/Spon-us/SponusAPI.swift b/Spon-us/SponusAPI.swift index c16ab1f..b7e0025 100644 --- a/Spon-us/SponusAPI.swift +++ b/Spon-us/SponusAPI.swift @@ -18,6 +18,7 @@ enum SponusAPI { case getAnnouncement(announcementId: Int) case propose(title: String, content: String, announcementId: Int, attachments: [URL]) case postLogin(email: String, password: String, fcmToken: String) + case getLogout case getMe case getSent case getProposalDetail(proposeId: Int) @@ -47,6 +48,8 @@ extension SponusAPI: TargetType { return "/api/v1/proposes" case .postLogin: return "/api/v1/organizations/login" + case .getLogout: + return "/api/v1/organizations/logout" case .getMe: return "/api/v1/organizations/me" case .getSent: @@ -59,6 +62,7 @@ extension SponusAPI: TargetType { return "/api/v1/proposes/received" case .getMyAnnouncements: return "/api/v1/announcements/me/opened" + } } @@ -78,6 +82,8 @@ extension SponusAPI: TargetType { return .post case .postLogin: return .post + case .getLogout: + return .get case .getMe: return .get case .getSent: @@ -140,6 +146,8 @@ extension SponusAPI: TargetType { ] ] return try! JSONSerialization.data(withJSONObject: response, options: .prettyPrinted) + case .getLogout: + return Data() case .getMe: return Data() case .getSent: @@ -230,6 +238,8 @@ extension SponusAPI: TargetType { case .postLogin(let email, let password, let fcmToken): let requestBody = LoginRequestBody(email: email, password: password, fcmToken: fcmToken) return .requestJSONEncodable(requestBody) + case .getLogout: + return .requestPlain case .getMe: return .requestPlain case .getSent: @@ -254,6 +264,8 @@ extension SponusAPI: TargetType { return nil case .postLogin: return nil + case .getLogout: + return ["Authorization": "Bearer \(loadAccessToken(userID: UserDefaults.standard.string(forKey: "loginAccount") ?? "loadAccessToken Error"))"] case .getMe: return ["Authorization": "Bearer \(loadAccessToken(userID: UserDefaults.standard.string(forKey: "loginAccount") ?? "loadAccessToken Error"))"] case .getSent: diff --git a/Spon-us/View/Category/CategoryView.swift b/Spon-us/View/Category/CategoryView.swift index 66e3ae8..880afce 100644 --- a/Spon-us/View/Category/CategoryView.swift +++ b/Spon-us/View/Category/CategoryView.swift @@ -203,7 +203,8 @@ struct CategoryCell: View { Spacer() } }.frame(width: 160, height: 95).padding(.trailing, 36) - Button(action: {toggleBookmark()}){ + Button(action: {toggleBookmark() + print(categoryContent.id)}){ Image(isBookmarked ? "ic_saved_check" : "ic_saved") .frame(width: 28, height: 28) } diff --git a/Spon-us/View/Onboarding/RegisterPWView.swift b/Spon-us/View/Onboarding/RegisterPWView.swift index bd6b62c..000d608 100644 --- a/Spon-us/View/Onboarding/RegisterPWView.swift +++ b/Spon-us/View/Onboarding/RegisterPWView.swift @@ -18,7 +18,7 @@ struct RegisterPWView: View { @FocusState var PWConfirmSecureFieldFocused: Bool @FocusState var PWConfirmTextFieldFocused: Bool - let PWRegex = /^(?=.*[a-z])(?=.*\d).{8,20}$/ + let PWRegex = /^(?=.*[a-z])(?=.*\d).{10,20}$/ var body: some View { @State var isValidPW = (userPW == userPWConfirm) && (userPW.wholeMatch(of: PWRegex)?.output != nil) @@ -73,7 +73,7 @@ struct RegisterPWView: View { }.padding(.trailing, 16) }.border((PWTextFieldFocused || PWSecureFieldFocused) ? .sponusPrimary : .sponusGrey100).padding(.top, 16).padding(.top, 32) HStack(spacing: 0) { - Text("*영문, 숫자 포함 8-20자 이내").font(.system(size: 12)).foregroundStyle(.sponusGrey900) + Text("*영문, 숫자 포함 10-20자 이내").font(.system(size: 12)).foregroundStyle(.sponusGrey900) Spacer() }.padding(.top, 12) HStack(spacing: 0) { diff --git a/Spon-us/View/Portfolio/Portfolio.swift b/Spon-us/View/Portfolio/Portfolio.swift index 3338214..cffd360 100644 --- a/Spon-us/View/Portfolio/Portfolio.swift +++ b/Spon-us/View/Portfolio/Portfolio.swift @@ -413,127 +413,129 @@ struct Portfolio: View { ScrollView { VStack(alignment: .leading, spacing: 0) { ForEach(myAnnouncementsViewModel.myAnnouncementsContents, id: \.id) { cell in - - NavigationLink( - destination: MyNoticeDetailView(rootIsActive: $rootIsActive), - // destination: DetailView(post: dummy), - label: { - VStack(spacing: 0) { - HStack(spacing: 0) { - AsyncImage(url: URL(string: cell.mainImage.url)) - .frame(width: 158, height: 158) - .border(.sponusGrey100) - - VStack(alignment: .leading, spacing: 5) { + if cell.status == "OPENED" { + NavigationLink( + destination: MyNoticeDetailView(rootIsActive: $rootIsActive), + // destination: DetailView(post: dummy), + label: { + VStack(spacing: 0) { + HStack(spacing: 0) { + AsyncImage(url: URL(string: cell.mainImage.url)) + .frame(width: 158, height: 158) + .border(.sponusGrey100) - HStack(spacing: 2) { + VStack(alignment: .leading, spacing: 5) { + + HStack(spacing: 2) { + Spacer() + Image(.icSaved).resizable().frame(width: 20, height: 20) + Text(String(10)) + .font(.English12).foregroundStyle(.sponusGrey700) + } + switch cell.type { + case "SPONSORSHIP": + Text("협찬").font(.Caption02).foregroundStyle(.sponusGrey700) + case "PARTERSHIP": + Text("제휴").font(.Caption02).foregroundStyle(.sponusGrey700) + case "COLLABORATION": + Text("연계프로젝트").font(.Caption02).foregroundStyle(.sponusGrey700) + default: + Text("nil").font(.Caption02).foregroundStyle(.sponusGrey700) + } + Text(cell.title ).font(.Body07).foregroundStyle(.sponusBlack).multilineTextAlignment(.leading) Spacer() - Image(.icSaved).resizable().frame(width: 20, height: 20) - Text(String(10)) - .font(.English12).foregroundStyle(.sponusGrey700) - } - switch cell.type { - case "SPONSORSHIP": - Text("협찬").font(.Caption02).foregroundStyle(.sponusGrey700) - case "PARTERSHIP": - Text("제휴").font(.Caption02).foregroundStyle(.sponusGrey700) - case "COLLABORATION": - Text("연계프로젝트").font(.Caption02).foregroundStyle(.sponusGrey700) - default: - Text("nil").font(.Caption02).foregroundStyle(.sponusGrey700) - } - Text(cell.title ).font(.Body07).foregroundStyle(.sponusBlack).multilineTextAlignment(.leading) - Spacer() - - HStack(spacing: 4) { - withAnimation { - Button() { -// showingPublishingToTopAlert = true -// currentToTopID = dummy.id - } label: { - Text("끌어올리기").font(.Caption01).foregroundStyle(.sponusBlack) - .frame(height: 40).frame(maxWidth: .infinity).border(.sponusGrey100) - }.alert(isPresented: $showingPublishingToTopAlert) { - if let index = dummyData.firstIndex(where: { $0.id == currentToTopID }) { - return Alert( - title: Text("끌어올리시겠습니까?"), - message: Text("공고가 상단으로 끌어올려집니다."), - primaryButton: .destructive( - Text("아니오").foregroundStyle(Color.red) - ), - secondaryButton: .default( - Text("끌어올리기"), - action: withAnimation{{ movePostToTop(index: index) }} + + HStack(spacing: 4) { + withAnimation { + Button() { + // showingPublishingToTopAlert = true + // currentToTopID = dummy.id + } label: { + Text("끌어올리기").font(.Caption01).foregroundStyle(.sponusBlack) + .frame(height: 40).frame(maxWidth: .infinity).border(.sponusGrey100) + }.alert(isPresented: $showingPublishingToTopAlert) { + if let index = dummyData.firstIndex(where: { $0.id == currentToTopID }) { + return Alert( + title: Text("끌어올리시겠습니까?"), + message: Text("공고가 상단으로 끌어올려집니다."), + primaryButton: .destructive( + Text("아니오").foregroundStyle(Color.red) + ), + secondaryButton: .default( + Text("끌어올리기"), + action: withAnimation{{ movePostToTop(index: index) }} + ) ) - ) + } + return Alert(title: Text("Default Title"), message: Text("Default Message")) } - return Alert(title: Text("Default Title"), message: Text("Default Message")) - } - } - - Button() { - showingPublishingConfirmationDialog = true -// currentConfirmationDialogID = dummy.id - } label: { - Image(.icMore).resizable().frame(width: 40, height: 40).border(.sponusGrey100) - } - .confirmationDialog("ic_more", isPresented: $showingPublishingConfirmationDialog, titleVisibility: .hidden, actions: { - Button("수정하기") { - activeNavLinkToEdit = true - showingPublishingConfirmationDialog = false - - } - Button("제안 그만 받기") { - alertcase = .hide - showingPublishingAlert = true - showingPublishingConfirmationDialog = false } - Button("삭제", role: .destructive) { - alertcase = .remove - showingPublishingAlert = true - showingPublishingConfirmationDialog = false + + Button() { + showingPublishingConfirmationDialog = true + // currentConfirmationDialogID = dummy.id + } label: { + Image(.icMore).resizable().frame(width: 40, height: 40).border(.sponusGrey100) } - Button("닫기", role: .cancel) {} - }) - .alert(isPresented: $showingPublishingAlert) { - switch alertcase { - case .hide: - return Alert( - title: Text("해당 공고를 내립니다"), - message: Text("내린 공고는 되돌리기 어렵습니다."), - primaryButton: .destructive( - Text("내리기"), - action: {hidePublishingPost()} - ), - secondaryButton: .cancel( - Text("취소") - ) - ) - case .remove: - if let index = dummyData.firstIndex(where: { $0.id == currentConfirmationDialogID }) { + .confirmationDialog("ic_more", isPresented: $showingPublishingConfirmationDialog, titleVisibility: .hidden, actions: { + Button("수정하기") { + activeNavLinkToEdit = true + showingPublishingConfirmationDialog = false + + } + Button("제안 그만 받기") { + alertcase = .hide + showingPublishingAlert = true + showingPublishingConfirmationDialog = false + } + Button("삭제", role: .destructive) { + alertcase = .remove + showingPublishingAlert = true + showingPublishingConfirmationDialog = false + } + Button("닫기", role: .cancel) {} + }) + .alert(isPresented: $showingPublishingAlert) { + switch alertcase { + case .hide: return Alert( - title: Text("삭제하시겠습니까?"), - message: Text("\(dummyData[index].postTitle ?? "nil")\n공고가 삭제됩니다."), + title: Text("해당 공고를 내립니다"), + message: Text("내린 공고는 되돌리기 어렵습니다."), primaryButton: .destructive( - Text("삭제"), - action: {removePublishingPost()} + Text("내리기"), + action: {hidePublishingPost()} ), secondaryButton: .cancel( - Text("아니오") + Text("취소") ) ) + case .remove: + if let index = dummyData.firstIndex(where: { $0.id == currentConfirmationDialogID }) { + return Alert( + title: Text("삭제하시겠습니까?"), + message: Text("\(dummyData[index].postTitle ?? "nil")\n공고가 삭제됩니다."), + primaryButton: .destructive( + Text("삭제"), + action: {removePublishingPost()} + ), + secondaryButton: .cancel( + Text("아니오") + ) + ) + } + return Alert(title: Text("nil")) } - return Alert(title: Text("nil")) } } - } - - }.padding(.leading, 20) - }.padding(.top, 32) - Divider().backgroundStyle(.sponusGrey200).padding(.top, 16) - }.frame(maxWidth: .infinity, maxHeight: .infinity) - } - ) + + }.padding(.leading, 20) + }.padding(.top, 32) + Divider().backgroundStyle(.sponusGrey200).padding(.top, 16) + }.frame(maxWidth: .infinity, maxHeight: .infinity) + } + ) + } + } @@ -662,88 +664,181 @@ struct Portfolio: View { // 완료 if ($progressStatus.isCompleted.wrappedValue == true) { - ScrollView { + if (myAnnouncementsViewModel.isLoading == true) { VStack { - ForEach(dummyData) { dummy in - if (dummy.postProgressStatus == .completed) { - NavigationLink( - destination: MyNoticeDetailView(rootIsActive: $rootIsActive), - // destination: DetailView(post: dummy), - label: { - VStack(alignment:.leading, spacing: 0) { - HStack(spacing: 0) { - (dummy.thumbNail ?? Image(.icCancel)) - .resizable().frame(width: 158, height: 158) - .border(.sponusGrey100) - - VStack(alignment: .leading, spacing: 5) { - switch dummy.postCategory { - case .sponsorship: - Text("협찬").font(.Caption02).foregroundStyle(.sponusGrey700) - case .linkedproject: - Text("연계프로젝트").font(.Caption02).foregroundStyle(.sponusGrey700) - case nil: - Text("nil").font(.Caption02).foregroundStyle(.sponusGrey700) - } - Text(dummy.postTitle ?? "nil").font(.Body07).foregroundStyle(.sponusBlack).multilineTextAlignment(.leading).padding(.bottom, 16) - - HStack(spacing: 6) { - (dummy.companyImage ?? Image(.icCancel)).resizable().aspectRatio(contentMode: .fill).frame(width:24, height:24).clipShape(Circle()) - Text("with \(dummy.companyName ?? "nil")").font(.English16).foregroundStyle(.sponusGrey700) - }.padding(.bottom) + Spacer() + ProgressView() + Spacer() + } + } + else { + ScrollView { + VStack { + ForEach(dummyData) { dummy in + if (dummy.postProgressStatus == .completed) { + NavigationLink( + destination: MyNoticeDetailView(rootIsActive: $rootIsActive), + // destination: DetailView(post: dummy), + label: { + VStack(alignment:.leading, spacing: 0) { + HStack(spacing: 0) { + (dummy.thumbNail ?? Image(.icCancel)) + .resizable().frame(width: 158, height: 158) + .border(.sponusGrey100) - }.padding(.leading, 20) - }.padding(.top, 32).padding(.bottom, 24) - VStack(spacing: 0) { - switch dummy.completedReportStatus { - case .reportNotSubmitted: - Button { - currentMakeReportID = dummy.id - activeNavLinkToMakeReport = true - } label: { - Text("보고서 작성하기") + VStack(alignment: .leading, spacing: 5) { + switch dummy.postCategory { + case .sponsorship: + Text("협찬").font(.Caption02).foregroundStyle(.sponusGrey700) + case .linkedproject: + Text("연계프로젝트").font(.Caption02).foregroundStyle(.sponusGrey700) + case nil: + Text("nil").font(.Caption02).foregroundStyle(.sponusGrey700) + } + Text(dummy.postTitle ?? "nil").font(.Body07).foregroundStyle(.sponusBlack).multilineTextAlignment(.leading).padding(.bottom, 16) + + HStack(spacing: 6) { + (dummy.companyImage ?? Image(.icCancel)).resizable().aspectRatio(contentMode: .fill).frame(width:24, height:24).clipShape(Circle()) + Text("with \(dummy.companyName ?? "nil")").font(.English16).foregroundStyle(.sponusGrey700) + }.padding(.bottom) + + }.padding(.leading, 20) + }.padding(.top, 32).padding(.bottom, 24) + VStack(spacing: 0) { + switch dummy.completedReportStatus { + case .reportNotSubmitted: + Button { + currentMakeReportID = dummy.id + activeNavLinkToMakeReport = true + } label: { + Text("보고서 작성하기") + .font(.Caption01) + .frame(height: 40) + .frame(maxWidth: .infinity) + .foregroundStyle(.sponusRed) + .border(.sponusRed) + } + case .unsuccessfulTermination: + Text("협업이 중단된 공고입니다") .font(.Caption01) .frame(height: 40) .frame(maxWidth: .infinity) - .foregroundStyle(.sponusRed) - .border(.sponusRed) - } - case .unsuccessfulTermination: - Text("협업이 중단된 공고입니다") - .font(.Caption01) - .frame(height: 40) - .frame(maxWidth: .infinity) - .foregroundStyle(.sponusGrey700) - .border(.sponusGrey100) - case .reportSubmitted: - Button { - currentReportID = dummy.id - activeNavLinkToReport = true - } label: { - Text("보고서 보러가기") + .foregroundStyle(.sponusGrey700) + .border(.sponusGrey100) + case .reportSubmitted: + Button { + currentReportID = dummy.id + activeNavLinkToReport = true + } label: { + Text("보고서 보러가기") + .font(.Caption01) + .frame(height: 40) + .frame(maxWidth: .infinity) + .foregroundStyle(.sponusPrimary) + .border(.sponusPrimary) + } + case nil: + Text("nil") .font(.Caption01) .frame(height: 40) - .frame(maxWidth: .infinity) - .foregroundStyle(.sponusPrimary) - .border(.sponusPrimary) + .foregroundStyle(.sponusRed) + .border(.sponusRed) } - case nil: - Text("nil") - .font(.Caption01) - .frame(height: 40) - .foregroundStyle(.sponusRed) - .border(.sponusRed) } - } - Divider().backgroundStyle(.sponusGrey200).padding(.top, 16) - }.frame(maxWidth: .infinity, maxHeight: .infinity) - } - ) + Divider().backgroundStyle(.sponusGrey200).padding(.top, 16) + }.frame(maxWidth: .infinity, maxHeight: .infinity) + } + ) + } } } - } - }.scrollIndicators(.hidden) + }.scrollIndicators(.hidden) + } + } + // if ($progressStatus.isCompleted.wrappedValue == true) { + // ScrollView { + // VStack { + // ForEach(dummyData) { dummy in + // if (dummy.postProgressStatus == .completed) { + // NavigationLink( + // destination: MyNoticeDetailView(rootIsActive: $rootIsActive), + // // destination: DetailView(post: dummy), + // label: { + // VStack(alignment:.leading, spacing: 0) { + // HStack(spacing: 0) { + // (dummy.thumbNail ?? Image(.icCancel)) + // .resizable().frame(width: 158, height: 158) + // .border(.sponusGrey100) + // + // VStack(alignment: .leading, spacing: 5) { + // switch dummy.postCategory { + // case .sponsorship: + // Text("협찬").font(.Caption02).foregroundStyle(.sponusGrey700) + // case .linkedproject: + // Text("연계프로젝트").font(.Caption02).foregroundStyle(.sponusGrey700) + // case nil: + // Text("nil").font(.Caption02).foregroundStyle(.sponusGrey700) + // } + // Text(dummy.postTitle ?? "nil").font(.Body07).foregroundStyle(.sponusBlack).multilineTextAlignment(.leading).padding(.bottom, 16) + // + // HStack(spacing: 6) { + // (dummy.companyImage ?? Image(.icCancel)).resizable().aspectRatio(contentMode: .fill).frame(width:24, height:24).clipShape(Circle()) + // Text("with \(dummy.companyName ?? "nil")").font(.English16).foregroundStyle(.sponusGrey700) + // }.padding(.bottom) + // + // }.padding(.leading, 20) + // }.padding(.top, 32).padding(.bottom, 24) + // VStack(spacing: 0) { + // switch dummy.completedReportStatus { + // case .reportNotSubmitted: + // Button { + // currentMakeReportID = dummy.id + // activeNavLinkToMakeReport = true + // } label: { + // Text("보고서 작성하기") + // .font(.Caption01) + // .frame(height: 40) + // .frame(maxWidth: .infinity) + // .foregroundStyle(.sponusRed) + // .border(.sponusRed) + // } + // case .unsuccessfulTermination: + // Text("협업이 중단된 공고입니다") + // .font(.Caption01) + // .frame(height: 40) + // .frame(maxWidth: .infinity) + // .foregroundStyle(.sponusGrey700) + // .border(.sponusGrey100) + // case .reportSubmitted: + // Button { + // currentReportID = dummy.id + // activeNavLinkToReport = true + // } label: { + // Text("보고서 보러가기") + // .font(.Caption01) + // .frame(height: 40) + // .frame(maxWidth: .infinity) + // .foregroundStyle(.sponusPrimary) + // .border(.sponusPrimary) + // } + // case nil: + // Text("nil") + // .font(.Caption01) + // .frame(height: 40) + // .foregroundStyle(.sponusRed) + // .border(.sponusRed) + // } + // } + // Divider().backgroundStyle(.sponusGrey200).padding(.top, 16) + // }.frame(maxWidth: .infinity, maxHeight: .infinity) + // } + // ) + // } + // } + // } + // }.scrollIndicators(.hidden) + // } }.padding() .navigationTitle("포트폴리오").font(.Body01) .navigationBarTitleDisplayMode(.inline)