diff options
| author | Dustin Mierau <dustin@mierau.me> | 2025-10-28 10:12:49 -0700 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2025-10-28 10:12:49 -0700 |
| commit | 8fdad8745921ea0bc43a9efd2beafc1a1ce3142b (patch) | |
| tree | a5d03d185578774835da5b4e4264647206c0ad4e /Hotline/State | |
| parent | c5165d348c1efbcc553b3c31dbeaa23353914fb6 (diff) | |
Pop ServerState out into its own file.
Diffstat (limited to 'Hotline/State')
| -rw-r--r-- | Hotline/State/ServerState.swift | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Hotline/State/ServerState.swift b/Hotline/State/ServerState.swift new file mode 100644 index 0000000..e2fa40f --- /dev/null +++ b/Hotline/State/ServerState.swift @@ -0,0 +1,44 @@ +import SwiftUI + +@Observable +class ServerState: Equatable { + var id: UUID = UUID() + var selection: ServerNavigationType + var serverName: String? = nil + var serverBanner: NSImage? = nil + var bannerColors: ColorArt? = nil + + init(selection: ServerNavigationType) { + self.selection = selection + } + + static func == (lhs: ServerState, rhs: ServerState) -> Bool { + return lhs.id == rhs.id + } +} + +enum ServerNavigationType: Identifiable, Hashable, Equatable { + var id: String { + switch self { + case .chat: + return "Chat" + case .news: + return "News" + case .board: + return "Board" + case .files: + return "Files" + case .accounts: + return "Accounts" + case .user(let userID): + return String(userID) + } + } + + case chat + case news + case board + case files + case accounts + case user(userID: UInt16) +} |