╭ changed ─────────────╮ │src/ui/Repo/Header.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────╮ │12 pub const AuthTab = @import("./../AuthTab.zig"); │ │13 │ │14 const RefOrOid = ui.RoutablePage.RefOrOid; │ │15 +const Array = ui.RoutablePage.Array(ui.RoutablePage.repo_route_max_len);│ │16 │ │17 name: []const u8, │ │18 owner_name: []const u8, │ ╰────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────╮ │55 const aa = session.page_arena.allocator(); │ │56 │ │57 // the user's name (local mode has no user pages to link to) │ │57 - if (session.local == null) { │ │58 + if (!session.data.is_local) { │ │59 const text = try std.fmt.allocPrint(aa, "{s}/", .{data.owner_name}); │ │60 const link = try std.fmt.allocPrint(aa, "a:/user/{s}", .{data.owner_name});│ │61 │ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │71 }); │ │72 } │ │73 │ │73 - const identity = try std.fmt.allocPrint(aa, "{s}/{s}", .{ data.owner_name, data.name }); │ │74 + // local routes carry no identity, so their urls come out elided │ │75 + const identity = if (session.data.is_local) "" else try std.fmt.allocPrint(aa, "{s}/{s}", .{ data.owner_name, data.name });│ │76 │ │77 // title sits to the left of the tabs; it links to the repo's files root │ │78 // (the bare route, so it resolves to the default branch). │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │116 const files_link = try std.fmt.allocPrint(aa, "ai:{s}", .{try files_route.urlAlloc(session.page_arena)}); │ │117 const commits_route = ui.RoutablePage.repoCommitsRoute(identity, data.ref_or_oid, data.ref_or_oid_value, 0) orelse return error.RouteTooLong;│ │118 const commits_link = try std.fmt.allocPrint(aa, "ai:{s}", .{try commits_route.urlAlloc(session.page_arena)}); │ │117 - const refs_link = try std.fmt.allocPrint(aa, "ai:/repo/{s}/{s}/refs", .{ data.owner_name, data.name }); │ │118 - const issues_link = if (data.issues_tag.len == 0) │ │119 - try std.fmt.allocPrint(aa, "ai:/repo/{s}/{s}/issues", .{ data.owner_name, data.name }) │ │120 - else │ │121 - try std.fmt.allocPrint(aa, "ai:/repo/{s}/{s}/issues/tag/{s}", .{ data.owner_name, data.name, data.issues_tag }); │ │122 - const settings_link = try std.fmt.allocPrint(aa, "ai:/repo/{s}/{s}/settings", .{ data.owner_name, data.name }); │ │123 - const auth_link = try std.fmt.allocPrint(aa, "ai:/repo/{s}/{s}/auth", .{ data.owner_name, data.name }); │ │119 + const refs_route = ui.RoutablePage.repoRefsRoute(identity, .branch, 0) orelse return error.RouteTooLong; │ │120 + const refs_link = try std.fmt.allocPrint(aa, "ai:{s}", .{try refs_route.urlAlloc(session.page_arena)}); │ │121 + const issues_route = ui.RoutablePage.repoIssuesRoute(identity, data.issues_tag, "") orelse return error.RouteTooLong; │ │122 + const issues_link = try std.fmt.allocPrint(aa, "ai:{s}", .{try issues_route.urlAlloc(session.page_arena)}); │ │123 + const settings_route = ui.RoutablePage{ .repo_settings = Array.from(identity) orelse return error.RouteTooLong }; │ │124 + const settings_link = try std.fmt.allocPrint(aa, "ai:{s}", .{try settings_route.urlAlloc(session.page_arena)}); │ │125 + const auth_route = ui.RoutablePage{ .repo_auth = Array.from(identity) orelse return error.RouteTooLong }; │ │126 + const auth_link = try std.fmt.allocPrint(aa, "ai:{s}", .{try auth_route.urlAlloc(session.page_arena)}); │ │127 │ │128 // the tab matching the current page is focused initially; matching by │ │129 // link (rather than position) keeps this robust to tab changes. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │226 // auth tab (login / logout). AuthTab defaults to the global ai:/auth │ │227 // link; repoint its instance at this repo's auth route so it stays on│ │228 // this page. local mode has no accounts, so it has no auth tab. │ │226 - if (session.local == null) { │ │229 + if (!session.data.is_local) { │ │230 var auth_tab = try AuthTab.View.init(allocator, session); │ │231 errdefer auth_tab.deinit(allocator); │ │232 auth_tab.text_box.getFocus().kind = .{ .custom = auth_link }; │ ╰───────────────────────────────────────────────────────────────────────────────────╯