╭ changed ────────────╮ │src/ui/Repo/Files.zig│ ╰─────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │71 // whether the viewed tree has a file index, so the search box shows and a │ │72 // find: route resolves. travels in the page json for the wasm view. │ │73 find_available: bool = false, │ │74 +// the repo's default branch has no commit yet, so the tab shows a placeholder│ │75 +no_commits: bool = false, │ │76 │ │77 const Self = @This(); │ │78 │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │131 // bad url (NotFound -> 404); the default-branch path falls through to empty. │ │132 const resolved = (try ui.ResolvedRefOrOid(repo_kind, repo_opts).init(repo, io, aa, requested_ref_or_oid, requested_value)) orelse {│ │133 if (requested_ref_or_oid != null or term != null) return error.NotFound; │ │132 - return emptyResult(aa, handle, .branch, requested_value, path); │ │134 + var data = try emptyResult(aa, handle, .branch, requested_value, path); │ │135 + data.no_commits = true; │ │136 + return data; │ │137 }; │ │138 │ │139 // read just the viewed directory of that tree or commit. building the │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │360 var outer = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert }); │ │361 errdefer outer.deinit(allocator); │ │362 │ │363 + if (data.no_commits) { │ │364 + var center = try ui.widget.initNoCommits(allocator, session, data.handle); │ │365 + errdefer center.deinit(allocator); │ │366 + outer.getFocus().child_id = center.getFocus().id; │ │367 + try outer.children.put(allocator, center.getFocus().id, .{ .widget = .{ .center = center }, .rect = null, .min_size = null }); │ │368 + return .{ .box = outer, .data = data, .session = session, .shown_index = null }; │ │369 + } │ │370 + │ │371 // the search box and the clone url at the top. local mode has neither. │ │372 if (session.data.host_kind == .server) { │ │373 var header_view = try ui.widget.SearchHeader.init(allocator, session, data.handle, " find file ", "find", data.find, data.find_available);│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │594 │ │595 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │596 self.clearGrid(); │ │597 + if (self.data.no_commits) return self.box.build(allocator, constraint, root_focus); │ │598 │ │599 // swap the detail pane to the selected entry when the selection changes. │ │600 try self.refreshDetail(allocator); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │736 } │ │737 │ │738 pub fn input(self: *View, allocator: std.mem.Allocator, key: Key, root_focus: *Focus) !void {│ │739 + if (self.data.no_commits) return self.box.input(allocator, key, root_focus); │ │740 // scrolling crosses the sub header boundary the same way arrows do │ │741 const direction = inp.vertDirection(key); │ │742 if (self.headerActive()) { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │945 │ │946 // only the header's own row sits directly below the repository header. │ │947 pub fn atTop(self: *View) bool { │ │948 + if (self.data.no_commits) return true; │ │949 const focusable = if (self.header()) |header_view| header_view.hasFocusable() else false;│ │950 return self.headerActive() or (!focusable and self.contentAtTop()); │ │951 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯