From 23725f1cb8e768d624739c737c99388a356d52b2 Mon Sep 17 00:00:00 2001 From: Jisu Kim Date: Sun, 24 Nov 2024 19:05:05 +0900 Subject: [PATCH] =?UTF-8?q?[WEAV-140]=20=ED=94=84=EB=A1=9C=ED=95=84=20?= =?UTF-8?q?=ED=83=AD=20=EB=B7=B0=20=EA=B0=B1=EC=8B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Sources/Profile/ProfileIntent.swift | 4 ++- .../ProfilePannel/ProfilePannelIntent.swift | 16 ++++++++++++ .../ProfilePannel/ProfilePannelView.swift | 26 +++++++++++++++---- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Projects/Features/Home/Sources/Profile/ProfileIntent.swift b/Projects/Features/Home/Sources/Profile/ProfileIntent.swift index dc36f1a..f722ff2 100644 --- a/Projects/Features/Home/Sources/Profile/ProfileIntent.swift +++ b/Projects/Features/Home/Sources/Profile/ProfileIntent.swift @@ -89,7 +89,9 @@ extension ProfileIntent: ProfileIntent.Intentable { } func onAppear() { - fetchUserInfo(input.userInfo) + Task { + await refreshUserInfo() + } } func refreshUserInfo() async { diff --git a/Projects/Features/Home/Sources/ProfilePannel/ProfilePannelIntent.swift b/Projects/Features/Home/Sources/ProfilePannel/ProfilePannelIntent.swift index 2515e00..9c79188 100644 --- a/Projects/Features/Home/Sources/ProfilePannel/ProfilePannelIntent.swift +++ b/Projects/Features/Home/Sources/ProfilePannel/ProfilePannelIntent.swift @@ -30,6 +30,7 @@ class ProfilePannelIntent { extension ProfilePannelIntent { protocol Intentable { // content + func onTapEditJobOccupationIcon() func onTapNextButton() // default @@ -54,5 +55,20 @@ extension ProfilePannelIntent: ProfilePannelIntent.Intentable { func task() async {} // content + func onTapEditJobOccupationIcon() { + Task { + await MainActor.run { + if let userInfo = AppCoordinator.shared.userInfo { + AppCoordinator.shared.push( + .editProfile( + .jobOccupation( + userInfo + ) + ) + ) + } + } + } + } func onTapNextButton() {} } diff --git a/Projects/Features/Home/Sources/ProfilePannel/ProfilePannelView.swift b/Projects/Features/Home/Sources/ProfilePannel/ProfilePannelView.swift index 0280d3a..8015043 100644 --- a/Projects/Features/Home/Sources/ProfilePannel/ProfilePannelView.swift +++ b/Projects/Features/Home/Sources/ProfilePannel/ProfilePannelView.swift @@ -81,8 +81,11 @@ public struct ProfilePannelView: View { icon: DesignCore.Images.businessFill.image, key: "직군", value: state.profile?.jobOccupation ?? "-", - textColor: Color(hex: 0x5B6654) - ) + textColor: Color(hex: 0x5B6654), + showEditIcon: true + ) { + intent.onTapEditJobOccupationIcon() + } } innerRoundBoxView( @@ -93,7 +96,8 @@ public struct ProfilePannelView: View { icon: DesignCore.Images.buildingFill.image, key: "직장", value: state.profile?.companyName ?? "", - textColor: Color(hex: 0x846470) + textColor: Color(hex: 0x846470), + showEditIcon: true ) } @@ -107,7 +111,8 @@ public struct ProfilePannelView: View { icon: DesignCore.Images.locationFill.image, key: "활동 지역", value: nil, - textColor: Color(hex: 0x606D8F) + textColor: Color(hex: 0x606D8F), + showEditIcon: true ) let tagModels: [TagModel] = profile.locations .map { @@ -176,7 +181,9 @@ public struct ProfilePannelView: View { icon: Image, key: String, value: String?, - textColor: Color + textColor: Color, + showEditIcon: Bool, + editHandler: (() -> Void)? = nil ) -> some View { HStack(spacing: 6) { icon @@ -191,6 +198,15 @@ public struct ProfilePannelView: View { .typography(.medium_16) .multilineTextAlignment(.trailing) } + if showEditIcon { + DesignCore.Images.pencil1.image + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 18, height: 18) + .onTapGesture { + editHandler?() + } + } } .foregroundStyle(textColor) }