feat(home): 응원 크리에이터 섹션을 연결한다
This commit is contained in:
@@ -230,6 +230,8 @@
|
||||
401A3FD32FEEB00500A5BBA3 /* MainHomeAiCharacterSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401A3FD42FEEB00500A5BBA3 /* MainHomeAiCharacterSection.swift */; };
|
||||
401A3FD72FEEB00600A5BBA3 /* MainHomeGenreCreatorSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401A3FD52FEEB00600A5BBA3 /* MainHomeGenreCreatorSection.swift */; };
|
||||
401A3FD82FEEB00600A5BBA3 /* MainHomeGenreCreatorSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401A3FD52FEEB00600A5BBA3 /* MainHomeGenreCreatorSection.swift */; };
|
||||
401A3FD92FEEB00700A5BBA3 /* MainHomeCheerCreatorSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401A3FDB2FEEB00700A5BBA3 /* MainHomeCheerCreatorSection.swift */; };
|
||||
401A3FDA2FEEB00700A5BBA3 /* MainHomeCheerCreatorSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401A3FDB2FEEB00700A5BBA3 /* MainHomeCheerCreatorSection.swift */; };
|
||||
40235DED2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */; };
|
||||
40235DEE2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */; };
|
||||
40235DF02E37983D00B09A87 /* PersistenceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEF2E37983D00B09A87 /* PersistenceController.swift */; };
|
||||
@@ -1749,6 +1751,7 @@
|
||||
401A3FCD2FEEB00400A5BBA3 /* MainHomeRecentDebutCreatorSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeRecentDebutCreatorSection.swift; sourceTree = "<group>"; };
|
||||
401A3FD42FEEB00500A5BBA3 /* MainHomeAiCharacterSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeAiCharacterSection.swift; sourceTree = "<group>"; };
|
||||
401A3FD52FEEB00600A5BBA3 /* MainHomeGenreCreatorSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeGenreCreatorSection.swift; sourceTree = "<group>"; };
|
||||
401A3FDB2FEEB00700A5BBA3 /* MainHomeCheerCreatorSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeCheerCreatorSection.swift; sourceTree = "<group>"; };
|
||||
40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RecentContent+CoreDataClass.swift"; sourceTree = "<group>"; };
|
||||
40235DEF2E37983D00B09A87 /* PersistenceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistenceController.swift; sourceTree = "<group>"; };
|
||||
40235DF22E37987300B09A87 /* RecentContentService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentContentService.swift; sourceTree = "<group>"; };
|
||||
@@ -2754,6 +2757,7 @@
|
||||
401A3FCD2FEEB00400A5BBA3 /* MainHomeRecentDebutCreatorSection.swift */,
|
||||
401A3FD42FEEB00500A5BBA3 /* MainHomeAiCharacterSection.swift */,
|
||||
401A3FD52FEEB00600A5BBA3 /* MainHomeGenreCreatorSection.swift */,
|
||||
401A3FDB2FEEB00700A5BBA3 /* MainHomeCheerCreatorSection.swift */,
|
||||
);
|
||||
path = Components;
|
||||
sourceTree = "<group>";
|
||||
@@ -6108,6 +6112,7 @@
|
||||
401A3FCF2FEEB00400A5BBA3 /* MainHomeRecentDebutCreatorSection.swift in Sources */,
|
||||
401A3FD22FEEB00500A5BBA3 /* MainHomeAiCharacterSection.swift in Sources */,
|
||||
401A3FD72FEEB00600A5BBA3 /* MainHomeGenreCreatorSection.swift in Sources */,
|
||||
401A3FD92FEEB00700A5BBA3 /* MainHomeCheerCreatorSection.swift in Sources */,
|
||||
401A3FAE2FEEAFA000A5BBA3 /* MainHomeRankingView.swift in Sources */,
|
||||
401A3FAF2FEEAFA000A5BBA3 /* MainHomeFollowingView.swift in Sources */,
|
||||
B3AF650899B8FC84E0C0CDA0 /* MainPlaceholderTabView.swift in Sources */,
|
||||
@@ -6887,6 +6892,7 @@
|
||||
401A3FD02FEEB00400A5BBA3 /* MainHomeRecentDebutCreatorSection.swift in Sources */,
|
||||
401A3FD32FEEB00500A5BBA3 /* MainHomeAiCharacterSection.swift in Sources */,
|
||||
401A3FD82FEEB00600A5BBA3 /* MainHomeGenreCreatorSection.swift in Sources */,
|
||||
401A3FDA2FEEB00700A5BBA3 /* MainHomeCheerCreatorSection.swift in Sources */,
|
||||
401A3FB22FEEAFA000A5BBA3 /* MainHomeRankingView.swift in Sources */,
|
||||
401A3FB32FEEAFA000A5BBA3 /* MainHomeFollowingView.swift in Sources */,
|
||||
ACD71056E97E13E48941ABBB /* MainPlaceholderTabView.swift in Sources */,
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import SwiftUI
|
||||
|
||||
struct MainHomeCheerCreatorSection: View {
|
||||
let items: [HomeCreatorItem]
|
||||
let isFollowAllCompleted: Bool
|
||||
let isFollowAllLoading: Bool
|
||||
let onTapCreator: (Int) -> Void
|
||||
let onTapFollowAll: () -> Void
|
||||
|
||||
init(
|
||||
items: [HomeCreatorItem],
|
||||
isFollowAllCompleted: Bool = false,
|
||||
isFollowAllLoading: Bool = false,
|
||||
onTapCreator: @escaping (Int) -> Void = { _ in },
|
||||
onTapFollowAll: @escaping () -> Void = {}
|
||||
) {
|
||||
self.items = items
|
||||
self.isFollowAllCompleted = isFollowAllCompleted
|
||||
self.isFollowAllLoading = isFollowAllLoading
|
||||
self.onTapCreator = onTapCreator
|
||||
self.onTapFollowAll = onTapFollowAll
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if !items.isEmpty {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s14) {
|
||||
SectionTitle(title: I18n.HomeRecommendation.cheerCreatorSectionTitle)
|
||||
|
||||
MainHomeCreatorGroupSection(
|
||||
title: I18n.HomeRecommendation.cheerCreatorSectionTitle,
|
||||
showTitle: false,
|
||||
creators: items,
|
||||
isFollowAllCompleted: isFollowAllCompleted,
|
||||
isFollowAllLoading: isFollowAllLoading,
|
||||
onTapCreator: onTapCreator,
|
||||
onTapFollowAll: onTapFollowAll
|
||||
)
|
||||
.padding(.horizontal, SodaSpacing.s14)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MainHomeCheerCreatorSection_Previews: PreviewProvider {
|
||||
private static let previewImageUrl = "https://picsum.photos/200/200"
|
||||
|
||||
static var previews: some View {
|
||||
MainHomeCheerCreatorSection(
|
||||
items: (1...8).map {
|
||||
HomeCreatorItem(
|
||||
creatorId: $0,
|
||||
creatorNickname: "크리에이터이름",
|
||||
creatorProfileImage: previewImageUrl
|
||||
)
|
||||
}
|
||||
)
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
.background(Color.black)
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ struct MainHomeGenreCreatorSection: View {
|
||||
|
||||
struct MainHomeCreatorGroupSection: View {
|
||||
let title: String
|
||||
let showTitle: Bool
|
||||
let creators: [HomeCreatorItem]
|
||||
let isFollowAllCompleted: Bool
|
||||
let isFollowAllLoading: Bool
|
||||
@@ -57,6 +58,7 @@ struct MainHomeCreatorGroupSection: View {
|
||||
|
||||
init(
|
||||
title: String,
|
||||
showTitle: Bool = true,
|
||||
creators: [HomeCreatorItem],
|
||||
isFollowAllCompleted: Bool = false,
|
||||
isFollowAllLoading: Bool = false,
|
||||
@@ -64,6 +66,7 @@ struct MainHomeCreatorGroupSection: View {
|
||||
onTapFollowAll: @escaping () -> Void = {}
|
||||
) {
|
||||
self.title = title
|
||||
self.showTitle = showTitle
|
||||
self.creators = creators
|
||||
self.isFollowAllCompleted = isFollowAllCompleted
|
||||
self.isFollowAllLoading = isFollowAllLoading
|
||||
@@ -73,11 +76,13 @@ struct MainHomeCreatorGroupSection: View {
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s14) {
|
||||
Text(title)
|
||||
.appFont(.heading3)
|
||||
.foregroundColor(.white)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
if showTitle {
|
||||
Text(title)
|
||||
.appFont(.heading3)
|
||||
.foregroundColor(.white)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
}
|
||||
|
||||
LazyVGrid(columns: columns, alignment: .center, spacing: SodaSpacing.s14) {
|
||||
ForEach(creators.prefix(8), id: \.self) { creator in
|
||||
|
||||
@@ -60,6 +60,21 @@ struct MainHomeRecommendationView: View {
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
MainHomeCheerCreatorSection(
|
||||
items: viewModel.recommendations?.cheerCreators ?? [],
|
||||
isFollowAllCompleted: viewModel.isFollowAllCompleted("cheer"),
|
||||
isFollowAllLoading: viewModel.isFollowAllLoading("cheer"),
|
||||
onTapCreator: onTapCreator,
|
||||
onTapFollowAll: {
|
||||
onTapFollowAll {
|
||||
viewModel.followAll(
|
||||
creatorIds: viewModel.recommendations?.cheerCreators.map(\.creatorId) ?? [],
|
||||
completionKey: "cheer"
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user