╭ changed ──────╮ │src/ui/Home.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────╮ │14 pub const Header = @import("./Home/Header.zig");│ │15 pub const Settings = @import("./Settings.zig"); │ │16 pub const Auth = @import("./Auth.zig"); │ │17 +pub const Quit = @import("./Quit.zig"); │ │18 │ │19 header: Header, │ │20 users: Users, │ ╰────────────────────────────────────────────────────╯ ╭─────────────────────────╮ │21 repos: Repos, │ │22 settings: Settings, │ │23 auth: Auth, │ │24 +quit: Quit, │ │25 │ │26 const Self = @This();│ │27 │ ╰─────────────────────────╯ ╭────────────────────────────────────────────────────────╮ │35 .repos = try Repos.init(arena, haxy_moment),│ │36 .settings = Settings.init(), │ │37 .auth = Auth.init(), │ │38 + .quit = Quit.init(), │ │39 }; │ │40 } │ │41 │ ╰────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │57 { │ │58 var header_view = try Header.View.init(allocator, &data.header, session); │ │59 errdefer header_view.deinit(allocator); │ │57 - users_tab_id = header_view.tab_ids[0]; │ │60 + users_tab_id = header_view.tab_ids.keys()[0]; │ │61 try box.children.put(allocator, header_view.getFocus().id, .{ .widget = .{ .home_header = header_view }, .rect = null, .min_size = null });│ │62 } │ │63 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │87 var auth_view = try Auth.View.init(allocator, &data.auth, session, users_tab_id); │ │88 errdefer auth_view.deinit(allocator); │ │89 try stack.children.put(allocator, auth_view.getFocus().id, .{ .home_auth = auth_view }); │ │90 + } │ │91 + │ │92 + if (session.is_terminal) { │ │93 + var quit_view = try Quit.View.init(allocator, &data.quit, session); │ │94 + errdefer quit_view.deinit(allocator); │ │95 + try stack.children.put(allocator, quit_view.getFocus().id, .{ .quit = quit_view }); │ │96 } │ │97 │ │98 try box.children.put(allocator, stack.getFocus().id, .{ .widget = .{ .stack = stack }, .rect = null, .min_size = null });│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │119 // each header tab maps 1:1 to a stack child by position │ │120 if (header.getSelectedIndex()) |index| { │ │121 stack.getFocus().child_id = stack.children.keys()[index]; │ │113 - self.session.data.current_page = switch (index) { │ │114 - 0 => .home_users, │ │115 - 1 => .home_repos, │ │116 - 2 => .home_settings, │ │117 - 3 => .home_auth, │ │118 - else => .home_users, │ │119 - }; │ │122 + switch (index) { │ │123 + 0 => self.session.data.current_page = .home_users, │ │124 + 1 => self.session.data.current_page = .home_repos, │ │125 + 2 => self.session.data.current_page = .home_settings, │ │126 + 3 => self.session.data.current_page = .home_auth, │ │127 + // the quit tab is tty-only and not a route, so leave current_page│ │128 + // alone (nothing to mirror into the url). │ │129 + else => {}, │ │130 + } │ │131 } │ │132 try self.box.build(allocator, constraint, root_focus); │ │133 } │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │162 .home_repos => |*v| v.getSelectedIndex() == 0, │ │163 .home_settings => |*v| v.getSelectedIndex() == 0,│ │164 .home_auth => |*v| v.getSelectedIndex() == 0, │ │165 + .quit => |*v| v.getSelectedIndex() == 0, │ │166 else => false, │ │167 }; │ │168 if (at_top) { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯