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 { if viewModel.followedChannelItems.count > 0 {
SectionRecommendChannelView( SectionRecommendChannelView(items: viewModel.followedChannelItems)
items: viewModel.isFollowingList ?
viewModel.followedChannelItems :
viewModel.recommendChannelItems,
isFollowingList: $viewModel.isFollowingList
)
} }
if viewModel.communityPostItems.count > 0 { 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 liveNowItems = [GetRoomListResponse]()
@Published private(set) var liveReservationItems = [GetRoomListResponse]() @Published private(set) var liveReservationItems = [GetRoomListResponse]()
@Published private(set) var recommendLiveItems: [GetRecommendLiveResponse] = [] @Published private(set) var recommendLiveItems: [GetRecommendLiveResponse] = []
@Published private(set) var recommendChannelItems: [GetRecommendChannelResponse] = []
@Published private(set) var followedChannelItems: [GetRecommendChannelResponse] = [] @Published private(set) var followedChannelItems: [GetRecommendChannelResponse] = []
@Published private(set) var communityPostItems: [GetCommunityPostListResponse] = [] @Published private(set) var communityPostItems: [GetCommunityPostListResponse] = []
@Published private(set) var replayLiveItems: [AudioContentMainItem] = [] @Published private(set) var replayLiveItems: [AudioContentMainItem] = []

View File

@@ -12,46 +12,26 @@ struct SectionRecommendChannelView: View {
let items: [GetRecommendChannelResponse] let items: [GetRecommendChannelResponse]
@Binding var isFollowingList: Bool
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token) @AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
var body: some View { var body: some View {
VStack(spacing: 21.3) { VStack(spacing: 16) {
HStack(spacing: 0) { HStack(spacing: 0) {
if isFollowingList { Text("팔로잉 ")
Text("팔로잉 ") .font(.custom(Font.preBold.rawValue, size: 24))
.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))
.foregroundColor(.button) .foregroundColor(.button)
Spacer() Text("채널")
.font(.custom(Font.preBold.rawValue, size: 24))
.foregroundColor(.white)
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { Spacer()
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) { ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 21.3) { HStack(spacing: 16) {
ForEach(0..<items.count, id: \.self) { index in ForEach(0..<items.count, id: \.self) { index in
let item = items[index] let item = items[index]
@@ -90,7 +70,7 @@ struct SectionRecommendChannelView: View {
} }
Text(item.nickname) Text(item.nickname)
.font(.custom(Font.medium.rawValue, size: 11.3)) .font(.custom(Font.medium.rawValue, size: 14))
.foregroundColor(Color.graybb) .foregroundColor(Color.graybb)
.frame(width: screenSize().width * 0.18) .frame(width: screenSize().width * 0.18)
.lineLimit(1) .lineLimit(1)
@@ -106,28 +86,26 @@ struct SectionRecommendChannelView: View {
} }
} }
if isFollowingList { VStack(spacing: 10.7) {
VStack(spacing: 10.7) { Image("btn_item_more")
Image("btn_item_more") .resizable()
.resizable() .frame(width: screenSize().width * 0.18, height: screenSize().width * 0.18, alignment: .center)
.frame(width: screenSize().width * 0.18, height: screenSize().width * 0.18, alignment: .center)
Text("더보기")
Text("더보기") .font(.custom(Font.preRegular.rawValue, size: 14))
.font(.custom(Font.medium.rawValue, size: 11.3)) .foregroundColor(.white)
.foregroundColor(Color(hex: "bbbbbb")) .frame(width: screenSize().width * 0.18)
.frame(width: screenSize().width * 0.18) .lineLimit(1)
.lineLimit(1) }
} .onTapGesture {
.onTapGesture { if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { AppState.shared.setAppStep(step: .followingList)
AppState.shared.setAppStep(step: .followingList) } else {
} else { AppState.shared.setAppStep(step: .login)
AppState.shared.setAppStep(step: .login)
}
} }
} }
} }
.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: 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: 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) GetRecommendChannelResponse(creatorId: 3, nickname: "크리에이터3", profileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", isOnAir: false)
], ]
isFollowingList: .constant(true)
) )
} }
} }