╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────────╮ │src/ui/Home/Header.zig│ ╰──────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │25 │ │26 pub const View = struct { │ │27 scroll: wgt.Scroll(ui.Widget), │ │28 - data: *const Self, │ │28 tab_ids: std.AutoArrayHashMapUnmanaged(usize, void), │ │29 │ │30 pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session) !View {│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │60 │ │61 // the tab matching the current page is focused initially; matching by │ │62 // link (rather than position) keeps this robust to tab changes. │ │64 - const current_link: []const u8 = switch (session.data.current_page) { │ │65 - .home_users => "ai:/users", │ │66 - .home_settings => "ai:/settings", │ │67 - .home_auth => "ai:/auth", │ │68 - else => "ai:/repos", │ │63 + const current_tag = std.meta.activeTag(session.data.current_page); │ │64 + const repos_link = try ui.inPageTabLink(session, .{ .home_repos = 0 }, current_tag == .home_repos);│ │65 + const users_link = try ui.inPageTabLink(session, .{ .home_users = 0 }, current_tag == .home_users);│ │66 + const settings_link = try ui.inPageTabLink(session, .home_settings, current_tag == .home_settings);│ │67 + const auth_link = try ui.inPageTabLink(session, .home_auth, current_tag == .home_auth); │ │68 + const current_link: []const u8 = switch (current_tag) { │ │69 + .home_users => users_link, │ │70 + .home_settings => settings_link, │ │71 + .home_auth => auth_link, │ │72 + else => repos_link, │ │73 }; │ │74 var selected_tab: ?usize = null; │ │75 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │78 var text_box = try wgt.TextBox(ui.Widget).init(allocator, "repos", .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none });│ │79 errdefer text_box.deinit(allocator); │ │80 text_box.getFocus().focusable = true; │ │77 - text_box.getFocus().kind = .{ .custom = "ai:/repos" }; │ │81 + text_box.getFocus().kind = .{ .custom = repos_link }; │ │82 try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │79 - if (std.mem.eql(u8, "ai:/repos", current_link)) selected_tab = text_box.getFocus().id; │ │83 + if (std.mem.eql(u8, repos_link, current_link)) selected_tab = text_box.getFocus().id; │ │84 try box.children.put(allocator, text_box.getFocus().id, .{ │ │85 .widget = .{ .text_box = text_box }, │ │86 .rect = null, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 93 var text_box = try wgt.TextBox(ui.Widget).init(allocator, "users", .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none });│ │ 94 errdefer text_box.deinit(allocator); │ │ 95 text_box.getFocus().focusable = true; │ │ 92 - text_box.getFocus().kind = .{ .custom = "ai:/users" }; │ │ 96 + text_box.getFocus().kind = .{ .custom = users_link }; │ │ 97 try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │ 94 - if (std.mem.eql(u8, "ai:/users", current_link)) selected_tab = text_box.getFocus().id; │ │ 98 + if (std.mem.eql(u8, users_link, current_link)) selected_tab = text_box.getFocus().id; │ │ 99 try box.children.put(allocator, text_box.getFocus().id, .{ │ │100 .widget = .{ .text_box = text_box }, │ │101 .rect = null, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │120 var text_box = try wgt.TextBox(ui.Widget).init(allocator, "settings", .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none });│ │121 errdefer text_box.deinit(allocator); │ │122 text_box.getFocus().focusable = true; │ │119 - text_box.getFocus().kind = .{ .custom = "ai:/settings" }; │ │123 + text_box.getFocus().kind = .{ .custom = settings_link }; │ │124 try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │121 - if (std.mem.eql(u8, "ai:/settings", current_link)) selected_tab = text_box.getFocus().id; │ │125 + if (std.mem.eql(u8, settings_link, current_link)) selected_tab = text_box.getFocus().id; │ │126 try box.children.put(allocator, text_box.getFocus().id, .{ │ │127 .widget = .{ .text_box = text_box }, │ │128 .rect = null, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │134 { │ │135 var auth_tab = try AuthTab.View.init(allocator, session); │ │136 errdefer auth_tab.deinit(allocator); │ │137 + auth_tab.text_box.getFocus().kind = .{ .custom = auth_link }; │ │138 try tab_ids.put(allocator, auth_tab.getFocus().id, {}); │ │134 - if (std.mem.eql(u8, "ai:/auth", current_link)) selected_tab = auth_tab.getFocus().id;│ │139 + if (std.mem.eql(u8, auth_link, current_link)) selected_tab = auth_tab.getFocus().id; │ │140 try box.children.put(allocator, auth_tab.getFocus().id, .{ │ │141 .widget = .{ .auth_tab = auth_tab }, │ │142 .rect = null, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │161 │ │162 var self = View{ │ │163 .scroll = try wgt.Scroll(ui.Widget).init(allocator, .{ .box = box }, .{ .direction = .horiz, .show_bar = false, .web_native = !session.is_terminal }),│ │159 - .data = data, │ │164 .tab_ids = tab_ids, │ │165 }; │ │166 self.getFocus().child_id = selected_tab orelse self.tab_ids.keys()[0]; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │23 pub const Settings = @import("./Settings.zig"); │ │24 pub const Auth = @import("./Auth.zig"); │ │25 pub const Quit = @import("./Quit.zig"); │ │26 - │ │27 -const Array = ui.RoutablePage.Array(ui.RoutablePage.repo_identity_max_len);│ │26 │ │27 header: Header, │ │28 repo: evt.Repo.Record, │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │36 settings: Settings, │ │37 auth: Auth, │ │38 quit: Quit, │ │41 -// the full files route this page renders, mirrored into current_page when │ │42 -// the files tab is selected. │ │43 -route_name: ui.RoutablePage.RepoFilesRoute, │ │44 -// the commits route this page renders ("owner/name/commits[/<oid>]"), mirrored│ │45 -// when the commits tab is selected. │ │46 -commits_route_name: ui.RoutablePage.RepoCommitsRoute, │ │47 -// "owner/name" alone, mirrored when the settings/auth tab is selected. │ │48 -identity: Array, │ │39 │ │40 const Self = @This(); │ │41 │ ╰───────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │81 .repo_commits => |c| c.content, │ │82 else => .{ .diff = .{} }, │ │83 }; │ │94 - const commits_start = switch (commits_content) { │ │95 - .diff => |d| d.start, │ │96 - .message => 0, │ │97 - }; │ │84 // the refs tab windows one column at a time: `refs_from` (a url-encoded │ │85 // ref name) roots `refs_kind`'s column, the other stays at its first window.│ │86 const refs_kind: ui.RoutablePage.RefKind = switch (route) { │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯