feat: 팔로워 리스트

- 프로필 이미지를 터치하면 프로필 다이얼로그 표시
This commit is contained in:
Yu Sung
2025-06-13 19:56:44 +09:00
parent 24c97dbe51
commit a815bcfbf4
4 changed files with 30 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ struct MemberProfileDialog: View {
@Binding var isShowing: Bool @Binding var isShowing: Bool
let memberId: Int let memberId: Int
var onBlockComplete: () -> Void = {}
var body: some View { var body: some View {
ZStack { ZStack {
@@ -147,6 +148,7 @@ struct MemberProfileDialog: View {
nickname: viewModel.nickname, nickname: viewModel.nickname,
confirmAction: { confirmAction: {
viewModel.memberBlock() viewModel.memberBlock()
onBlockComplete()
} }
) )
} }

View File

@@ -11,6 +11,7 @@ import Kingfisher
struct FollowerListItemView: View { struct FollowerListItemView: View {
let item: GetFollowerListResponseItem let item: GetFollowerListResponseItem
let clickProfile: (Int) -> Void
let creatorFollow: (Int) -> Void let creatorFollow: (Int) -> Void
let showCreatorFollowNotifyDialog: (Int) -> Void let showCreatorFollowNotifyDialog: (Int) -> Void
@@ -28,6 +29,9 @@ struct FollowerListItemView: View {
.resizable() .resizable()
.frame(width: 60, height: 60) .frame(width: 60, height: 60)
.clipShape(Circle()) .clipShape(Circle())
.onTapGesture {
clickProfile(item.userId)
}
Text(item.nickname) Text(item.nickname)
.font(.custom(Font.medium.rawValue, size: 16.7)) .font(.custom(Font.medium.rawValue, size: 16.7))
@@ -70,6 +74,7 @@ struct FollowerListItemView_Previews: PreviewProvider {
nickname: "상남자", nickname: "상남자",
isFollow: false isFollow: false
), ),
clickProfile: { _ in },
creatorFollow: { _ in }, creatorFollow: { _ in },
showCreatorFollowNotifyDialog: { _ in } showCreatorFollowNotifyDialog: { _ in }
) )

View File

@@ -16,6 +16,9 @@ struct FollowerListView: View {
@State private var creatorId: Int = 0 @State private var creatorId: Int = 0
@State private var selectedItemIndex: Int = 0 @State private var selectedItemIndex: Int = 0
@State private var selectedMemberId: Int = 0
@State private var isShowMemberProfilePopup: Bool = false
var body: some View { var body: some View {
BaseView(isLoading: $viewModel.isLoading) { BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 0) { VStack(spacing: 0) {
@@ -41,6 +44,10 @@ struct FollowerListView: View {
let item = viewModel.followerListItems[index] let item = viewModel.followerListItems[index]
FollowerListItemView( FollowerListItemView(
item: item, item: item,
clickProfile: {
selectedMemberId = $0
isShowMemberProfilePopup = true
},
creatorFollow: { creatorFollow: {
viewModel.creatorFollow(creatorId: $0, index: index) viewModel.creatorFollow(creatorId: $0, index: index)
}, },
@@ -62,6 +69,17 @@ struct FollowerListView: View {
} }
} }
if isShowMemberProfilePopup {
MemberProfileDialog(
isShowing: $isShowMemberProfilePopup,
memberId: selectedMemberId,
onBlockComplete: {
viewModel.removeMember(memberId: selectedMemberId)
selectedMemberId = 0
}
)
}
if isShowFollowNotifyDialog { if isShowFollowNotifyDialog {
CreatorFollowNotifyDialog( CreatorFollowNotifyDialog(
isShowing: $isShowFollowNotifyDialog, isShowing: $isShowFollowNotifyDialog,

View File

@@ -117,4 +117,9 @@ final class FollowerListViewModel: ObservableObject {
} }
.store(in: &subscription) .store(in: &subscription)
} }
func removeMember(memberId: Int) {
totalCount -= 1
followerListItems.removeAll { $0.userId == memberId }
}
} }