╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────╮ │25 pub const RoutablePage = enum { │ │26 home_users, │ │27 home_repos, │ │28 + home_ansi, │ │29 home_auth, │ │30 │ │31 pub const default: RoutablePage = .home_users;│ ╰──────────────────────────────────────────────────────╯ ╭────────────────────────────────────────╮ │34 return switch (self) { │ │35 .home_users => "/users",│ │36 .home_repos => "/repos",│ │37 + .home_ansi => "/ansi", │ │38 .home_auth => "/auth", │ │39 }; │ │40 } │ ╰────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────╮ │43 if (std.mem.eql(u8, path, "/")) return default; │ │44 if (std.mem.eql(u8, path, "/users")) return .home_users;│ │45 if (std.mem.eql(u8, path, "/repos")) return .home_repos;│ │46 + if (std.mem.eql(u8, path, "/ansi")) return .home_ansi; │ │47 if (std.mem.eql(u8, path, "/auth")) return .home_auth; │ │48 return null; │ │49 } │ ╰────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │61 // a transient outcome to surface from the last /login POST attempt│ │62 login_failure: ?Home.Auth.Login.Failure = null, │ │63 current_page: RoutablePage = .default, │ │64 + // whether to render the ANSI art backdrop │ │65 + enable_ansi: bool = false, │ │66 }; │ │67 │ │68 pub fn init( │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │180 │ │181 const demon_art = @embedFile("embed/demon.ans"); │ │182 │ │178 - var root = Widget{ .background = try AnsiBackground.init(allocator, page_widget, demon_art) }; │ │183 + var root = Widget{ .background = try AnsiBackground.init(allocator, page_widget, demon_art, session) };│ │184 errdefer root.deinit(allocator); │ │185 │ │186 try root.build(allocator, .{ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │212 home_users: Home.Users.View, │ │213 home_repos: Home.Repos.View, │ │214 home_auth_tab: Home.Header.AuthTab.View, │ │215 + home_ansi: Home.Ansi.View, │ │216 home_auth: Home.Auth.View, │ │217 │ │218 pub fn deinit(self: *Widget, allocator: std.mem.Allocator) void {│ ╰──────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │819 grid: ?Grid, │ │820 child: *Widget, │ │821 art: AnsiArt, │ │822 + session: *Session, │ │823 │ │817 - pub fn init(allocator: std.mem.Allocator, child_widget: Widget, art_content: []const u8) !AnsiBackground { │ │824 + pub fn init(allocator: std.mem.Allocator, child_widget: Widget, art_content: []const u8, session: *Session) !AnsiBackground {│ │825 var cw = child_widget; │ │826 const child = allocator.create(Widget) catch |e| { │ │827 cw.deinit(allocator); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │828 return e; │ │829 }; │ │830 child.* = cw; │ │824 - return .{ .grid = null, .child = child, .art = AnsiArt.init(art_content) }; │ │831 + return .{ .grid = null, .child = child, .art = AnsiArt.init(art_content), .session = session };│ │832 } │ │833 │ │834 pub fn deinit(self: *AnsiBackground, allocator: std.mem.Allocator) void { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │850 .max_size = constraint.max_size, │ │851 }, root_focus); │ │852 │ │846 - if (self.child.getGrid()) |fg| { │ │847 - self.grid = try artBehind(allocator, fg, &self.art, .top_right, root_focus); │ │853 + if (self.session.data.enable_ansi) { │ │854 + if (self.child.getGrid()) |fg| { │ │855 + self.grid = try artBehind(allocator, fg, &self.art, .top_right, root_focus);│ │856 + } │ │857 } │ │858 } │ │859 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯