mirror of
https://github.com/yattee/yattee.git
synced 2025-12-01 13:48:14 +00:00
Change trending category button behavior
This commit is contained in:
@@ -15,7 +15,7 @@ struct PlayerView: View {
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
}
|
||||
.task {
|
||||
Task.init {
|
||||
Task {
|
||||
provider.load()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ struct PopularVideosView: View {
|
||||
var body: some View {
|
||||
VideosView(tabSelection: $tabSelection, videos: videos)
|
||||
.task {
|
||||
Task.init {
|
||||
Task {
|
||||
provider.load()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ struct SubscriptionsView: View {
|
||||
var body: some View {
|
||||
VideosView(tabSelection: $tabSelection, videos: videos)
|
||||
.task {
|
||||
Task.init {
|
||||
Task {
|
||||
provider.load()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,22 +17,9 @@ struct TrendingView: View {
|
||||
HStack(alignment: .top) {
|
||||
Spacer()
|
||||
|
||||
Button(trendingState.category.name) {
|
||||
selectingCategory.toggle()
|
||||
}
|
||||
.fullScreenCover(isPresented: $selectingCategory) {
|
||||
TrendingCategorySelectionView(selectedCategory: $trendingState.category)
|
||||
}
|
||||
|
||||
Text(trendingState.country.flag)
|
||||
.font(.system(size: 60))
|
||||
|
||||
Button(trendingState.country.rawValue) {
|
||||
selectingCountry.toggle()
|
||||
}
|
||||
.fullScreenCover(isPresented: $selectingCountry) {
|
||||
TrendingCountrySelectionView(selectedCountry: $trendingState.country)
|
||||
}
|
||||
categoryButton
|
||||
countryFlag
|
||||
countryButton
|
||||
|
||||
Spacer()
|
||||
}
|
||||
@@ -48,4 +35,31 @@ struct TrendingView: View {
|
||||
|
||||
return videosProvider.videos
|
||||
}
|
||||
|
||||
var categoryButton: some View {
|
||||
Button(trendingState.category.name) {
|
||||
trendingState.category = trendingState.category.next()
|
||||
}
|
||||
.contextMenu {
|
||||
ForEach(TrendingCategory.allCases) { category in
|
||||
Button(category.name) {
|
||||
trendingState.category = category
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var countryFlag: some View {
|
||||
Text(trendingState.country.flag)
|
||||
.font(.system(size: 60))
|
||||
}
|
||||
|
||||
var countryButton: some View {
|
||||
Button(trendingState.country.rawValue) {
|
||||
selectingCountry.toggle()
|
||||
}
|
||||
.fullScreenCover(isPresented: $selectingCountry) {
|
||||
TrendingCountrySelectionView(selectedCountry: $trendingState.country)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user