╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Patches.zig ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1067 .edit_comment => ui.RoutablePage.repoThreadCommentEditRoute(.patch, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, 1068 .remove => ui.RoutablePage.repoThreadRemoveRoute(.patch, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, 1069 .resolve => ui.RoutablePage.repoPatchesResolveRoute(data.identity, data.selected_id, data.theirs_picks) orelse return error.RouteTooLong, 1070 else => ui.RoutablePage.repoThreadNewRoute(.patch, data.identity) orelse return error.RouteTooLong, 1071 }; 1072 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.new)); 1073 const label: []const u8 = switch (data.view) { 1074 .edit => edit_tab_label, 1075 .publish => publish_tab_label, 1076 .merge => merge_tab_label, 1077 .new_comment => reply_tab_label, 1078 .edit_comment => edit_tab_label, 1079 .remove => remove_tab_label, 1080 .resolve => resolve_tab_label, 1081 else => new_tab_label, 1082 }; 1083 try header.addTab(allocator, label, link, View.viewIndex(.new)); 1084 } 1085 1086 // drafts belong to the logged-in user and are not available locally 1087 if (session.data.host_kind != .local) { 1088 const route = ui.RoutablePage.repoPatchesDraftsRoute(data.identity) orelse return error.RouteTooLong; 1089 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.drafts)); 1090 var label_buf: [64]u8 = undefined; 1091 const label = try std.fmt.bufPrint(&label_buf, drafts_tab_label ++ " ({d})", .{data.drafts.count}); 1092 try header.addTab(allocator, label, link, View.viewIndex(.drafts)); 1093 } 1094 1095 // conflicts tab, labeled with the conflict count 1096 if (data.conflicts.count > 0) { 1097 const route = ui.RoutablePage.repoPatchesConflictsRoute(data.identity, "") orelse return error.RouteTooLong; 1098 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.conflicts)); 1099 var label_buf: [64]u8 = undefined; 1100 const label = try std.fmt.bufPrint(&label_buf, conflicts_tab_label ++ " ({d})", .{data.conflicts.count}); 1101 try header.addTab(allocator, label, link, View.viewIndex(.conflicts)); 1102 } 1103 1104 header.select(View.viewIndex(data.view)); 1105 return header; 1106 } 1107