╭ changed ─────────╮ │src/ui/NewUser.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │20 │ │21 // `route` is the page's own new-user route, which the web form posts to │ │22 pub fn init(allocator: std.mem.Allocator, session: *ui.Session, route: ui.RoutablePage) !View { │ │23 - var box = try wgt.Box(ui.Widget).init(allocator, .{ .border_style = null, .direction = .vert }); │ │23 + var box = try wgt.Box(ui.Widget).init(allocator, .{ .border = null, .direction = .vert }); │ │24 errdefer box.deinit(allocator); │ │25 box.getFocus().kind = .{ .custom = try session.page_arena.allocator().print("form:{s}", .{try route.toUrl(session.page_arena)}) };│ │26 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │27 const saved_fields = if (session.formFeedback(.user)) |saved| saved.fields else null; │ │28 │ │29 { │ │30 - var name = try wgt.TextInput.init(allocator, .{ .label = " name ", .name = "name", .visible_width = 30, .round_corners = true, .render_content = session.is_terminal }); │ │30 + var name = try wgt.TextInput.init(allocator, .{ .top_label = .{ .text = " name " }, .name = "name", .visible_width = 30, .round_corners = true, .render_content = session.is_terminal });│ │31 errdefer name.deinit(allocator); │ │32 name.getFocus().mode = .all; │ │33 if (saved_fields) |saved| try name.setContent(allocator, saved.name); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │36 } │ │37 │ │38 { │ │39 - var email = try wgt.TextInput.init(allocator, .{ .label = " email ", .name = "email", .visible_width = 30, .round_corners = true, .render_content = session.is_terminal }); │ │39 + var email = try wgt.TextInput.init(allocator, .{ .top_label = .{ .text = " email " }, .name = "email", .visible_width = 30, .round_corners = true, .render_content = session.is_terminal });│ │40 errdefer email.deinit(allocator); │ │41 email.getFocus().mode = .all; │ │42 if (saved_fields) |saved| try email.setContent(allocator, saved.email); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │44 } │ │45 │ │46 { │ │47 - var password = try wgt.TextInput.init(allocator, .{ .label = " password ", .password = true, .name = "password", .visible_width = 30, .round_corners = true, .render_content = session.is_terminal }); │ │47 + var password = try wgt.TextInput.init(allocator, .{ .top_label = .{ .text = " password " }, .password = true, .name = "password", .visible_width = 30, .round_corners = true, .render_content = session.is_terminal });│ │48 errdefer password.deinit(allocator); │ │49 password.getFocus().mode = .all; │ │50 try box.children.put(allocator, password.getFocus().id, .{ .widget = .{ .text_input = password }, .rect = null, .min_size = .{ .width = null, .height = 3 } }); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │51 } │ │52 │ │53 { │ │54 - var password_again = try wgt.TextInput.init(allocator, .{ .label = " password again ", .password = true, .name = "password_again", .visible_width = 30, .round_corners = true, .render_content = session.is_terminal }); │ │54 + var password_again = try wgt.TextInput.init(allocator, .{ .top_label = .{ .text = " password again " }, .password = true, .name = "password_again", .visible_width = 30, .round_corners = true, .render_content = session.is_terminal });│ │55 errdefer password_again.deinit(allocator); │ │56 password_again.getFocus().mode = .all; │ │57 try box.children.put(allocator, password_again.getFocus().id, .{ .widget = .{ .text_input = password_again }, .rect = null, .min_size = .{ .width = null, .height = 3 } }); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │73 pub fn build(self: *View, allocator: std.mem.Allocator, constraint: layout.Constraint, root_focus: *Focus) !void {│ │74 self.clearGrid(); │ │75 const failure = if (self.session.formFeedback(.user)) |saved| saved.failure else null; │ │76 - (try formField(self.formBox(), "name")).options.label = if (failure) |value| switch (value) { │ │76 + (try formField(self.formBox(), "name")).options.top_label.text = if (failure) |value| switch (value) { │ │77 .required_name => " name (required) ", │ │78 .invalid_name => " name (invalid) ", │ │79 .name_taken => " name (taken) ", │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │80 else => " name ", │ │81 } else " name "; │ │82 - (try formField(self.formBox(), "email")).options.label = if (failure) |value| switch (value) { │ │82 + (try formField(self.formBox(), "email")).options.top_label.text = if (failure) |value| switch (value) {│ │83 .required_email => " email (required) ", │ │84 .email_taken => " email (taken) ", │ │85 else => " email ", │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │86 } else " email "; │ │87 - (try formField(self.formBox(), "password")).options.label = if (failure == .required_password) " password (required) " else " password "; │ │88 - (try formField(self.formBox(), "password_again")).options.label = if (failure == .password_mismatch) " password again (doesn't match) " else " password again "; │ │87 + (try formField(self.formBox(), "password")).options.top_label.text = if (failure == .required_password) " password (required) " else " password "; │ │88 + (try formField(self.formBox(), "password_again")).options.top_label.text = if (failure == .password_mismatch) " password again (doesn't match) " else " password again ";│ │89 // the web form handling finds the inputs by focus id │ │90 const inputs_arena = self.session.arena.allocator(); │ │91 for (self.formBox().children.values()) |*child| switch (child.widget) { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯