mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
feat(layout): add flex, grid, section, and stat components for dashboard layout
feat(nav_menu): implement menu item, group, and divider components feat(ui_header): create logo, user, and actions sections for header rendering
This commit is contained in:
11
packages/dashboard/seed/scripts/layout/flex.lua
Normal file
11
packages/dashboard/seed/scripts/layout/flex.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Dashboard flex layout
|
||||
local function flex(direction, gap, align)
|
||||
return {
|
||||
type = "flex",
|
||||
direction = direction or "row",
|
||||
gap = gap or 16,
|
||||
align = align or "stretch"
|
||||
}
|
||||
end
|
||||
|
||||
return flex
|
||||
11
packages/dashboard/seed/scripts/layout/grid.lua
Normal file
11
packages/dashboard/seed/scripts/layout/grid.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Dashboard grid layout
|
||||
local function grid(columns, rows, gap)
|
||||
return {
|
||||
type = "grid",
|
||||
columns = columns or 3,
|
||||
rows = rows,
|
||||
gap = gap or 16
|
||||
}
|
||||
end
|
||||
|
||||
return grid
|
||||
8
packages/dashboard/seed/scripts/layout/init.lua
Normal file
8
packages/dashboard/seed/scripts/layout/init.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Dashboard layout module
|
||||
local layout = {
|
||||
grid = require("layout.grid"),
|
||||
flex = require("layout.flex"),
|
||||
section = require("layout.section")
|
||||
}
|
||||
|
||||
return layout
|
||||
10
packages/dashboard/seed/scripts/layout/section.lua
Normal file
10
packages/dashboard/seed/scripts/layout/section.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
-- Dashboard section layout
|
||||
local function section(title, children)
|
||||
return {
|
||||
type = "section",
|
||||
title = title,
|
||||
children = children or {}
|
||||
}
|
||||
end
|
||||
|
||||
return section
|
||||
12
packages/dashboard/seed/scripts/stats/card.lua
Normal file
12
packages/dashboard/seed/scripts/stats/card.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
-- Dashboard stat card component
|
||||
local function stat_card(title, value, icon, trend)
|
||||
return {
|
||||
type = "stat_card",
|
||||
title = title,
|
||||
value = value,
|
||||
icon = icon,
|
||||
trend = trend
|
||||
}
|
||||
end
|
||||
|
||||
return stat_card
|
||||
8
packages/dashboard/seed/scripts/stats/init.lua
Normal file
8
packages/dashboard/seed/scripts/stats/init.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Dashboard stats module
|
||||
local stats = {
|
||||
card = require("stats.card"),
|
||||
row = require("stats.row"),
|
||||
trend = require("stats.trend")
|
||||
}
|
||||
|
||||
return stats
|
||||
11
packages/dashboard/seed/scripts/stats/row.lua
Normal file
11
packages/dashboard/seed/scripts/stats/row.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Dashboard stat row layout
|
||||
local function stat_row(stats)
|
||||
return {
|
||||
type = "row",
|
||||
layout = "flex",
|
||||
gap = 16,
|
||||
children = stats
|
||||
}
|
||||
end
|
||||
|
||||
return stat_row
|
||||
11
packages/dashboard/seed/scripts/stats/trend.lua
Normal file
11
packages/dashboard/seed/scripts/stats/trend.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Dashboard stat trend indicator
|
||||
local function trend_indicator(direction, value)
|
||||
return {
|
||||
type = "trend",
|
||||
direction = direction, -- "up" or "down"
|
||||
value = value,
|
||||
color = direction == "up" and "success" or "error"
|
||||
}
|
||||
end
|
||||
|
||||
return trend_indicator
|
||||
8
packages/nav_menu/seed/scripts/items/divider.lua
Normal file
8
packages/nav_menu/seed/scripts/items/divider.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Nav menu divider component
|
||||
local function menu_divider()
|
||||
return {
|
||||
type = "divider"
|
||||
}
|
||||
end
|
||||
|
||||
return menu_divider
|
||||
11
packages/nav_menu/seed/scripts/items/group.lua
Normal file
11
packages/nav_menu/seed/scripts/items/group.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Nav menu group component
|
||||
local function menu_group(label, children, icon)
|
||||
return {
|
||||
type = "menu_group",
|
||||
label = label,
|
||||
icon = icon,
|
||||
children = children or {}
|
||||
}
|
||||
end
|
||||
|
||||
return menu_group
|
||||
8
packages/nav_menu/seed/scripts/items/init.lua
Normal file
8
packages/nav_menu/seed/scripts/items/init.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Nav menu items module
|
||||
local items = {
|
||||
item = require("items.item"),
|
||||
group = require("items.group"),
|
||||
divider = require("items.divider")
|
||||
}
|
||||
|
||||
return items
|
||||
11
packages/nav_menu/seed/scripts/items/item.lua
Normal file
11
packages/nav_menu/seed/scripts/items/item.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Nav menu item component
|
||||
local function menu_item(label, path, icon)
|
||||
return {
|
||||
type = "menu_item",
|
||||
label = label,
|
||||
path = path,
|
||||
icon = icon
|
||||
}
|
||||
end
|
||||
|
||||
return menu_item
|
||||
9
packages/ui_header/seed/scripts/render/actions.lua
Normal file
9
packages/ui_header/seed/scripts/render/actions.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Header actions section
|
||||
local function actions_section(actions)
|
||||
return {
|
||||
type = "actions",
|
||||
children = actions or {}
|
||||
}
|
||||
end
|
||||
|
||||
return actions_section
|
||||
8
packages/ui_header/seed/scripts/render/init.lua
Normal file
8
packages/ui_header/seed/scripts/render/init.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Header render module
|
||||
local render = {
|
||||
logo = require("render.logo"),
|
||||
user = require("render.user"),
|
||||
actions = require("render.actions")
|
||||
}
|
||||
|
||||
return render
|
||||
11
packages/ui_header/seed/scripts/render/logo.lua
Normal file
11
packages/ui_header/seed/scripts/render/logo.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Header logo section
|
||||
local function logo_section(logo_url, title)
|
||||
return {
|
||||
type = "logo",
|
||||
url = logo_url or "/logo.svg",
|
||||
title = title or "MetaBuilder",
|
||||
link = "/"
|
||||
}
|
||||
end
|
||||
|
||||
return logo_section
|
||||
26
packages/ui_header/seed/scripts/render/user.lua
Normal file
26
packages/ui_header/seed/scripts/render/user.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
-- Header user section
|
||||
local function user_section(user)
|
||||
if not user then
|
||||
return {
|
||||
type = "auth_buttons",
|
||||
children = {
|
||||
{ type = "button", label = "Login", action = "navigate", path = "/login" },
|
||||
{ type = "button", label = "Sign Up", action = "navigate", path = "/register" }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
type = "user_menu",
|
||||
avatar = user.avatar,
|
||||
name = user.name,
|
||||
items = {
|
||||
{ label = "Profile", path = "/profile" },
|
||||
{ label = "Settings", path = "/settings" },
|
||||
{ type = "divider" },
|
||||
{ label = "Logout", action = "logout" }
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return user_section
|
||||
Reference in New Issue
Block a user