╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ thread.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
2921 if (comptime wasm) return; 2922 const actor = (try self.session.authorize(self.data.identity, .read)) orelse return; 2923 const author = actor.author; 2924 2925 if (comptime supports_drafts) { 2926 const selected = self.data.selectedThread() orelse return; 2927 if (event_kind == kind and entryDraft(selected.*)) { 2928 try Data.removeDraft(self.session, allocator, author, &id); 2929 const route = draftsRoute(self.data.identity) orelse return; 2930 try self.session.navigate(route); 2931 return; 2932 } 2933 } 2934 2935 const io = self.session.io orelse return; 2936 const src = self.data.repo_source orelse return; 2937 if (!try src.canModify(io, allocator, actor, event_kind, &id)) return; 2938 2939 switch (src.repo_kind) { 2940 inline else => |repo_kind| { 2941 var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, src.localInitOpts()); 2942 defer any_repo.deinit(io, allocator); 2943 switch (any_repo) { 2944 inline else => |*repo| try evt.remove(self.session.data.host_kind, .repo, repo_kind, repo.self_repo_opts, io, allocator, repo, &id, event_kind, author), 2945 } 2946 }, 2947 } 2948 2949 const id_hex = std.fmt.bytesToHex(id, .lower); 2950 const route = ui.RoutablePage.repoEventsRoute(self.data.identity, .removed, event_kind, &id_hex, null) orelse return; 2951 try self.session.navigate(route); 2952 } 2953 2954 // return to the list. 2955 fn focusList(self: *This, index: usize, root_focus: *Focus) void { 2956 root_focus.setFocus(self.listScroll(index).getFocus().id); 2957 } 2958 2959 // cross to the header tabs above the stack. 2960 fn focusHeader(self: *This, root_focus: *Focus) void { 2961 root_focus.setFocus(self.box.children.keys()[header_index]); 2962 } 2963 2964 pub fn clearGrid(self: *This) void { 2965 self.box.clearGrid(); 2966 } 2967 2968 pub fn getGrid(self: This) ?Grid { 2969 return self.box.getGrid(); 2970 } 2971 2972 pub fn getFocus(self: *This) *Focus { 2973 return self.box.getFocus(); 2974 } 2975 2976 // for the parent's "scroll up at the top jumps to the header" check: at the 2977 // top only while the header tabs hold focus, so up from the split 2978 // crosses into the tabs first. 2979 pub fn atTop(self: *This) bool { 2980 return self.headerActive(); 2981 } 2982 }; 2983 } 2984