Connect to several servers, one coloured window each

This commit is contained in:
Ian Gulliver
2026-10-18 20:58:56 -07:00
parent c0b2f38584
commit 4347d4e9e4
15 changed files with 456 additions and 209 deletions
+30
View File
@@ -22,6 +22,11 @@ struct SettingsView: View {
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
heading("Window colour")
Text("Windows for this server have a border in this colour, on every Mac you use.")
.foregroundStyle(Palette.muted)
.fixedSize(horizontal: false, vertical: true)
ServerColorPicker()
heading("Notifications")
DeviceNotifications()
PrefsBox()
@@ -53,6 +58,31 @@ struct SettingsView: View {
}
}
private struct ServerColorPicker: View {
@Environment(Store.self) private var store
var body: some View {
let origin = store.api.origin.absoluteString
let current = Servers.shared.record(origin)?.color
HStack(spacing: 4) {
ForEach(taskPalette.indices, id: \.self) { i in
Button {
Servers.shared.setColor(origin, i)
} label: {
Circle()
.fill(taskPalette[i])
.frame(width: 18, height: 18)
.padding(3)
.overlay(Circle().stroke(i == current ? Palette.text : .clear, lineWidth: 1.5))
.contentShape(Circle())
}
.buttonStyle(.plain)
}
}
.padding(.top, 8)
}
}
private struct DeviceNotifications: View {
@ViewState private var status: UNAuthorizationStatus?
@ViewState private var asking = false