Files
metabuilder/packages/ui_header/seed/scripts/render.lua
JohnDoe6345789 f3b1058d62 feat(ui): Add UI components for header, intro, and user dashboard
- Implemented App Header with lifecycle and rendering scripts.
- Created Intro Section with rendering logic.
- Developed User Dashboard with profile, comments, and chat functionalities.
- Added Admin Panel for user and content management.
- Introduced Application Builder with schemas and workflows.
- Established Super God panel for tenant management.
- Updated metadata and tests for all new components and functionalities.
- Enhanced UI Pages Bundle to include dependencies for all levels.
- Improved permission checks and constants in the permissions package.
2025-12-29 23:31:43 +00:00

53 lines
1.6 KiB
Lua

local M = {}
function M.render(props)
local variant = props.variant or "default"
local bg = variant == "admin" and "bg-sidebar" or "bg-card"
return {
type = "Box",
props = { className = "border-b sticky top-0 z-50 " .. bg },
children = {
{
type = "Container",
props = { className = "flex justify-between items-center h-16 px-4" },
children = {
M.logo_section(props),
M.user_section(props)
}
}
}
}
end
function M.logo_section(props)
return {
type = "Flex",
props = { className = "items-center gap-6" },
children = {
{ type = "Box", props = { className = "w-8 h-8 rounded-lg bg-gradient-to-br from-primary to-accent" } },
{ type = "Typography", props = { variant = "h6", text = props.title or "MetaBuilder" } },
props.showHome and {
type = "Button",
props = { variant = "ghost", text = "Home", onClick = "navigateHome" }
} or nil
}
}
end
function M.user_section(props)
local children = {}
if props.username and props.showBadge then
children[#children + 1] = { type = "Badge", props = { text = props.username } }
end
if props.username and props.showAvatar then
children[#children + 1] = { type = "Avatar", props = { fallback = string.sub(props.username, 1, 1) } }
end
if props.showLogout then
children[#children + 1] = { type = "Button", props = { variant = "ghost", text = "Logout", onClick = "handleLogout" } }
end
return { type = "Flex", props = { className = "items-center gap-2" }, children = children }
end
return M