summaryrefslogtreecommitdiff
path: root/Hutch/Views/More/MoreView.swift
blob: 9c5cf9278d9080ffca3fa42e08c561ce8d7725c3 (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
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")!),
        ("man.sr.ht", URL(string: "https://man.sr.ht")!),
        ("srht.site", URL(string: "https://srht.site")!)
    ]

    @State private var showAccountSwitcher = false

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

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

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

                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()
        }
    }
}