╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────╮ │src/ui/Settings.zig│ ╰───────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │73 // decided per-frame since the tty doesn't rebuild the page on login │ │73 - self.focus.clear(); │ │74 + const index: usize = if (self.session.data.user_id != null) authorized_index else unauthorized_index;│ │75 + self.stack.getFocus().child_id = self.stack.children.keys()[index]; │ │76 if (self.session.data.user_id != null) { │ │75 - const box = &self.authorized.child.box; │ │77 + const box = &self.stack.children.values()[authorized_index].center.child.box; │ │78 const button = &box.children.values()[0].widget.text_box; │ │79 try button.setContent(allocator, ansiLabel(self.session)); │ │78 - try self.authorized.build(allocator, constraint, root_focus); │ │79 - if (self.authorized.getGrid()) |inner_grid| { │ │80 - try self.focus.addChild(allocator, self.authorized.getFocus(), inner_grid.size, 0, 0); │ │81 - } │ │82 - self.focus.child_id = self.authorized.getFocus().id; │ │83 - } else { │ │84 - try self.unauthorized.build(allocator, constraint, root_focus); │ │85 - if (self.unauthorized.getGrid()) |inner_grid| { │ │86 - try self.focus.addChild(allocator, self.unauthorized.getFocus(), inner_grid.size, 0, 0); │ │87 - } │ │88 - self.focus.child_id = self.unauthorized.getFocus().id; │ │80 } │ │81 + try self.stack.build(allocator, constraint, root_focus); │ │82 } │ │83 │ │84 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────╮ │100 } │ │101 │ │102 pub fn clearGrid(self: *View) void {│ │111 - self.authorized.clearGrid(); │ │112 - self.unauthorized.clearGrid(); │ │103 + self.stack.clearGrid(); │ │104 } │ │105 │ │106 pub fn getGrid(self: View) ?Grid { │ ╰─────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │116 - if (self.session.data.user_id != null) return self.authorized.getGrid();│ │117 - return self.unauthorized.getGrid(); │ │107 + return self.stack.getGrid(); │ │108 } │ │109 │ │110 pub fn getFocus(self: *View) *Focus { │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────╮ │121 - return self.focus; │ │111 + return self.stack.getFocus();│ │112 } │ │113 │ │114 pub fn atTop(self: View) bool { │ ╰──────────────────────────────────────────╯ ╭ changed ────────╮ │src/ui/widget.zig│ ╰─────────────────╯ ╭─────────────────────────────────────────────────────────────────────────╮ │61 auth_tab: ui.Home.Header.AuthTab.View, │ │62 home_settings: ui.Home.Settings.View, │ │63 home_auth: ui.Home.Auth.View, │ │64 + auth_login: ui.Home.Auth.Login.View, │ │65 + auth_logout: ui.Home.Auth.Logout.View, │ │66 footer: Footer, │ │67 │ │68 pub fn deinit(self: *Widget, allocator: std.mem.Allocator) void {│ ╰─────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │104 // whether moving up should return to the page header │ │105 pub fn atTop(self: *Widget, root_focus: *Focus) bool { │ │106 return switch (self.*) { │ │105 - inline .home_users, .home_repos, .flow_box_scroll, .home_settings, .home_auth, .quit, .repo_files, .repo_commits, .repo_refs, .repo_issues, .repo_patches, .repo_discussions, .repo_events => |*view| view.atTop(), │ │106 - .repo_patch_detail => |*view| view.atTop(root_focus), │ │107 + inline .home_users, .home_repos, .flow_box_scroll, .home_settings, .auth_login, .auth_logout, .quit, .repo_files, .repo_commits, .repo_refs, .repo_issues, .repo_patches, .repo_discussions, .repo_events => |*view| view.atTop(),│ │108 + inline .home_auth, .repo_patch_detail => |*view| view.atTop(root_focus), │ │109 else => false, │ │110 }; │ │111 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯