feat(creator): 채널 헤더를 연결한다
This commit is contained in:
@@ -6,14 +6,23 @@ struct CreatorChannelView: View {
|
||||
@StateObject private var viewModel = CreatorChannelViewModel()
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
init(creatorId: Int, viewModel: CreatorChannelViewModel = CreatorChannelViewModel()) {
|
||||
self.creatorId = creatorId
|
||||
_viewModel = StateObject(wrappedValue: viewModel)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
Color.black.ignoresSafeArea()
|
||||
|
||||
VStack(spacing: 0) {
|
||||
ZStack(alignment: .top) {
|
||||
VStack(spacing: 0) {
|
||||
headerSection
|
||||
tabBar
|
||||
selectedTabContent
|
||||
}
|
||||
|
||||
titleBar
|
||||
tabBar
|
||||
selectedTabContent
|
||||
}
|
||||
|
||||
if viewModel.isLoading {
|
||||
@@ -33,7 +42,7 @@ struct CreatorChannelView: View {
|
||||
CreatorChannelTitleBar(
|
||||
isFollow: viewModel.response?.creator.isFollow ?? false,
|
||||
isNotify: viewModel.response?.creator.isNotify ?? false,
|
||||
backgroundProgress: 1,
|
||||
backgroundProgress: 0,
|
||||
onTapBack: {
|
||||
dismiss()
|
||||
},
|
||||
@@ -53,6 +62,13 @@ struct CreatorChannelView: View {
|
||||
)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var headerSection: some View {
|
||||
if let creator = viewModel.response?.creator {
|
||||
CreatorChannelHeaderSection(creator: creator)
|
||||
}
|
||||
}
|
||||
|
||||
private var tabBar: some View {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 20) {
|
||||
@@ -91,3 +107,49 @@ struct CreatorChannelView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
let viewModel = CreatorChannelViewModel()
|
||||
viewModel.response = CreatorChannelHomeResponse(
|
||||
creator: CreatorChannelCreatorResponse(
|
||||
creatorId: 1,
|
||||
characterId: 10,
|
||||
nickname: "Soda Creator",
|
||||
profileImageUrl: "https://picsum.photos/600",
|
||||
followerCount: 12345,
|
||||
isAiChatAvailable: true,
|
||||
isDmAvailable: false,
|
||||
isFollow: true,
|
||||
isNotify: true
|
||||
),
|
||||
currentLive: nil,
|
||||
latestAudioContent: nil,
|
||||
channelDonations: [],
|
||||
notices: [],
|
||||
schedules: [],
|
||||
audioContents: [],
|
||||
series: [],
|
||||
communities: [],
|
||||
fanTalk: CreatorChannelFanTalkSummaryResponse(totalCount: 0, latestFanTalk: nil),
|
||||
introduce: "",
|
||||
activity: CreatorChannelActivityResponse(
|
||||
debutDateUtc: nil,
|
||||
dday: "D+1",
|
||||
liveCount: 0,
|
||||
liveDurationHours: 0,
|
||||
liveContributorCount: 0,
|
||||
audioContentCount: 0,
|
||||
seriesCount: 0
|
||||
),
|
||||
sns: CreatorChannelSnsResponse(
|
||||
instagramUrl: "",
|
||||
fancimmUrl: "",
|
||||
xurl: "",
|
||||
youtubeUrl: "",
|
||||
kakaoOpenChatUrl: ""
|
||||
)
|
||||
)
|
||||
viewModel.hasLoaded = true
|
||||
|
||||
return CreatorChannelView(creatorId: 1, viewModel: viewModel)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user