╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Threads.zig│ ╰───────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │460 - return switch (kind) { │ │461 - .patch => ui.RoutablePage.repoPatchesDraftsRoute(identity), │ │462 - else => null, │ │463 - }; │ │450 + return if (supports_drafts) Data.draftsRoute(identity) else null; │ │451 } │ │452 │ │453 fn conflictsRoute(identity: []const u8, selected: []const u8) ?ui.RoutablePage {│ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │467 - return switch (kind) { │ │468 - .issue => ui.RoutablePage.repoIssuesConflictsRoute(identity, selected), │ │469 - .patch => ui.RoutablePage.repoPatchesConflictsRoute(identity, selected), │ │470 - else => @compileError("thread event kind has no conflict route"), │ │471 - }; │ │454 + return if (supports_conflicts) Data.conflictsRoute(identity, selected) else null; │ │455 } │ │456 │ │457 fn resolveRoute(identity: []const u8, selected: []const u8, picks: []const u8) ?ui.RoutablePage {│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │475 - return switch (kind) { │ │476 - .issue => ui.RoutablePage.repoIssuesResolveRoute(identity, selected, picks), │ │477 - .patch => ui.RoutablePage.repoPatchesResolveRoute(identity, selected, picks), │ │478 - else => @compileError("thread event kind has no resolve route"), │ │479 - }; │ │458 + return if (supports_conflicts) Data.resolveRoute(identity, selected, picks) else null; │ │459 } │ │460 │ │461 fn listLink(page_arena: *std.heap.ArenaAllocator, identity: []const u8, status: Status, tag: []const u8, id: []const u8) ![]const u8 {│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │478 } │ │479 │ │480 fn windowLink(page_arena: *std.heap.ArenaAllocator, data: *const Self, status_maybe: ?Status, drafts: bool, id: []const u8) ![]const u8 {│ │502 - if (has_conflicts and status_maybe == null and !drafts) { │ │481 + if (supports_conflicts and status_maybe == null and !drafts) { │ │482 const route = conflictsRoute(data.identity, id) orelse return error.RouteTooLong; │ │483 return std.fmt.allocPrint(page_arena.allocator(), "a:{s}", .{try route.toUrl(page_arena)}); │ │484 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │502 { │ │503 var hdr = try Data.initHeader(allocator, session, data); │ │504 errdefer hdr.deinit(allocator); │ │526 - switch (kind) { │ │527 - .issue => try outer.children.put(allocator, hdr.getFocus().id, .{ .widget = .{ .repo_issues_header = hdr }, .rect = null, .min_size = null }), │ │528 - .patch => try outer.children.put(allocator, hdr.getFocus().id, .{ .widget = .{ .repo_patches_header = hdr }, .rect = null, .min_size = null }), │ │529 - .discuss => try outer.children.put(allocator, hdr.getFocus().id, .{ .widget = .{ .repo_discussions_header = hdr }, .rect = null, .min_size = null }),│ │530 - else => @compileError("unsupported thread event kind"), │ │531 - } │ │505 + try outer.children.put(allocator, hdr.getFocus().id, .{ .widget = @unionInit(ui.Widget, Data.header_widget_name, hdr), .rect = null, .min_size = null });│ │506 } │ │507 │ │508 // the stack enters `outer` before its children enter it, so an error │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │588 var form = try initCommentForm(allocator, session, action, parent_author, parent_route orelse return error.RouteTooLong, initial_body);│ │589 errdefer form.deinit(allocator); │ │590 try stack.children.put(allocator, form.getFocus().id, .{ .box = form }); │ │617 - } else if (has_conflicts and data.view == .resolve) { │ │591 + } else if (supports_conflicts and data.view == .resolve) { │ │592 // on the web the page grows to the form's height and the │ │593 // browser scrolls it; the terminal scrolls the form itself │ │594 var form_widget: ui.Widget = blk: { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │622 try stack.children.put(allocator, message.getFocus().id, .{ .unauthorized = message });│ │623 } │ │624 │ │651 - if (has_drafts) { │ │625 + if (supports_drafts) { │ │626 var split = try initSplit(allocator, session, data, null, true); │ │627 errdefer split.deinit(allocator); │ │628 try stack.children.put(allocator, split.getFocus().id, .{ .box = split }); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │631 // the conflicts split; its tab exists only when the repo has │ │632 // conflicts, so skip the child too to keep the stack 1:1 with the │ │633 // tabs. │ │660 - if (has_conflicts and data.conflicts.count > 0) { │ │634 + if (supports_conflicts and data.conflicts.count > 0) { │ │635 var split = try initSplit(allocator, session, data, null, false); │ │636 errdefer split.deinit(allocator); │ │637 try stack.children.put(allocator, split.getFocus().id, .{ .box = split });│ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │660 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .horiz }); │ │661 errdefer box.deinit(allocator); │ │662 │ │689 - const win = if (status_maybe) |status| data.window(status) else if (drafts and has_drafts) &data.drafts else if (has_conflicts) &data.conflicts else unreachable; │ │663 + const win = if (status_maybe) |status| data.window(status) else if (drafts and supports_drafts) &data.drafts else if (supports_conflicts) &data.conflicts else unreachable;│ │664 │ │665 // the thread list (one focusable row per title), plus a "next" link that │ │666 // reloads the page rooted at the following thread. │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │762 try box.children.put(allocator, description.getFocus().id, .{ .widget = .{ .text_input = description }, .rect = null, .min_size = null });│ │763 } │ │764 │ │791 - try addSubmitButtonLabeled(allocator, &box, if (kind == .patch and record == null) "submit draft" else "submit"); │ │765 + try addSubmitButtonLabeled(allocator, &box, if (supports_drafts and record == null) "submit draft" else "submit"); │ │766 │ │767 box.getFocus().child_id = box.children.keys()[title_field_index]; │ │768 return box; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯