╭ changed ──────╮ │src/ui/Repo.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────╮ │16 pub const Commits = @import("./Repo/Commits.zig"); │ │17 pub const Refs = @import("./Repo/Refs.zig"); │ │18 pub const Issues = @import("./Repo/Issues.zig"); │ │19 +pub const Discussions = @import("./Repo/Discussions.zig");│ │20 pub const Comment = @import("./Repo/Comment.zig"); │ │21 pub const Events = @import("./Repo/Events.zig"); │ │22 pub const Settings = @import("./Settings.zig"); │ ╰──────────────────────────────────────────────────────────────╯ ╭─────────────────────────────╮ │31 commits: Commits, │ │32 refs: Refs, │ │33 issues: Issues, │ │34 +discussions: Discussions,│ │35 events: Events, │ │36 settings: Settings, │ │37 auth: Auth, │ ╰─────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │128 const issues_comments_start: usize = switch (route) { │ │129 .repo_issues => |i| i.comments_start, │ │130 else => 0, │ │131 + }; │ │132 + const discussions_tag: []const u8 = switch (route) { │ │133 + .repo_discussions => |*t| t.tag.slice(), │ │134 + else => "", │ │135 + }; │ │136 + const discussions_selected: []const u8 = switch (route) { │ │137 + .repo_discussions => |*t| t.selected.slice(), │ │138 + else => "", │ │139 + }; │ │140 + const discussions_comment: []const u8 = switch (route) { │ │141 + .repo_discussions => |*t| t.comment.slice(), │ │142 + else => "", │ │143 + }; │ │144 + const discussions_view: ui.RoutablePage.DiscussionsView = switch (route) {│ │145 + .repo_discussions => |t| t.view, │ │146 + else => .all, │ │147 }; │ │148 + const discussions_comments_start: usize = switch (route) { │ │149 + .repo_discussions => |t| t.comments_start, │ │150 + else => 0, │ │151 + }; │ │152 const events_kind: ?evt.EventKind = switch (route) { │ │153 .repo_events => |e| e.kind, │ │154 else => null, │ ╰───────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │203 // route named none), so they end up viewing the same one and either's │ │204 // resolved ref can canonicalize the tab mirror urls below. no filesystem │ │205 // (wasm), nowhere to look, or a failed open: empty tabs. │ │184 - const files, const commits, const refs, var issues, const events = blk: { │ │206 + const files, const commits, const refs, var issues, var discussions, const events = blk: {│ │207 read: { │ │208 const io = session.io orelse break :read; │ │209 const src = source orelse break :read; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │221 try Commits.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, session.haxy_moment, repo_identity.identity, requested_ref_or_oid, requested_ref_value, commits_content), │ │222 try Refs.init(repo_kind, opened.self_repo_opts, arena, opened, io, gpa, repo_identity.identity, refs_kind, refs_from), │ │223 try Issues.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, issues_tag, issues_selected, issues_comment, issues_comments_start, issues_theirs, issues_view), │ │224 + try Discussions.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, discussions_tag, discussions_selected, discussions_comment, discussions_comments_start, discussions_view),│ │225 try Events.init(repo_kind, opened.self_repo_opts, arena, opened, io, session.haxy_moment, repo_identity.identity, events_view, events_kind, events_selected, session.local != null, session.data.sync_failure), │ │226 }; │ │227 }, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │235 try Commits.emptyResult(aa, repo_identity.identity, requested_ref_or_oid orelse .branch, requested_ref_value, commits_content), │ │236 try Refs.emptyResult(arena, repo_identity.identity, refs_kind, refs_from), │ │237 try Issues.emptyResult(aa, repo_identity.identity, issues_tag, issues_selected, issues_comment, issues_comments_start, issues_theirs, issues_view), │ │238 + try Discussions.emptyResult(aa, repo_identity.identity, discussions_tag, discussions_selected, discussions_comment, discussions_comments_start, discussions_view),│ │239 try Events.empty(aa, repo_identity.identity, events_view, session.local != null, session.data.sync_failure), │ │240 }; │ │241 }; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │242 issues.repo_source = source; │ │243 + discussions.repo_source = source; │ │244 │ │245 // each tab mirror carries this page's route for that tab; tabs not targeted│ │246 // by the incoming route fall back to their root/first-page route. the files│ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │261 return .{ │ │262 // files and commits resolve the same ref, so either's serves the header, │ │263 // which points both tabs at it. │ │239 - .header = try Header.init(arena, repo.event.name, owner_name, files.ref_or_oid, files.ref_or_oid_value, issues_tag), │ │264 + .header = try Header.init(arena, repo.event.name, owner_name, files.ref_or_oid, files.ref_or_oid_value, issues_tag, discussions_tag),│ │265 .repo = repo, │ │266 .files = files, │ │267 .commits = commits, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────╮ │268 .refs = refs, │ │269 .issues = issues, │ │270 + .discussions = discussions, │ │271 .events = events, │ │272 .settings = Settings.init(),│ │273 .auth = Auth.init(), │ ╰─────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │330 try stack.children.put(allocator, issues_view.getFocus().id, .{ .repo_issues = issues_view }); │ │331 } │ │332 │ │333 + // discussions and their comment permalinks. │ │334 { │ │335 + var discussions_view = try Discussions.View.init(allocator, &data.discussions, session); │ │336 + errdefer discussions_view.deinit(allocator); │ │337 + try stack.children.put(allocator, discussions_view.getFocus().id, .{ .repo_discussions = discussions_view });│ │338 + } │ │339 + │ │340 + { │ │341 var events_view = try Events.View.init(allocator, &data.events, session); │ │342 errdefer events_view.deinit(allocator); │ │343 try stack.children.put(allocator, events_view.getFocus().id, .{ .repo_events = events_view }); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯