feat(chat-character): 추천 캐릭터 섹션 추가 및 새로고침 API 반영

This commit is contained in:
Yu Sung
2025-11-14 01:46:07 +09:00
parent 2c74bb743b
commit 74212405a4
5 changed files with 96 additions and 1 deletions

View File

@@ -63,6 +63,51 @@ struct CharacterView: View {
}
)
}
if !viewModel.recommendCharacters.isEmpty {
VStack(alignment: .leading, spacing: 16) {
HStack {
Text("추천 캐릭터")
.font(.custom(Font.preBold.rawValue, size: 24))
.foregroundColor(.white)
Spacer()
Image("ic_refresh")
.onTapGesture {
viewModel.refreshRecommendCharacters()
}
}
.padding(.horizontal, 24)
let horizontalPadding: CGFloat = 24
let gridSpacing: CGFloat = 16
let width = (screenSize().width - (horizontalPadding * 2) - gridSpacing) / 2
LazyVGrid(
columns: Array(
repeating: GridItem(
.flexible(),
spacing: gridSpacing,
alignment: .topLeading
),
count: 2
),
alignment: .leading,
spacing: gridSpacing
) {
ForEach(viewModel.recommendCharacters.indices, id: \.self) { idx in
CharacterItemView(
character: viewModel.recommendCharacters[idx],
size: width,
rank: idx + 1,
isShowRank: false
)
}
}
.padding(.horizontal, horizontalPadding)
}
}
}
.padding(.bottom, 24)
}