╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │18 pub const Page = union(enum) { │ │19 home: Home, │ │20 }; │ │21 + │ │22 +// a top-level "page" the user can navigate to │ │23 +pub const RoutablePage = enum { │ │24 + home_users, │ │25 + home_repos, │ │26 + home_auth, │ │27 │ │28 + pub fn url(self: RoutablePage) []const u8 { │ │29 + return switch (self) { │ │30 + .home_users => "/users", │ │31 + .home_repos => "/repos", │ │32 + .home_auth => "/auth", │ │33 + }; │ │34 + } │ │35 + │ │36 + pub fn fromUrl(path: []const u8) ?RoutablePage { │ │37 + if (std.mem.eql(u8, path, "/") or std.mem.eql(u8, path, "/users")) return .home_users;│ │38 + if (std.mem.eql(u8, path, "/repos")) return .home_repos; │ │39 + if (std.mem.eql(u8, path, "/auth")) return .home_auth; │ │40 + return null; │ │41 + } │ │42 +}; │ │43 + │ │44 // per-connection mutable state. each SSH session / web session / local TUI │ │45 // run gets its own. `data` is the subset that round-trips between server │ │46 // and wasm; the other fields are runtime context only and stay local. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │55 user_id: ?[]const u8 = null, │ │56 // a transient outcome to surface from the last /login POST attempt │ │57 login_failure: ?Home.Auth.Login.Failure = null, │ │58 + current_page: RoutablePage = .home_users, │ │59 }; │ │60 │ │61 // what the server hands to the client (and what main_wasm parses on _start).│ ╰─────────────────────────────────────────────────────────────────────────────────╯