summaryrefslogtreecommitdiff
path: root/Sora/Views/ContentView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Sora/Views/ContentView.swift')
-rw-r--r--Sora/Views/ContentView.swift78
1 files changed, 39 insertions, 39 deletions
diff --git a/Sora/Views/ContentView.swift b/Sora/Views/ContentView.swift
index d6473ab..fab1e14 100644
--- a/Sora/Views/ContentView.swift
+++ b/Sora/Views/ContentView.swift
@@ -1,48 +1,48 @@
import SwiftUI
struct ContentView: View {
- @EnvironmentObject var manager: BooruManager
- @State private var selectedTabIndex: Int = 1
- @State private var tabs = [
- "Posts",
- "Bookmarks",
- ]
+ @EnvironmentObject var manager: BooruManager
+ @State private var selectedTabIndex: Int = 1
+ @State private var tabs = [
+ "Posts",
+ "Bookmarks",
+ ]
- var body: some View {
- #if os(macOS)
- NavigationSplitView {
- List(selection: $selectedTabIndex) {
- ForEach(Array(tabs.enumerated()), id: \.offset) { index, element in
- NavigationLink(value: index) {
- Text(element)
- }
- }
- }
- } content: {
- if selectedTabIndex == 1 {
- BookmarksView(selectedTab: $selectedTabIndex)
- } else {
- PostGridView(
- manager: manager
- )
- }
- } detail: {
- if let post = manager.selectedPost {
- PostDetailsView(post: post)
- } else {
- Text("Select a Post")
- .foregroundColor(.secondary)
- }
+ var body: some View {
+ #if os(macOS)
+ NavigationSplitView {
+ List(selection: $selectedTabIndex) {
+ ForEach(Array(tabs.enumerated()), id: \.offset) { index, element in
+ NavigationLink(value: index) {
+ Text(element)
}
- #else
- NavigationStack {
- PostGridView(manager: manager)
- }
- #endif
- }
+ }
+ }
+ } content: {
+ if selectedTabIndex == 1 {
+ BookmarksView(selectedTab: $selectedTabIndex)
+ } else {
+ PostGridView(
+ manager: manager
+ )
+ }
+ } detail: {
+ if let post = manager.selectedPost {
+ PostDetailsView(post: post)
+ } else {
+ Text("Select a Post")
+ .foregroundColor(.secondary)
+ }
+ }
+ #else
+ NavigationStack {
+ PostGridView(manager: manager)
+ }
+ #endif
+ }
}
#Preview {
- ContentView()
- .environmentObject(Settings())
+ ContentView()
+ .environmentObject(Settings())
}