╭ changed ─────────────╮ │src/ui/User/Header.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────╮ │12 const repos_tab_label = "repos"; │ │13 const forks_tab_label = "forks"; │ │14 const settings_tab_label = "settings"; │ │15 +const new_repo_tab_label = "new repo"; │ │16 │ │17 pub const AuthTab = @import("./../AuthTab.zig");│ │18 │ ╰────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │104 const repos_link = if (current_tag == .user_repos) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}", .{data.name}); │ │105 const forks_link = if (current_tag == .user_forks) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/forks", .{data.name}); │ │106 const settings_link = if (current_tag == .user_settings) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/settings", .{data.name});│ │107 + const new_repo_link = if (current_tag == .user_new_repo) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/new-repo", .{data.name});│ │108 const auth_link = if (current_tag == .user_auth) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/auth", .{data.name}); │ │109 │ │110 // the tab matching the current page is focused initially; matching by │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │111 // link (rather than position) keeps this robust to tab changes.│ │112 const selected_link: []const u8 = switch (current_page) { │ │113 .user_settings => settings_link, │ │114 + .user_new_repo => new_repo_link, │ │115 .user_auth => auth_link, │ │116 .user_forks => forks_link, │ │117 else => repos_link, │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────╮ │148 }); │ │149 } │ │150 │ │148 - // spacer pushes settings + auth to the right │ │151 + // spacer pushes settings, new repo and auth to the right│ │152 { │ │153 var spacer = try ui.widget.Spacer.init(allocator); │ │154 errdefer spacer.deinit(allocator); │ ╰──────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │157 .rect = null, │ │158 .min_size = null, │ │159 .flex = .grow, │ │160 + }); │ │161 + } │ │162 + │ │163 + // new repo tab. repos are created for the logged-in user. │ │164 + if (session.data.user_id != null) { │ │165 + var text_box = try wgt.TextBox.init(allocator, new_repo_tab_label, .{ .border_style = .single, .round_corners = true, .wrap_kind = .none });│ │166 + errdefer text_box.deinit(allocator); │ │167 + text_box.getFocus().mode = .all; │ │168 + text_box.getFocus().kind = .{ .custom = new_repo_link }; │ │169 + try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │170 + if (std.mem.eql(u8, new_repo_link, selected_link)) selected_tab = text_box.getFocus().id; │ │171 + try tabs_box.children.put(allocator, text_box.getFocus().id, .{ │ │172 + .widget = .{ .text_box = text_box }, │ │173 + .rect = null, │ │174 + .min_size = .{ .width = new_repo_tab_label.len + 2, .height = null }, │ │175 }); │ │176 } │ │177 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯