From 1f88bcbddc6e754b4056cf8775823cde4c9f2a74 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Fri, 14 Nov 2025 00:47:20 +0900 Subject: [PATCH] =?UTF-8?q?feat(chat-character):=20=EC=BA=90=EB=A6=AD?= =?UTF-8?q?=ED=84=B0=20=EC=8B=A0=EA=B7=9C=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20UI=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Chat/Character/Character.swift | 1 + .../Chat/Character/CharacterItemView.swift | 35 ++++++++++++++----- .../Chat/Character/CharacterSectionView.swift | 4 +-- .../Detail/CharacterDetailView.swift | 3 +- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/SodaLive/Sources/Chat/Character/Character.swift b/SodaLive/Sources/Chat/Character/Character.swift index 6443673..aaf8df3 100644 --- a/SodaLive/Sources/Chat/Character/Character.swift +++ b/SodaLive/Sources/Chat/Character/Character.swift @@ -10,4 +10,5 @@ struct Character: Decodable { let name: String let description: String? let imageUrl: String + let isNew: Bool } diff --git a/SodaLive/Sources/Chat/Character/CharacterItemView.swift b/SodaLive/Sources/Chat/Character/CharacterItemView.swift index 0d192b2..06712ff 100644 --- a/SodaLive/Sources/Chat/Character/CharacterItemView.swift +++ b/SodaLive/Sources/Chat/Character/CharacterItemView.swift @@ -21,19 +21,38 @@ struct CharacterItemView: View { var body: some View { VStack(alignment: .leading, spacing: 4) { - ZStack(alignment: .bottomLeading) { + ZStack(alignment: .leading) { DownsampledKFImage( url: URL(string: character.imageUrl), size: CGSize(width: size, height: size) ) .cornerRadius(12) - if isShowRank { - Text("\(rank)") - .font(.custom(Font.preBold.rawValue, size: 72)) - .foregroundColor(.white) - .lineLimit(1) - .frame(height: capHeight) + VStack { + if character.isNew { + HStack { + Spacer() + + Text("N") + .font(.custom(Font.preRegular.rawValue, size: 18)) + .foregroundColor(.white) + .frame(width: 30, height: 30) + .background(Color.button) + .clipShape(Circle()) + } + .padding(.top, 8) + .padding(.trailing, 8) + } + + Spacer() + + if isShowRank { + Text("\(rank)") + .font(.custom(Font.preBold.rawValue, size: 72)) + .foregroundColor(.white) + .lineLimit(1) + .frame(height: capHeight) + } } } @@ -56,7 +75,7 @@ struct CharacterItemView: View { #Preview { CharacterItemView( - character: Character(characterId: 1, name: "찰리", description: "새로운 친구", imageUrl: "https://picsum.photos/300"), + character: Character(characterId: 1, name: "찰리", description: "새로운 친구", imageUrl: "https://picsum.photos/300", isNew: true), size: 168, rank: 20, isShowRank: true diff --git a/SodaLive/Sources/Chat/Character/CharacterSectionView.swift b/SodaLive/Sources/Chat/Character/CharacterSectionView.swift index d758ee6..d3a1132 100644 --- a/SodaLive/Sources/Chat/Character/CharacterSectionView.swift +++ b/SodaLive/Sources/Chat/Character/CharacterSectionView.swift @@ -54,8 +54,8 @@ struct CharacterSectionView: View { CharacterSectionView( title: "신규 캐릭터", items: [ - Character(characterId: 1, name: "찰리", description: "새로운 친구", imageUrl: "https://picsum.photos/300"), - Character(characterId: 2, name: "데이지", description: "", imageUrl: "https://picsum.photos/300") + Character(characterId: 1, name: "찰리", description: "새로운 친구", imageUrl: "https://picsum.photos/300", isNew: true), + Character(characterId: 2, name: "데이지", description: "", imageUrl: "https://picsum.photos/300", isNew: false) ], isShowRank: true ) diff --git a/SodaLive/Sources/Chat/Character/Detail/CharacterDetailView.swift b/SodaLive/Sources/Chat/Character/Detail/CharacterDetailView.swift index 648aedf..39ec547 100644 --- a/SodaLive/Sources/Chat/Character/Detail/CharacterDetailView.swift +++ b/SodaLive/Sources/Chat/Character/Detail/CharacterDetailView.swift @@ -93,7 +93,8 @@ struct CharacterDetailView: View { characterId: otherCharacter.characterId, name: otherCharacter.name, description: otherCharacter.tags, - imageUrl: otherCharacter.imageUrl + imageUrl: otherCharacter.imageUrl, + isNew: false ), size: screenSize().width * 0.42, rank: 0,