krz/hutch
an ios client for sourcehut
clone: git clone https://gitbay.org/krz/hutch.git
v2.7.1: Hutch/Views/More/MoreView.swift · raw
1import SwiftUI
2
3struct MoreView: View {
4 @Environment(AppState.self) private var appState
5
6 private let unsupportedLinks: [(title: String, url: URL)] = [
7 ("chat.sr.ht", URL(string: "https://chat.sr.ht")!),
8 ("man.sr.ht", URL(string: "https://man.sr.ht")!),
9 ("srht.site", URL(string: "https://srht.site")!)
10 ]
11
12 @State private var showAccountSwitcher = false
13
14 var body: some View {
15 List {
16 Section {
17 NavigationLink(value: MoreRoute.lists) {
18 Label("Mailing Lists", systemImage: "list.bullet.rectangle")
19 }
20
21 NavigationLink(value: MoreRoute.pastes) {
22 Label("Pastes", systemImage: "doc.on.clipboard")
23 }
24
25 NavigationLink(value: MoreRoute.settings) {
26 Label("Settings", systemImage: "gear")
27 }
28 }
29
30 Section {
31 ForEach(unsupportedLinks, id: \.title) { item in
32 Link(destination: item.url) {
33 Label(item.title, systemImage: "safari")
34 }
35 }
36 } header: {
37 Text("External Links")
38 } footer: {
39 Text("These SourceHut services are not supported in-app, as the SourceHut API does not support them, and will open in your browser.")
40 }
41 }
42 .navigationTitle("More")
43 .toolbar {
44 ToolbarItem(placement: .topBarTrailing) {
45 Button {
46 showAccountSwitcher = true
47 } label: {
48 Image(systemName: "person.crop.circle")
49 }
50 }
51 }
52 .sheet(isPresented: $showAccountSwitcher) {
53 AccountSwitcherView()
54 }
55 }
56}