╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Patches.zig ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1029 .resolve => ui.RoutablePage.repoPatchesResolveRoute(data.identity, data.selected_id, data.theirs_picks) orelse return error.RouteTooLong, 1030 else => ui.RoutablePage.repoThreadNewRoute(.patch, data.identity) orelse return error.RouteTooLong, 1031 }; 1032 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.new)); 1033 const label: []const u8 = switch (data.view) { 1034 .edit => "edit", 1035 .publish => "publish", 1036 .merge => "merge", 1037 .new_comment => "reply", 1038 .edit_comment => "edit", 1039 .remove => "remove", 1040 .resolve => "resolve", 1041 else => "new", 1042 }; 1043 try header.addTab(allocator, label, link, View.viewIndex(.new)); 1044 } 1045 1046 // drafts belong to the logged-in user and are not available locally 1047 if (session.data.host_kind != .local) { 1048 const route = ui.RoutablePage.repoPatchesDraftsRoute(data.identity) orelse return error.RouteTooLong; 1049 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.drafts)); 1050 var label_buf: [64]u8 = undefined; 1051 const label = try std.fmt.bufPrint(&label_buf, "drafts ({d})", .{data.drafts.count}); 1052 try header.addTab(allocator, label, link, View.viewIndex(.drafts)); 1053 } 1054 1055 // conflicts tab, labeled with the conflict count 1056 if (data.conflicts.count > 0) { 1057 const route = ui.RoutablePage.repoPatchesConflictsRoute(data.identity, "") orelse return error.RouteTooLong; 1058 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.conflicts)); 1059 var label_buf: [64]u8 = undefined; 1060 const label = try std.fmt.bufPrint(&label_buf, "conflicts ({d})", .{data.conflicts.count}); 1061 try header.addTab(allocator, label, link, View.viewIndex(.conflicts)); 1062 } 1063 1064 header.select(View.viewIndex(data.view)); 1065 return header; 1066 } 1067