╭ changed ╮ │README.md│ ╰─────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │63 ``` │ │64 │ │65 After that, you'll see your repo in `server/repos/test`. It's MAGIC! │ │66 + │ │67 +To get an early look at the interface, you can run `zig build try`. This is a special build command that runs a server with fake data and launches the TUI.│ │68 │ │69 *"C'mon Alex! You always dreamt about going on a big adventure! Let this be our first!" -- Lunar: Silver Star Story* │ │70 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────────────╮ │src/assets/index.html│ ╰─────────────────────╯ ╭───────────────────────────────────────────────────╮ │29 </head> │ │30 <body> │ │31 <div id="grid">{{{ HAXY_CONTENT }}}</div>│ │32 - <script src="script.js"></script> │ │32 + <!-- script src="script.js"></script --> │ │33 </body> │ │34 </html> │ │35 │ ╰───────────────────────────────────────────────────╯ ╭ changed ──────╮ │src/command.zig│ ╰───────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │212 if (cmd_args.get("--data-dir")) |val_maybe| { │ │213 options.data_dir = val_maybe orelse return error.DataDirNeedsValue;│ │214 } │ │215 - if (cmd_args.contains("--tui")) options.tui = true; │ │215 │ │216 return .{ .serve = options }; │ │217 }, │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──╮ │src/lib.zig│ ╰───────────╯ ╭────────────────────────────────────────────╮ │2 pub const main = @import("./main.zig"); │ │3 pub const event = @import("./event.zig");│ │4 pub const serve = @import("./serve.zig");│ │5 +pub const page = @import("./page.zig"); │ │6 +pub const ui = @import("./ui.zig"); │ │7 │ ╰────────────────────────────────────────────╯ ╭ changed ───╮ │src/main.zig│ ╰────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │77 }, │ │78 .help => |cmd_kind_maybe| try cmd.printHelp(cmd_kind_maybe, run_opts.out), │ │79 .cli => |cli_cmd| switch (cli_cmd) { │ │80 - .serve => |options| try srv.run(repo_kind, any_repo_opts, io, allocator, cwd_path, options, run_opts.err), │ │80 + .serve => |options| try srv.run(repo_kind, any_repo_opts, io, allocator, cwd_path, options, run_opts.err, {}),│ │81 .ssh_helper => |options| try ssh.run(io, allocator, options, run_opts.environ_map), │ │82 }, │ │83 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────────╮ │src/main_wasm.zig│ ╰─────────────────╯ ╭──────────────────────────────────────╮ │1 const std = @import("std"); │ │2 const ui = @import("./ui.zig"); │ │3 +const pg = @import("./page.zig"); │ │4 const xitui = @import("xit").xitui;│ │5 const inp = xitui.input; │ │6 │ ╰──────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │14 defer allocator.free(html); │ │15 setHtml(html); │ │16 } │ │17 + │ │18 +// TODO: receive the Page as json from the host and parse it back into │ │19 +// a Page so initRoot can render real data. for now we initialize with │ │20 +// an empty page just so the wasm build compiles. │ │21 +var page_maybe: ?pg.Page = null; │ │22 │ │23 fn start() !void { │ │18 - var next_root = try ui.initRoot(allocator); │ │24 + const page = page_maybe orelse pg.Page{ .user_repo = pg.UserRepoPage.empty() };│ │25 + │ │26 + var next_root = try ui.initRoot(allocator, &page); │ │27 errdefer next_root.deinit(); │ │28 │ │29 if (root) |*old_root| old_root.deinit(); │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────╮ │src/serve.zig│ ╰─────────────╯ ╭──────────────────────────────────────────────────╮ │10 ssh_listen: []const u8 = "127.0.0.1:8081",│ │11 wui_listen: []const u8 = "127.0.0.1:8082",│ │12 data_dir: []const u8 = ".", │ │13 - tui: bool = false, │ │13 }; │ │14 │ │15 const ListenAddress = struct { │ ╰──────────────────────────────────────────────────╯ ╭──────────────────────────────╮ │25 cwd_path: []const u8, │ │26 options: Options, │ │27 err: *std.Io.Writer, │ │28 + runnable: anytype, │ │29 ) !void { │ │30 // create the data dir│ │31 │ ╰──────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │41 defer allocator.free(repo_root_path); │ │42 │ │43 try std.Io.Dir.cwd().createDirPath(io, repo_root_path); │ │44 + │ │45 + // the admin repo path is where the user/repo metadata events live; │ │46 + // web.zig opens it per request to render the server-side TUI │ │47 + │ │48 + const admin_repo_path = try std.fs.path.resolve(allocator, &.{ data_dir_path, "admin" });│ │49 + defer allocator.free(admin_repo_path); │ │50 │ │51 // create http listener │ │52 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯