krz/hutch

an ios client for sourcehut

clone: git clone https://gitbay.org/krz/hutch.git

v3.1.3: Hutch/Views/More/ManPageBrowserView.swift · raw

 1import SwiftUI
 2
 3/// Entry point for the man.sr.ht browser in the More tab.
 4/// Shows a pre-populated list of official sr.ht man pages.
 5struct ManPageBrowserView: View {
 6    private let officialDocs: [(title: String, url: URL)] = [
 7        ("sr.ht", URL(string: "https://man.sr.ht/sr.ht/")!),
 8        ("hub.sr.ht", URL(string: "https://man.sr.ht/hub.sr.ht/")!),
 9        ("git.sr.ht", URL(string: "https://man.sr.ht/git.sr.ht/")!),
10        ("hg.sr.ht", URL(string: "https://man.sr.ht/hg.sr.ht/")!),
11        ("lists.sr.ht", URL(string: "https://man.sr.ht/lists.sr.ht/")!),
12        ("todo.sr.ht", URL(string: "https://man.sr.ht/todo.sr.ht/")!),
13        ("builds.sr.ht", URL(string: "https://man.sr.ht/builds.sr.ht/")!),
14        ("paste.sr.ht", URL(string: "https://man.sr.ht/paste.sr.ht/")!),
15        ("man.sr.ht", URL(string: "https://man.sr.ht/man.sr.ht/")!),
16        ("meta.sr.ht", URL(string: "https://man.sr.ht/meta.sr.ht/")!),
17        ("srht.site", URL(string: "https://srht.site/")!)
18    ]
19
20    var body: some View {
21        List {
22            Section("Official Man Pages") {
23                ForEach(officialDocs, id: \.title) { doc in
24                    NavigationLink(value: MoreRoute.manPage(doc.url)) {
25                        Text(doc.title)
26                    }
27                }
28                .themedRow()
29            }
30        }
31        .themedList()
32        .navigationTitle("Man Pages")
33        .navigationBarTitleDisplayMode(.inline)
34    }
35}