╭ changed ─────────────╮ │src/ui/User/Header.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────╮ │11 │ │12 const repos_tab_label = "repos"; │ │13 const forks_tab_label = "forks"; │ │14 -const new_repo_tab_label = "new"; │ │14 +const new_tab_label = "new"; │ │15 const new_repo_tab_bottom_label = "repo"; │ │16 +const new_user_tab_bottom_label = "user"; │ │17 │ │18 pub const AuthTab = @import("./../AuthTab.zig");│ │19 │ ╰────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │105 const repos_link = if (current_tag == .user_repos) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}", .{data.name}); │ │106 const forks_link = if (current_tag == .user_forks) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/forks", .{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 new_user_link = if (current_tag == .user_new_user) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/new-user", .{data.name});│ │109 const auth_link = if (current_tag == .user_auth) current_link else try std.fmt.allocPrint(aa, "ai:/user/{s}/auth", .{data.name}); │ │110 │ │111 // the tab matching the current page is focused initially; matching by │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │112 // link (rather than position) keeps this robust to tab changes.│ │113 const selected_link: []const u8 = switch (current_page) { │ │114 .user_new_repo => new_repo_link, │ │115 + .user_new_user => new_user_link, │ │116 .user_auth => auth_link, │ │117 .user_forks => forks_link, │ │118 else => repos_link, │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────╮ │149 }); │ │150 } │ │151 │ │149 - // spacer pushes new repo and auth to the right │ │152 + // spacer pushes new repo, new user, and auth to the right│ │153 { │ │154 var spacer = try ui.widget.Spacer.init(allocator); │ │155 errdefer spacer.deinit(allocator); │ ╰───────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │161 }); │ │162 } │ │163 │ │161 - // new repo tab. repos are created for the logged-in user. │ │164 + // new repo tab with a login, new user tab without one │ │165 if (session.data.user_id != null) { │ │163 - var text_box = try wgt.TextBox.init(allocator, new_repo_tab_label, .{ .border_style = .single, .round_corners = true, .wrap_kind = .none, .bottom_label = new_repo_tab_bottom_label });│ │166 + var text_box = try wgt.TextBox.init(allocator, new_tab_label, .{ .border_style = .single, .round_corners = true, .wrap_kind = .none, .bottom_label = new_repo_tab_bottom_label }); │ │167 errdefer text_box.deinit(allocator); │ │168 text_box.getFocus().mode = .all; │ │169 text_box.getFocus().kind = .{ .custom = new_repo_link }; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │172 try tabs_box.children.put(allocator, text_box.getFocus().id, .{ │ │173 .widget = .{ .text_box = text_box }, │ │174 .rect = null, │ │172 - .min_size = .{ .width = @max(new_repo_tab_label.len, new_repo_tab_bottom_label.len) + 2, .height = null }, │ │175 + .min_size = .{ .width = @max(new_tab_label.len, new_repo_tab_bottom_label.len) + 2, .height = null }, │ │176 + }); │ │177 + } else { │ │178 + var text_box = try wgt.TextBox.init(allocator, new_tab_label, .{ .border_style = .single, .round_corners = true, .wrap_kind = .none, .bottom_label = new_user_tab_bottom_label });│ │179 + errdefer text_box.deinit(allocator); │ │180 + text_box.getFocus().mode = .all; │ │181 + text_box.getFocus().kind = .{ .custom = new_user_link }; │ │182 + try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │183 + if (std.mem.eql(u8, new_user_link, selected_link)) selected_tab = text_box.getFocus().id; │ │184 + try tabs_box.children.put(allocator, text_box.getFocus().id, .{ │ │185 + .widget = .{ .text_box = text_box }, │ │186 + .rect = null, │ │187 + .min_size = .{ .width = @max(new_tab_label.len, new_user_tab_bottom_label.len) + 2, .height = null }, │ │188 }); │ │189 } │ │190 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯