feat(chat-character): 캐릭터 신규 이미지 표시 UI 추가

This commit is contained in:
Yu Sung
2025-11-14 00:47:20 +09:00
parent 7de2b1c4dd
commit 1f88bcbddc
4 changed files with 32 additions and 11 deletions

View File

@@ -10,4 +10,5 @@ struct Character: Decodable {
let name: String let name: String
let description: String? let description: String?
let imageUrl: String let imageUrl: String
let isNew: Bool
} }

View File

@@ -21,19 +21,38 @@ struct CharacterItemView: View {
var body: some View { var body: some View {
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
ZStack(alignment: .bottomLeading) { ZStack(alignment: .leading) {
DownsampledKFImage( DownsampledKFImage(
url: URL(string: character.imageUrl), url: URL(string: character.imageUrl),
size: CGSize(width: size, height: size) size: CGSize(width: size, height: size)
) )
.cornerRadius(12) .cornerRadius(12)
if isShowRank { VStack {
Text("\(rank)") if character.isNew {
.font(.custom(Font.preBold.rawValue, size: 72)) HStack {
.foregroundColor(.white) Spacer()
.lineLimit(1)
.frame(height: capHeight) 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 { #Preview {
CharacterItemView( 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, size: 168,
rank: 20, rank: 20,
isShowRank: true isShowRank: true

View File

@@ -54,8 +54,8 @@ struct CharacterSectionView: View {
CharacterSectionView( CharacterSectionView(
title: "신규 캐릭터", title: "신규 캐릭터",
items: [ items: [
Character(characterId: 1, 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") Character(characterId: 2, name: "데이지", description: "", imageUrl: "https://picsum.photos/300", isNew: false)
], ],
isShowRank: true isShowRank: true
) )

View File

@@ -93,7 +93,8 @@ struct CharacterDetailView: View {
characterId: otherCharacter.characterId, characterId: otherCharacter.characterId,
name: otherCharacter.name, name: otherCharacter.name,
description: otherCharacter.tags, description: otherCharacter.tags,
imageUrl: otherCharacter.imageUrl imageUrl: otherCharacter.imageUrl,
isNew: false
), ),
size: screenSize().width * 0.42, size: screenSize().width * 0.42,
rank: 0, rank: 0,