summaryrefslogtreecommitdiff
path: root/Hutch/Views/More/MoreView.swift
blob: 09aa37af193d4e0e3fe3f186cded949adea527fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import SwiftUI

struct MoreView: View {
    @Environment(AppState.self) private var appState

    private let unsupportedLinks: [(title: String, url: URL)] = [
        ("chat.sr.ht", URL(string: "https://chat.sr.ht")!)
    ]

    @State private var showAccountSwitcher = false

    var body: some View {
        List {
            Section("Search") {
                NavigationLink(value: MoreRoute.lookup) {
                    Label("Look Up", systemImage: "magnifyingglass")
                }
            }

            Section("Other Services") {
                NavigationLink(value: MoreRoute.lists) {
                    Label("Mailing Lists", systemImage: "list.bullet.rectangle")
                }

                NavigationLink(value: MoreRoute.manPageBrowser) {
                    Label("Man Pages", systemImage: "book")
                }

                NavigationLink(value: MoreRoute.pastes) {
                    Label("Pastes", systemImage: "doc.on.clipboard")
                }
            }

            Section("Meta") {
                NavigationLink(value: MoreRoute.profile) {
                    Label("Profile", systemImage: "person.text.rectangle")
                }

                NavigationLink(value: MoreRoute.settings) {
                    Label("Settings", systemImage: "gear")
                }
            }

            Section {
                ForEach(unsupportedLinks, id: \.title) { item in
                    Link(destination: item.url) {
                        Label(item.title, systemImage: "safari")
                    }
                }
            } header: {
                Text("External Links")
            } footer: {
                Text("These SourceHut services are not supported in-app, as the SourceHut API does not support them, and will open in your browser.")
            }
        }
        .navigationTitle("More")
        .toolbar {
            ToolbarItem(placement: .topBarTrailing) {
                Button {
                    showAccountSwitcher = true
                } label: {
                    Image(systemName: "person.crop.circle")
                }
            }
        }
        .sheet(isPresented: $showAccountSwitcher) {
            AccountSwitcherView()
        }
    }
}