╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Discussions.zig ──────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
288 const label = if (data.tag.len == 0) "tags" else blk: { 289 const decoded = std.Uri.percentDecodeInPlace(try aa.dupe(u8, data.tag)); 290 break :blk try std.fmt.allocPrint(aa, "tags ({s})", .{decoded}); 291 }; 292 try header.addTab(allocator, label, tags_link, View.viewIndex(.tags)); 293 } 294 295 // new-discussion tab; an edit or comment url shows its tab in this place 296 { 297 const route = switch (data.view) { 298 .edit => ui.RoutablePage.repoThreadEditRoute(.discuss, data.identity, data.selected_id) orelse return error.RouteTooLong, 299 .new_comment => ui.RoutablePage.repoThreadCommentNewRoute(.discuss, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, 300 .edit_comment => ui.RoutablePage.repoThreadCommentEditRoute(.discuss, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, 301 .remove => ui.RoutablePage.repoThreadRemoveRoute(.discuss, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, 302 else => ui.RoutablePage.repoThreadNewRoute(.discuss, data.identity) orelse return error.RouteTooLong, 303 }; 304 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.new)); 305 const label: []const u8 = switch (data.view) { 306 .edit => "edit", 307 .new_comment => "reply", 308 .edit_comment => "edit", 309 .remove => "remove", 310 else => "new", 311 }; 312 try header.addTab(allocator, label, link, View.viewIndex(.new)); 313 } 314 315 header.select(View.viewIndex(data.view)); 316 return header; 317 } 318