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