╭ changed ─────────────╮ │src/ui/Auth/Logout.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │20 data: *const Self, │ │21 session: *ui.Session, │ │22 button_id: usize, │ │23 - // focus id of the header's "users" tab; on logout we jump there so the│ │24 - // user isn't stranded on a button that's about to be hidden. │ │25 - users_tab_id: usize, │ │23 │ │24 const prompt_index: usize = 0; │ │25 const button_index: usize = 1; │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │26 │ │30 - pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session, users_tab_id: usize) !View { │ │27 + pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session) !View { │ │28 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .rounded_corners = true, .direction = .vert });│ │29 errdefer box.deinit(allocator); │ │30 // marks this subtree as an HTML form scope for the web overlay │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────╮ │63 .data = data, │ │64 .session = session, │ │65 .button_id = button_id, │ │69 - .users_tab_id = users_tab_id,│ │66 }; │ │67 } │ │68 │ ╰─────────────────────────────────────────────╯ ╭────────────────────────────────────────────────╮ │78 _ = allocator; │ │79 switch (key) { │ │80 .enter => { │ │85 - try self.logout(root_focus);│ │81 + try self.logout(); │ │82 return; │ │83 }, │ │84 .mouse => |mouse| { │ ╰────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │85 if (inp.leftClickOn(root_focus, self.button_id, mouse)) {│ │90 - try self.logout(root_focus); │ │86 + try self.logout(); │ │87 return; │ │88 } │ │89 }, │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │ 91 } │ │ 92 } │ │ 93 │ │ 98 - fn logout(self: *View, root_focus: *Focus) !void { │ │ 94 + fn logout(self: *View) !void { │ │ 95 self.session.data.user_id = null; │ │100 - // jump focus back to the users tab — the logout button is about to │ │101 - // be hidden by the tab-label swap. │ │102 - root_focus.setFocus(self.users_tab_id); │ │ 96 + self.session.data.user_name = null; │ │ 97 + // leave the auth tab for the page it belongs to, where the web's │ │ 98 + // /logout redirect also lands │ │ 99 + try self.session.navigate(self.session.data.current_page.pageRoot());│ │100 } │ │101 │ │102 pub fn clearGrid(self: *View) void { │ ╰──────────────────────────────────────────────────────────────────────────────────╯