Files
metabuilder/packages/ui_level2/seed/scripts/profile/render.lua
2025-12-30 13:34:35 +00:00

69 lines
1.3 KiB
Lua

-- Render user profile card
require("profile.types")
local M = {}
---Renders the user profile card with form inputs
---@param ctx RenderContext
---@return UIComponent
function M.render(ctx)
---@type InputProps
local usernameProps = {
label = "Username",
value = ctx.user.username,
disabled = true
}
---@type InputProps
local emailProps = {
label = "Email",
name = "email",
value = ctx.user.email or ""
}
---@type ButtonProps
local saveProps = {
text = "Save Changes",
onClick = "saveProfile"
}
---@type UIComponent
local card = {
type = "Card",
children = {
{
type = "CardHeader",
children = {
{
type = "Icon",
props = {
---@type IconProps
name = "IdCard",
size = "large"
}
},
{ type = "CardTitle", props = { text = "Your Profile" } }
}
},
{
type = "CardContent",
children = {
{
type = "Input",
props = usernameProps
},
{
type = "Input",
props = emailProps
},
{
type = "Button",
props = saveProps
}
}
}
}
}
return card
end
return M