╭ changed ─────────────╮ │src/ui/User/Header.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────╮ │1 const std = @import("std"); │ │2 const ui = @import("../../ui.zig"); │ │3 +const evt = @import("../../event.zig");│ │4 const inp = @import("../input.zig"); │ │5 const xit = @import("xit"); │ │6 const xitui = xit.xitui; │ ╰──────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 97 // tabs (the page already holds every tab's content), while the href is │ │ 98 // still followed with js off. allocated in the page arena so the focus │ │ 99 // kinds that borrow them live as long as this page's widget tree. │ │ 99 - const aa = session.page_arena.allocator(); │ │100 const current_page = session.data.current_page; │ │101 const current_tag = std.meta.activeTag(current_page); │ │102 - const current_link = try std.fmt.allocPrint(aa, "ai:{s}", .{try current_page.toUrl(session.page_arena)}); │ │103 - const repos_link = if (current_tag == .user_repos) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}", .{data.name}); │ │104 - const forks_link = if (current_tag == .user_forks) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/forks", .{data.name}); │ │105 - const new_repo_link = if (current_tag == .user_repo_new) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/repo/new", .{data.name});│ │106 - const new_user_link = if (current_tag == .user_user_new) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/user/new", .{data.name});│ │107 - const user_link = if (current_tag == .user_user) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/user", .{data.name}); │ │102 + const name = ui.RoutablePage.Array(evt.User.name_max_len).from(data.name) orelse return error.RouteTooLong; │ │103 + const repos_link = try ui.inPageTabLink(session, .{ .user_repos = .{ .name = name } }, current_tag == .user_repos); │ │104 + const forks_link = try ui.inPageTabLink(session, .{ .user_forks = .{ .name = name } }, current_tag == .user_forks); │ │105 + const new_repo_link = try ui.inPageTabLink(session, .{ .user_repo_new = name }, current_tag == .user_repo_new); │ │106 + const new_user_link = try ui.inPageTabLink(session, .{ .user_user_new = name }, current_tag == .user_user_new); │ │107 + const user_link = try ui.inPageTabLink(session, .{ .user_user = name }, current_tag == .user_user); │ │108 │ │109 // the tab matching the current page is focused initially; matching by │ │110 // link (rather than position) keeps this robust to tab changes. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯