mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Fix navigation tabs
This commit is contained in:
parent
417ed0a8ee
commit
4af395d788
@ -8,11 +8,6 @@ struct ChannelView: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VideosView(state: state, tabSelection: $tabSelection, videos: videos)
|
VideosView(state: state, tabSelection: $tabSelection, videos: videos)
|
||||||
.task {
|
|
||||||
async {
|
|
||||||
provider.load()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var listRowInsets: EdgeInsets {
|
var listRowInsets: EdgeInsets {
|
||||||
|
@ -13,7 +13,7 @@ struct VideosView: View {
|
|||||||
ForEach(videos) { video in
|
ForEach(videos) { video in
|
||||||
VideoThumbnailView(video: video)
|
VideoThumbnailView(video: video)
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
if state.showingChannel {
|
if tabSelection == .channel {
|
||||||
closeChannelButton(name: video.author)
|
closeChannelButton(name: video.author)
|
||||||
} else {
|
} else {
|
||||||
openChannelButton(from: video)
|
openChannelButton(from: video)
|
||||||
@ -26,13 +26,6 @@ struct VideosView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func closeChannelButton(name: String) -> some View {
|
|
||||||
Button("Close \(name) Channel", action: {
|
|
||||||
state.closeChannel()
|
|
||||||
tabSelection = .popular
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func openChannelButton(from video: Video) -> some View {
|
func openChannelButton(from video: Video) -> some View {
|
||||||
Button("\(video.author) Channel", action: {
|
Button("\(video.author) Channel", action: {
|
||||||
state.openChannel(from: video)
|
state.openChannel(from: video)
|
||||||
@ -40,6 +33,13 @@ struct VideosView: View {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func closeChannelButton(name: String) -> some View {
|
||||||
|
Button("Close \(name) Channel", action: {
|
||||||
|
tabSelection = .popular
|
||||||
|
state.closeChannel()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var listRowInsets: EdgeInsets {
|
var listRowInsets: EdgeInsets {
|
||||||
EdgeInsets(top: .zero, leading: .zero, bottom: .zero, trailing: 30)
|
EdgeInsets(top: .zero, leading: .zero, bottom: .zero, trailing: 30)
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,16 @@ final class Video: Identifiable, ObservableObject {
|
|||||||
@Published var url: URL?
|
@Published var url: URL?
|
||||||
@Published var error: Bool = false
|
@Published var error: Bool = false
|
||||||
|
|
||||||
init(id: String, title: String, thumbnailURL: URL?, author: String, length: TimeInterval, published: String, channelID: String, views: Int = 0) {
|
init(
|
||||||
|
id: String,
|
||||||
|
title: String,
|
||||||
|
thumbnailURL: URL?,
|
||||||
|
author: String,
|
||||||
|
length: TimeInterval,
|
||||||
|
published: String,
|
||||||
|
channelID: String,
|
||||||
|
views: Int = 0
|
||||||
|
) {
|
||||||
self.id = id
|
self.id = id
|
||||||
self.title = title
|
self.title = title
|
||||||
self.thumbnailURL = thumbnailURL
|
self.thumbnailURL = thumbnailURL
|
||||||
|
@ -243,10 +243,10 @@
|
|||||||
37AAF28F26740715007FC770 /* AppState.swift */,
|
37AAF28F26740715007FC770 /* AppState.swift */,
|
||||||
37D4B19626717E1500C925CA /* Video.swift */,
|
37D4B19626717E1500C925CA /* Video.swift */,
|
||||||
37D4B19226717CE100C925CA /* PopularVideosProvider.swift */,
|
37D4B19226717CE100C925CA /* PopularVideosProvider.swift */,
|
||||||
|
37AAF28B2673ABD3007FC770 /* ChannelVideosProvider.swift */,
|
||||||
|
37AAF2812673791F007FC770 /* SearchedVideosProvider.swift */,
|
||||||
37D4B1B32672A30700C925CA /* VideoDetailsProvider.swift */,
|
37D4B1B32672A30700C925CA /* VideoDetailsProvider.swift */,
|
||||||
37D4B1AF2672A01000C925CA /* DataProvider.swift */,
|
37D4B1AF2672A01000C925CA /* DataProvider.swift */,
|
||||||
37AAF2812673791F007FC770 /* SearchedVideosProvider.swift */,
|
|
||||||
37AAF28B2673ABD3007FC770 /* ChannelVideosProvider.swift */,
|
|
||||||
);
|
);
|
||||||
path = Model;
|
path = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
Loading…
Reference in New Issue
Block a user