feat: 메인 홈 - 인기 크리에이터, 최신 콘텐츠
- 터치시 로그인이 되어 있지 않으면 로그인 페이지로 이동
This commit is contained in:
@@ -10,6 +10,8 @@ import Kingfisher
|
|||||||
|
|
||||||
struct ContentItemView: View {
|
struct ContentItemView: View {
|
||||||
|
|
||||||
|
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
|
||||||
|
|
||||||
let item: AudioContentMainItem
|
let item: AudioContentMainItem
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -51,7 +53,14 @@ struct ContentItemView: View {
|
|||||||
.padding(.top, 4)
|
.padding(.top, 4)
|
||||||
}
|
}
|
||||||
.frame(width: 168)
|
.frame(width: 168)
|
||||||
.onTapGesture { AppState.shared.setAppStep(step: .contentDetail(contentId: item.contentId)) }
|
.onTapGesture {
|
||||||
|
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
|
AppState.shared.setAppStep(step: .contentDetail(contentId: item.contentId))
|
||||||
|
} else {
|
||||||
|
AppState.shared
|
||||||
|
.setAppStep(step: .login)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,9 +68,6 @@ struct HomeCreatorRankingItemView: View {
|
|||||||
.padding(.leading, 10)
|
.padding(.leading, 10)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onTapGesture {
|
|
||||||
AppState.shared.setAppStep(step: .creatorDetail(userId: item.id))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,17 @@ struct HomeTabView: View {
|
|||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
HStack(spacing: 16) {
|
HStack(spacing: 16) {
|
||||||
ForEach(0..<viewModel.creatorRanking.count, id: \.self) {
|
ForEach(0..<viewModel.creatorRanking.count, id: \.self) {
|
||||||
HomeCreatorRankingItemView(rank: $0 + 1, item: viewModel.creatorRanking[$0])
|
let item = viewModel.creatorRanking[$0]
|
||||||
|
HomeCreatorRankingItemView(rank: $0 + 1, item: item)
|
||||||
|
.onTapGesture {
|
||||||
|
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
|
AppState.shared
|
||||||
|
.setAppStep(step: .creatorDetail(userId: item.id))
|
||||||
|
} else {
|
||||||
|
AppState.shared
|
||||||
|
.setAppStep(step: .login)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 24)
|
.padding(.horizontal, 24)
|
||||||
@@ -105,8 +115,13 @@ struct HomeTabView: View {
|
|||||||
VStack(alignment: .leading, spacing: 16) {
|
VStack(alignment: .leading, spacing: 16) {
|
||||||
HomeLatestContentView(
|
HomeLatestContentView(
|
||||||
onClickMore: {
|
onClickMore: {
|
||||||
|
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||||
AppState.shared
|
AppState.shared
|
||||||
.setAppStep(step: .newContentAll(isFree: false))
|
.setAppStep(step: .newContentAll(isFree: false))
|
||||||
|
} else {
|
||||||
|
AppState.shared
|
||||||
|
.setAppStep(step: .login)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
themeList: viewModel.latestContentThemeList,
|
themeList: viewModel.latestContentThemeList,
|
||||||
contentList: viewModel.latestContentList
|
contentList: viewModel.latestContentList
|
||||||
|
|||||||
Reference in New Issue
Block a user