feat: 메인 라이브

- 팔로잉 채널 신규 UI 사이즈 적용
This commit is contained in:
Yu Sung
2025-07-22 03:19:01 +09:00
parent 33195e5c8e
commit a4663d0853
3 changed files with 31 additions and 60 deletions

View File

@@ -73,13 +73,8 @@ struct LiveView: View {
}
)
if viewModel.recommendChannelItems.count > 0 {
SectionRecommendChannelView(
items: viewModel.isFollowingList ?
viewModel.followedChannelItems :
viewModel.recommendChannelItems,
isFollowingList: $viewModel.isFollowingList
)
if viewModel.followedChannelItems.count > 0 {
SectionRecommendChannelView(items: viewModel.followedChannelItems)
}
if viewModel.communityPostItems.count > 0 {

View File

@@ -18,7 +18,6 @@ final class LiveViewModel: ObservableObject {
@Published private(set) var liveNowItems = [GetRoomListResponse]()
@Published private(set) var liveReservationItems = [GetRoomListResponse]()
@Published private(set) var recommendLiveItems: [GetRecommendLiveResponse] = []
@Published private(set) var recommendChannelItems: [GetRecommendChannelResponse] = []
@Published private(set) var followedChannelItems: [GetRecommendChannelResponse] = []
@Published private(set) var communityPostItems: [GetCommunityPostListResponse] = []
@Published private(set) var replayLiveItems: [AudioContentMainItem] = []

View File

@@ -12,46 +12,26 @@ struct SectionRecommendChannelView: View {
let items: [GetRecommendChannelResponse]
@Binding var isFollowingList: Bool
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
var body: some View {
VStack(spacing: 21.3) {
VStack(spacing: 16) {
HStack(spacing: 0) {
if isFollowingList {
Text("팔로잉 ")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(.grayee)
} else {
Text("추천 ")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(.grayee)
}
Text("채널")
.font(.custom(Font.bold.rawValue, size: 18.3))
.font(.custom(Font.preBold.rawValue, size: 24))
.foregroundColor(.button)
Text("채널")
.font(.custom(Font.preBold.rawValue, size: 24))
.foregroundColor(.white)
Spacer()
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
Text("팔로잉 채널")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(.gray77)
Image(isFollowingList ? "btn_toggle_on_big" : "btn_toggle_off_big")
.resizable()
.frame(width: 33.3, height: 20)
.padding(.leading, 6.7)
.onTapGesture {
isFollowingList.toggle()
}
}
}
.frame(width: screenSize().width - 26.7, alignment: .leading)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 21.3) {
HStack(spacing: 16) {
ForEach(0..<items.count, id: \.self) { index in
let item = items[index]
@@ -90,7 +70,7 @@ struct SectionRecommendChannelView: View {
}
Text(item.nickname)
.font(.custom(Font.medium.rawValue, size: 11.3))
.font(.custom(Font.medium.rawValue, size: 14))
.foregroundColor(Color.graybb)
.frame(width: screenSize().width * 0.18)
.lineLimit(1)
@@ -106,15 +86,14 @@ struct SectionRecommendChannelView: View {
}
}
if isFollowingList {
VStack(spacing: 10.7) {
Image("btn_item_more")
.resizable()
.frame(width: screenSize().width * 0.18, height: screenSize().width * 0.18, alignment: .center)
Text("더보기")
.font(.custom(Font.medium.rawValue, size: 11.3))
.foregroundColor(Color(hex: "bbbbbb"))
.font(.custom(Font.preRegular.rawValue, size: 14))
.foregroundColor(.white)
.frame(width: screenSize().width * 0.18)
.lineLimit(1)
}
@@ -126,8 +105,7 @@ struct SectionRecommendChannelView: View {
}
}
}
}
.padding(.horizontal, 13.3)
.padding(.horizontal, 24)
}
}
}
@@ -140,8 +118,7 @@ struct SectionRecommendChannelView_Previews: PreviewProvider {
GetRecommendChannelResponse(creatorId: 1, nickname: "크리에이터1", profileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", isOnAir: true),
GetRecommendChannelResponse(creatorId: 2, nickname: "크리에이터2", profileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", isOnAir: false),
GetRecommendChannelResponse(creatorId: 3, nickname: "크리에이터3", profileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", isOnAir: false)
],
isFollowingList: .constant(true)
]
)
}
}