╭ changed ───────────────────╮ │src/ui/UserNotifications.zig│ ╰────────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │79 const repos_label = "view repos"; │ │80 const logout_label = "logout"; │ │81 │ │82 -// the notifications, user settings and ssh keys sub tabs over their content, with the logout button across from them │ │82 +// the notifications, user settings, ssh keys and delete sub tabs over their content, with the logout button across from them│ │83 pub const View = struct { │ │84 box: wgt.Box(ui.Widget), │ │85 data: *const Self, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │86 session: *ui.Session, │ │87 // the sub tabs' ids then the repos and logout buttons', in header order│ │88 - control_ids: [5]usize, │ │88 + control_ids: [6]usize, │ │89 // the sub tab whose content shows │ │90 view_index: usize, │ │91 │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 92 const header_index = 0; │ │ 93 const content_index = 1; │ │ 94 // the sub tabs come first in `control_ids` │ │ 95 - const tab_count = 3; │ │ 96 - const repos_index = 3; │ │ 97 - const logout_index = 4; │ │ 95 + const tab_count = 4; │ │ 96 + const repos_index = 4; │ │ 97 + const logout_index = 5; │ │ 98 │ │ 99 // `user_route` is the page's user tab route │ │100 pub fn init(allocator: std.mem.Allocator, data: *const Self, session: *ui.Session, user_route: ui.RoutablePage) !View {│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │101 var box = try wgt.Box(ui.Widget).init(allocator, .{ .border = null, .direction = .vert });│ │102 errdefer box.deinit(allocator); │ │103 │ │104 - var control_ids: [5]usize = undefined; │ │104 + var control_ids: [6]usize = undefined; │ │105 const settings_route = user_route.withUserTab(.{ .view = .settings }); │ │106 const keys_route = user_route.withUserTab(.{ .view = .keys }); │ │107 + const delete_route = user_route.withUserTab(.{ .view = .delete }); │ │108 { │ │109 var header_scroll = try ui.widget.HeaderScroll.init(allocator, session); │ │110 errdefer header_scroll.deinit(allocator); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │111 const header = header_scroll.row(); │ │112 const on_tab = std.meta.activeTag(session.data.current_page) == std.meta.activeTag(user_route); │ │112 - const routes = [_]ui.RoutablePage{ user_route.withUserTab(.{}), settings_route, keys_route }; │ │113 - for ([_]ui.RoutablePage.UserView{ .notifications, .settings, .keys }, [_][]const u8{ "notifications", "user settings", "ssh keys" }, routes, 0..) |view, label, route, index| { │ │113 + const routes = [_]ui.RoutablePage{ user_route.withUserTab(.{}), settings_route, keys_route, delete_route }; │ │114 + for ([_]ui.RoutablePage.UserView{ .notifications, .settings, .keys, .delete }, [_][]const u8{ "notifications", "user settings", "ssh keys", "delete user" }, routes, 0..) |view, label, route, index| {│ │115 var tab = try wgt.TextBox.init(allocator, label, .{ .border = .hidden, .round_corners = true, .wrap_kind = .none }); │ │116 errdefer tab.deinit(allocator); │ │117 tab.getFocus().mode = .all; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │194 errdefer keys.deinit(allocator); │ │195 try stack.children.put(allocator, keys.getFocus().id, .{ .user_keys = keys }); │ │196 } │ │197 + { │ │198 + var delete = try ui.Delete.View.init(allocator, .{ .target = .{ .user = session.data.user_name orelse unreachable } }, session, delete_route);│ │199 + errdefer delete.deinit(allocator); │ │200 + try stack.children.put(allocator, delete.getFocus().id, .{ .delete_form = delete }); │ │201 + } │ │202 stack.getFocus().child_id = stack.children.keys()[@backingInt(data.view)]; │ │203 try box.children.put(allocator, stack.getFocus().id, .{ .widget = .{ .stack = stack }, .rect = null, .min_size = null }); │ │204 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯