╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────────╮ │src/ui/Fork/Header.zig│ ╰──────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │131 │ │132 const settings_route = ui.RoutablePage.forkSettingsRoute(fork_identity, data.id) orelse return error.RouteTooLong; │ │133 const settings_link = try ui.inPageTabLink(session, settings_route, current_tag == .fork_settings); │ │134 + const new_repo_route = ui.RoutablePage.forkNewRepoRoute(fork_identity, data.id) orelse return error.RouteTooLong; │ │135 + const new_repo_link = try ui.inPageTabLink(session, new_repo_route, current_tag == .fork_new_repo); │ │136 const auth_route = ui.RoutablePage.forkAuthRoute(fork_identity, data.id) orelse return error.RouteTooLong; │ │137 const auth_link = try ui.inPageTabLink(session, auth_route, current_tag == .fork_auth); │ │138 + │ │139 + // repos are created for the logged-in user. │ │140 + if (session.data.user_id != null) { │ │141 + var new_repo = try wgt.TextBox.init(allocator, new_repo_tab_label, .{ .border_style = .single, .round_corners = true, .wrap_kind = .none }); │ │142 + errdefer new_repo.deinit(allocator); │ │143 + new_repo.getFocus().mode = .all; │ │144 + new_repo.getFocus().kind = .{ .custom = new_repo_link }; │ │145 + try tab_ids.put(allocator, new_repo.getFocus().id, {}); │ │146 + if (current_tag == .fork_new_repo) selected_tab = new_repo.getFocus().id; │ │147 + try tabs_box.children.put(allocator, new_repo.getFocus().id, .{ .widget = .{ .text_box = new_repo }, .rect = null, .min_size = .{ .width = new_repo_tab_label.len + 2, .height = null } });│ │148 + } │ │149 │ │150 // settings are account preferences, so they require a login. │ │151 if (session.data.user_id != null) { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/ui/Home.zig│ ╰───────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │78 try stack.children.put(allocator, users_view.getFocus().id, .{ .home_users = users_view }); │ │79 } │ │80 │ │81 - // the header has no settings tab without a login, so keep the │ │82 - // stack's children 1:1 with the tabs by skipping the view too │ │81 + // the header has no new repo or settings tab without a login, so keep the │ │82 + // stack's children 1:1 with the tabs by skipping those views too │ │83 + if (session.data.user_id != null) { │ │84 + var new_repo_view = try ui.NewRepo.View.init(allocator, session, .home_new_repo); │ │85 + errdefer new_repo_view.deinit(allocator); │ │86 + try stack.children.put(allocator, new_repo_view.getFocus().id, .{ .new_repo = new_repo_view });│ │87 + } │ │88 + │ │89 if (session.data.user_id != null) { │ │90 var settings_view = try Settings.View.init(allocator, session); │ │91 errdefer settings_view.deinit(allocator); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/ui/Home/Header.zig│ ╰──────────────────────╯ ╭────────────────────────────────────────────────────╮ │12 const about_tab_label = "about"; │ │13 const users_tab_label = "users"; │ │14 const settings_tab_label = "settings"; │ │15 +const new_repo_tab_label = "new repo"; │ │16 │ │17 pub const AuthTab = @import("./../AuthTab.zig");│ │18 │ ╰────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │93 const about_link = try ui.inPageTabLink(session, .home_about, current_tag == .home_about); │ │94 const users_link = try ui.inPageTabLink(session, .{ .home_users = .{} }, current_tag == .home_users);│ │95 const settings_link = try ui.inPageTabLink(session, .home_settings, current_tag == .home_settings); │ │96 + const new_repo_link = try ui.inPageTabLink(session, .home_new_repo, current_tag == .home_new_repo); │ │97 const auth_link = try ui.inPageTabLink(session, .home_auth, current_tag == .home_auth); │ │98 const current_link: []const u8 = switch (current_tag) { │ │99 .home_users => users_link, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────╮ │100 .home_settings => settings_link,│ │101 + .home_new_repo => new_repo_link,│ │102 .home_auth => auth_link, │ │103 else => about_link, │ │104 }; │ ╰─────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────╮ │134 }); │ │135 } │ │136 │ │134 - // spacer pushes settings + auth to the right │ │137 + // spacer pushes settings, new repo and auth to the right│ │138 { │ │139 var spacer = try ui.widget.Spacer.init(allocator); │ │140 errdefer spacer.deinit(allocator); │ ╰──────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │143 .rect = null, │ │144 .min_size = null, │ │145 .flex = .grow, │ │146 + }); │ │147 + } │ │148 + │ │149 + // new repo tab. repos are created for the logged-in user. │ │150 + if (session.data.user_id != null) { │ │151 + var text_box = try wgt.TextBox.init(allocator, new_repo_tab_label, .{ .border_style = .single, .round_corners = true, .wrap_kind = .none });│ │152 + errdefer text_box.deinit(allocator); │ │153 + text_box.getFocus().mode = .all; │ │154 + text_box.getFocus().kind = .{ .custom = new_repo_link }; │ │155 + try tab_ids.put(allocator, text_box.getFocus().id, {}); │ │156 + if (std.mem.eql(u8, new_repo_link, current_link)) selected_tab = text_box.getFocus().id; │ │157 + try tabs_box.children.put(allocator, text_box.getFocus().id, .{ │ │158 + .widget = .{ .text_box = text_box }, │ │159 + .rect = null, │ │160 + .min_size = .{ .width = new_repo_tab_label.len + 2, .height = null }, │ │161 }); │ │162 } │ │163 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │452 try stack.children.put(allocator, undo_view.getFocus().id, .{ .repo_undo = undo_view }); │ │453 } │ │454 │ │455 - // the header only shows the settings tab with a login and the auth │ │456 - // tab outside local mode, so keep the stack's children 1:1 with │ │455 + // the header only shows the new repo and settings tabs with a login │ │456 + // and the auth tab outside local mode, so keep the stack's children 1:1 with │ │457 // the tabs by skipping the same views. │ │458 + if (session.data.user_id != null) { │ │459 + const identity = try std.fmt.allocPrint(session.page_arena.allocator(), "{s}/{s}", .{ data.header.owner_name, data.header.name }); │ │460 + const route = ui.RoutablePage{ .repo_new_repo = ui.RoutablePage.Array(ui.RoutablePage.repo_route_max_len).from(identity) orelse return error.RouteTooLong };│ │461 + var new_repo_view = try ui.NewRepo.View.init(allocator, session, route); │ │462 + errdefer new_repo_view.deinit(allocator); │ │463 + try stack.children.put(allocator, new_repo_view.getFocus().id, .{ .new_repo = new_repo_view }); │ │464 + } │ │465 + │ │466 if (session.data.user_id != null) { │ │467 var settings_view = try Settings.View.init(allocator, session); │ │468 errdefer settings_view.deinit(allocator); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/ui/Repo/Header.zig│ ╰──────────────────────╯ ╭────────────────────────────────────────────────────╮ │19 const discuss_tab_label = "discuss"; │ │20 const events_tab_label = "events"; │ │21 const settings_tab_label = "settings"; │ │22 +const new_repo_tab_label = "new repo"; │ │23 │ │24 pub const AuthTab = @import("./../AuthTab.zig");│ │25 │ ╰────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │169 const events_link = try ui.inPageTabLink(session, events_route, current_tag == .repo_events); │ │170 const settings_route = ui.RoutablePage{ .repo_settings = Array.from(identity) orelse return error.RouteTooLong };│ │171 const settings_link = try ui.inPageTabLink(session, settings_route, current_tag == .repo_settings); │ │172 + const new_repo_route = ui.RoutablePage{ .repo_new_repo = Array.from(identity) orelse return error.RouteTooLong };│ │173 + const new_repo_link = try ui.inPageTabLink(session, new_repo_route, current_tag == .repo_new_repo); │ │174 const auth_route = ui.RoutablePage{ .repo_auth = Array.from(identity) orelse return error.RouteTooLong }; │ │175 const auth_link = try ui.inPageTabLink(session, auth_route, current_tag == .repo_auth); │ │176 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯