╭ changed ─────────────╮ │src/ui/Fork/Header.zig│ ╰──────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │35 tab_ids: std.AutoArrayHashMapUnmanaged(usize, void), │ │36 tabs_id: usize, │ │37 first_group_width: usize, │ │38 + session: *ui.Session, │ │39 │ │40 pub fn init(allocator: std.mem.Allocator, data: *const Self, commit_count: ?u64, session: *ui.Session) !View { │ │41 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = .hidden, .rounded_corners = true, .direction = .horiz });│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │57 const commits_label = if (commit_count) |count| try std.fmt.allocPrint(aa, "commits ({d})", .{count}) else "commits";│ │58 var first_group_width = try data.title.width(); │ │59 │ │60 + try ui.widget.addBackButton(allocator, &title_box, session); │ │61 + │ │62 // the user's name links to their page. │ │63 { │ │64 var text_buf: [evt.User.name_max_len + 1]u8 = undefined; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────╮ │169 .tab_ids = tab_ids, │ │170 .tabs_id = tabs_id, │ │171 .first_group_width = first_group_width,│ │172 + .session = session, │ │173 }; │ │174 } │ │175 │ ╰────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │181 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │182 self.clearGrid(); │ │183 const box = &self.scroll.child.box; │ │184 + const back_visible = self.session.back == .available; │ │185 + ui.widget.setBackButtonVisible(box, back_visible); │ │186 const tabs_child = self.tabsChild(); │ │187 const tabs_box = &tabs_child.widget.box; │ │188 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │203 │ │204 const viewport_width = constraint.max_size.width orelse constraint.min_size.width; │ │205 const content_width = if (viewport_width) |width| width -| 2 else null; │ │200 - const wrap = if (content_width) |width| self.first_group_width + tabs_width > width else false; │ │206 + const back_width: usize = if (back_visible) ui.widget.back_button_width else 0; │ │207 + const wrap = if (content_width) |width| self.first_group_width + back_width + tabs_width > width else false;│ │208 box.options.direction = if (wrap) .vert else .horiz; │ │209 tabs_child.min_size = if (wrap) .{ .width = content_width, .height = null } else null; │ │210 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯