fix(chat): 채팅 왕관 오버레이 정렬

This commit is contained in:
Yu Sung
2026-03-18 14:06:43 +09:00
parent b51d643db8
commit 84d8e2f2e3
2 changed files with 85 additions and 62 deletions

View File

@@ -12,40 +12,48 @@ struct LiveRoomChatItemView: View {
let chatMessage: LiveRoomNormalChat
let onClickProfile: () -> Void
private var rankValue: Int {
chatMessage.rank + 1
}
private var isTopRank: Bool {
(1...3).contains(rankValue)
}
private var topRankCrownImageName: String? {
switch rankValue {
case 1:
return "img_rank_1"
case 2:
return "img_rank_2"
case 3:
return "img_rank_3"
default:
return nil
}
}
var body: some View {
HStack(alignment: .top, spacing: 13.3) {
ZStack {
switch chatMessage.rank + 1 {
case -2:
Color(hex: "4999e3")
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
case -1:
Color.button
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
case 1:
Color(hex: "fdca2f")
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
case 2:
Color(hex: "dcdcdc")
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
case 3:
Color(hex: "c67e4a")
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
default:
Color(hex: "bbbbbb")
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
if !isTopRank {
switch rankValue {
case -2:
Color(hex: "4999e3")
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
case -1:
Color.button
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
default:
Color(hex: "bbbbbb")
.frame(width: 33.3, height: 33.3, alignment: .top)
.clipShape(Circle())
}
}
KFImage(URL(string: chatMessage.profileUrl))
@@ -60,42 +68,36 @@ struct LiveRoomChatItemView: View {
.scaledToFill()
.frame(width: 30, height: 30, alignment: .top)
.clipShape(Circle())
VStack(alignment: .trailing, spacing: 0) {
Spacer()
switch chatMessage.rank + 1 {
case -2:
Image("ic_badge_manager")
if isTopRank {
if let topRankCrownImageName {
Image(topRankCrownImageName)
.resizable()
.frame(width: 16.7, height: 16.7)
case -1:
Image("ic_crown")
.resizable()
.frame(width: 16.7, height: 16.7)
case 1:
Image("ic_crown_1")
.resizable()
.frame(width: 16.7, height: 16.7)
case 2:
Image("ic_crown_2")
.resizable()
.frame(width: 16.7, height: 16.7)
case 3:
Image("ic_crown_3")
.resizable()
.frame(width: 16.7, height: 16.7)
default:
EmptyView()
.frame(width: 39, height: 38)
}
} else {
VStack(alignment: .trailing, spacing: 0) {
Spacer()
switch rankValue {
case -2:
Image("ic_badge_manager")
.resizable()
.frame(width: 16.7, height: 16.7)
case -1:
Image("ic_crown")
.resizable()
.frame(width: 16.7, height: 16.7)
default:
EmptyView()
}
}
.frame(width: 33.3, height: 33.3, alignment: .trailing)
}
.frame(width: 33.3, height: 33.3, alignment: .trailing)
}
.frame(width: isTopRank ? 39 : 33.3, height: isTopRank ? 38 : 33.3)
.onTapGesture { onClickProfile() }
VStack(alignment: .leading, spacing: 6.7) {