gemenon

[ACTIVE] The Safari of the Gemini ecosystem
git clone git://git.figbert.com/gemenon.git
Log | Files | Refs

commit abf6031196d61268bb218bbdd0c2794d5060c2f5
parent 832b401c9eb9911069d501cc61c2f75aed4137e5
Author: FIGBERT <figbert@figbert.com>
Date:   Thu,  8 Sep 2022 21:28:45 -0700

Merge StartPage and CapsuleView

Diffstat:
MShared/BrowserFunctions.swift | 5++---
MShared/CapsuleView.swift | 14++++++++------
MShared/ContentView.swift | 12+++++-------
3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/Shared/BrowserFunctions.swift b/Shared/BrowserFunctions.swift @@ -17,15 +17,14 @@ class BrowserData: ObservableObject { @Published var tabs: [UUID: SwiftGemini.GeminiResponse] = [:] @Published var currentTab: UUID? = nil - @Published var currentView: GemenonView = .StartPage - @Published var views: [GemenonView] = [.StartPage, .Capsule, .History] + @Published var currentView: GemenonView = .Capsule + @Published var views: [GemenonView] = [.Capsule, .History] @Published var parser = SwiftGemtext.Gemtext() @Published var engine = SwiftGemini.GeminiRequestor() } enum GemenonView { - case StartPage case Capsule case History } diff --git a/Shared/CapsuleView.swift b/Shared/CapsuleView.swift @@ -11,19 +11,21 @@ struct CapsuleView: View { @EnvironmentObject var data: BrowserData var body: some View { - ScrollView { - HStack { - Spacer() - if data.currentTab != nil { + if data.tabs.isEmpty { + StartPage() + } else { + ScrollView { + HStack { + Spacer() if data.tabs[data.currentTab!]?.body?.gemtext != nil { VStack(alignment: .leading, spacing: 10) { renderGemtext((data.tabs[data.currentTab!]?.body?.gemtext)!, url: (data.tabs[data.currentTab!]?.url)!) } } + Spacer() } - Spacer() + .padding(.vertical) } - .padding(.vertical) } } diff --git a/Shared/ContentView.swift b/Shared/ContentView.swift @@ -21,24 +21,22 @@ struct ContentView: View { CapsuleView() case .History: HistoryView() - case .StartPage: - StartPage() } } label: { switch s { case .Capsule: - Label("\(data.tabs.count) Tab\(data.tabs.count > 1 || data.tabs.isEmpty ? "s" : "")", systemImage: "laptopcomputer") + if data.tabs.isEmpty { + Label("Start Page", systemImage: "house") + } else { + Label("\(data.tabs.count) Tab\(data.tabs.count > 1 ? "s" : "")", systemImage: "laptopcomputer") + } case .History: Label("History", systemImage: "clock") - case .StartPage: - Label("Start Page", systemImage: "house") } } } } detail: { switch data.currentView { - case .StartPage: - StartPage() case .Capsule: CapsuleView() case .History: