update: ui,profile,packages (1 files)

This commit is contained in:
Richard Ward
2025-12-30 12:41:03 +00:00
parent 3903d6d5e3
commit 3c2ec7736d

View File

@@ -1,51 +1,3 @@
-- Profile component module
---@class UIComponent
---@field type string
---@field props? table
---@field children? UIComponent[]
---@class RenderContext
---@field user table
---@field user.username string
---@field user.email? string
---@class FormData
---@field email string
---@class ProfileResponse
---@field success boolean
---@field action string
---@field email string
---@type table
local M = {}
---Renders the user profile card with form inputs
---@param ctx RenderContext
---@return UIComponent
function M.render(ctx)
return {
type = "Card",
children = {
{ type = "CardHeader", children = { { type = "CardTitle", props = { text = "Your Profile" } } } },
{
type = "CardContent",
children = {
{ type = "Input", props = { label = "Username", value = ctx.user.username, disabled = true } },
{ type = "Input", props = { label = "Email", name = "email", value = ctx.user.email or "" } },
{ type = "Button", props = { text = "Save Changes", onClick = "saveProfile" } }
}
}
}
}
end
---Processes profile form submission and returns response
---@param form FormData
---@return ProfileResponse
function M.saveProfile(form)
return { success = true, action = "update_profile", email = form.email }
end
return M
-- Profile module redirect
-- Functions split into profile/ directory for 1-function-per-file pattern
return require("profile.init")