╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Comment.zig│ ╰───────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │222 │ │223 box.getFocus().child_id = box.children.keys()[metadata_index]; │ │224 │ │209 - return .{ .box = box }; │ │225 + return .{ │ │226 + .box = box, │ │227 + .id = idBytes(&entry.id) orelse return error.InvalidEventId,│ │228 + .remove_button_id = remove_button_id, │ │229 + }; │ │230 } │ │231 │ │232 fn metadata(self: *Item) *wgt.Box(ui.Widget) { │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │239 │ │240 pub fn bodyFocused(self: *Item) bool { │ │241 return self.box.getFocus().child_id == self.body().getFocus().id;│ │242 + } │ │243 + │ │244 + pub fn removeFocused(self: *Item) bool { │ │245 + const id = self.remove_button_id orelse return false; │ │246 + return self.metadata().getFocus().child_id == id; │ │247 } │ │248 │ │249 pub fn focusMetadata(self: *Item, root_focus: *Focus) void { │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/ui/Repo/Events.zig│ ╰──────────────────────╯ ╭─────────────────────────────────────╮ │19 pub const Item = struct { │ │20 id: []const u8, │ │21 kind: evt.EventKind, │ │22 - deleted: bool, │ │22 author: ui.Author, │ │23 view_url: ?[]const u8 = null,│ │24 }; │ ╰─────────────────────────────────────╯ ╭────────────────────────────────────╮ │26 pub const Cursor = struct { │ │27 id: []const u8, │ │28 kind: evt.EventKind, │ │29 +}; │ │30 + │ │31 +pub const Window = struct { │ │32 + count: usize = 0, │ │33 + events: []const Item = &.{},│ │34 + next: ?Cursor = null, │ │35 }; │ │36 │ │37 identity: []const u8, │ ╰────────────────────────────────────╯ ╭─────────────────────────────────────╮ │33 -events: []const Item, │ │34 -next: ?Cursor, │ │38 +view: ui.RoutablePage.EventsView,│ │39 +active: Window, │ │40 +removed: Window, │ │41 header: Header, │ │42 │ │43 const Self = @This(); │ ╰─────────────────────────────────────╯ ╭───────────────────────────────────────────────────────╮ │50 io: std.Io, │ │51 admin_moment: ?evt.AdminDB.HashMap(.read_only),│ │52 identity: []const u8, │ │53 + requested_view: ui.RoutablePage.EventsView, │ │54 selected_kind: ?evt.EventKind, │ │55 selected: []const u8, │ │56 local: bool, │ ╰───────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │57 failure: ?[]const u8, │ │58 ) !Self { │ │59 const aa = arena.allocator(); │ │53 - var result = try empty(aa, identity, local, failure); │ │54 - var local_header: ?Header = null; │ │55 - if (local) { │ │56 - const header = try Header.local(repo_kind, repo_opts, aa, repo, io, failure); │ │57 - local_header = header; │ │58 - result.header = try header.withCount(aa, 0); │ │59 - } │ │60 - const strict = selected_kind != null or selected.len != 0; │ │60 + var result = try empty(aa, identity, requested_view, local, failure); │ │61 + if (local) result.header = try Header.local(repo_kind, repo_opts, aa, repo, io, failure);│ │62 + const require_selected_event = selected_kind != null or selected.len != 0; │ │63 if ((selected_kind == null) != (selected.len == 0)) return error.NotFound; │ │64 │ │65 const DB = evt.EventDB(repo_opts.hash); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────╮ │72 return result │ │73 else │ │74 evt.currentMoment(repo_opts, repo)) catch { │ │73 - if (strict) return error.NotFound; │ │75 + if (require_selected_event) return error.NotFound;│ │76 return result; │ │77 }; │ │78 │ ╰──────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │79 const kind_map_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.event_index_key)) orelse {│ │78 - if (strict) return error.NotFound; │ │80 + if (require_selected_event) return error.NotFound; │ │81 return result; │ │82 }; │ │83 const kind_map = try DB.HashMap(.read_only).init(kind_map_cursor); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │82 - const id_set_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.event_id_set_key)) orelse { │ │83 - if (strict) return error.NotFound; │ │84 - return result; │ │85 - }; │ │86 - const id_set = try DB.SortedSet(.read_only).init(id_set_cursor); │ │87 - const count: usize = @intCast(try id_set.count()); │ │88 - if (local_header) |header| │ │89 - result.header = try header.withCount(aa, count) │ │90 - else │ │91 - result.header = try Header.remote(aa, count); │ │84 + │ │85 + const active_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.active_event_id_set_key)); │ │86 + const removed_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.removed_event_id_set_key));│ │87 │ │88 var root_key: ?[@sizeOf(u64) + evt.event_id_size]u8 = null; │ │89 if (selected.len != 0) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯