mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
config: dialog,packages,lua (5 files)
This commit is contained in:
70
packages/admin_dialog/scripts/action_dialog.lua
Normal file
70
packages/admin_dialog/scripts/action_dialog.lua
Normal file
@@ -0,0 +1,70 @@
|
||||
-- admin_dialog: Action Dialog Component
|
||||
-- Multi-purpose dialog for admin actions with custom buttons
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.render(context)
|
||||
local dialog = context.dialog or {
|
||||
title = "Admin Action",
|
||||
message = "Select an action to perform",
|
||||
actions = {
|
||||
{ text = "Approve", action = "admin.action.approve", variant = "primary" },
|
||||
{ text = "Reject", action = "admin.action.reject", variant = "danger" },
|
||||
{ text = "Review Later", action = "admin.action.defer", variant = "secondary" }
|
||||
}
|
||||
}
|
||||
|
||||
local actionButtons = {}
|
||||
for _, actionDef in ipairs(dialog.actions) do
|
||||
local buttonClass = "button admin_dialog_button_" .. (actionDef.variant or "default")
|
||||
table.insert(actionButtons, {
|
||||
type = "button",
|
||||
className = buttonClass,
|
||||
text = actionDef.text,
|
||||
action = actionDef.action,
|
||||
data = actionDef.data
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
type = "div",
|
||||
className = "admin_dialog_overlay",
|
||||
children = {
|
||||
{
|
||||
type = "div",
|
||||
className = "card admin_dialog",
|
||||
children = {
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_header",
|
||||
children = {
|
||||
{
|
||||
type = "h3",
|
||||
className = "admin_dialog_title",
|
||||
text = dialog.title
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_body",
|
||||
children = {
|
||||
{
|
||||
type = "p",
|
||||
className = "admin_dialog_message",
|
||||
text = dialog.message
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_footer admin_dialog_footer_multi",
|
||||
children = actionButtons
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
71
packages/admin_dialog/scripts/confirm_dialog.lua
Normal file
71
packages/admin_dialog/scripts/confirm_dialog.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
-- admin_dialog: Confirmation Dialog Component
|
||||
-- Standard confirmation dialog for admin actions
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.render(context)
|
||||
local dialog = context.dialog or {
|
||||
title = "Confirm Action",
|
||||
message = "Are you sure you want to proceed?",
|
||||
confirmText = "Confirm",
|
||||
cancelText = "Cancel",
|
||||
variant = "warning"
|
||||
}
|
||||
|
||||
local variantClass = "admin_dialog_" .. (dialog.variant or "default")
|
||||
|
||||
return {
|
||||
type = "div",
|
||||
className = "admin_dialog_overlay",
|
||||
children = {
|
||||
{
|
||||
type = "div",
|
||||
className = "card admin_dialog " .. variantClass,
|
||||
children = {
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_header",
|
||||
children = {
|
||||
{
|
||||
type = "h3",
|
||||
className = "admin_dialog_title",
|
||||
text = dialog.title
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_body",
|
||||
children = {
|
||||
{
|
||||
type = "p",
|
||||
className = "admin_dialog_message",
|
||||
text = dialog.message
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_footer",
|
||||
children = {
|
||||
{
|
||||
type = "button",
|
||||
className = "button admin_dialog_button_cancel",
|
||||
text = dialog.cancelText,
|
||||
action = "admin.dialog.cancel"
|
||||
},
|
||||
{
|
||||
type = "button",
|
||||
className = "button admin_dialog_button_confirm",
|
||||
text = dialog.confirmText,
|
||||
action = "admin.dialog.confirm"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
89
packages/admin_dialog/scripts/delete_confirm.lua
Normal file
89
packages/admin_dialog/scripts/delete_confirm.lua
Normal file
@@ -0,0 +1,89 @@
|
||||
-- admin_dialog: Delete Confirmation Dialog Component
|
||||
-- Specialized dialog for destructive delete actions
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.render(context)
|
||||
local item = context.item or {
|
||||
type = "item",
|
||||
name = "Unknown Item"
|
||||
}
|
||||
|
||||
return {
|
||||
type = "div",
|
||||
className = "admin_dialog_overlay",
|
||||
children = {
|
||||
{
|
||||
type = "div",
|
||||
className = "card admin_dialog admin_dialog_danger",
|
||||
children = {
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_header",
|
||||
children = {
|
||||
{
|
||||
type = "h3",
|
||||
className = "admin_dialog_title",
|
||||
text = "⚠️ Confirm Delete"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_body",
|
||||
children = {
|
||||
{
|
||||
type = "p",
|
||||
className = "admin_dialog_message",
|
||||
text = "You are about to permanently delete:"
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_item_info",
|
||||
children = {
|
||||
{
|
||||
type = "strong",
|
||||
text = item.name
|
||||
},
|
||||
{
|
||||
type = "p",
|
||||
className = "admin_dialog_warning",
|
||||
text = "This action cannot be undone!"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "input",
|
||||
className = "input admin_dialog_confirm_input",
|
||||
name = "confirmText",
|
||||
placeholder = "Type 'DELETE' to confirm",
|
||||
required = true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "admin_dialog_footer",
|
||||
children = {
|
||||
{
|
||||
type = "button",
|
||||
className = "button admin_dialog_button_cancel",
|
||||
text = "Cancel",
|
||||
action = "admin.dialog.cancel"
|
||||
},
|
||||
{
|
||||
type = "button",
|
||||
className = "button admin_dialog_button_danger",
|
||||
text = "Delete Permanently",
|
||||
action = "admin.dialog.delete",
|
||||
data = { itemId = item.id, itemType = item.type }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -14,6 +14,11 @@
|
||||
"lua_test"
|
||||
],
|
||||
"exports": {
|
||||
"scripts": [
|
||||
"confirm_dialog",
|
||||
"delete_confirm",
|
||||
"action_dialog"
|
||||
],
|
||||
"components": []
|
||||
},
|
||||
"tests": {
|
||||
@@ -42,6 +47,19 @@
|
||||
"styles": "seed/styles.json"
|
||||
},
|
||||
"storybook": {
|
||||
"stories": []
|
||||
"stories": [
|
||||
{
|
||||
"name": "Confirm Dialog",
|
||||
"render": "confirm_dialog"
|
||||
},
|
||||
{
|
||||
"name": "Delete Confirmation",
|
||||
"render": "delete_confirm"
|
||||
},
|
||||
{
|
||||
"name": "Action Dialog",
|
||||
"render": "action_dialog"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
108
packages/stream_cast/scripts/stream_schedule.lua
Normal file
108
packages/stream_cast/scripts/stream_schedule.lua
Normal file
@@ -0,0 +1,108 @@
|
||||
-- stream_cast: Stream Schedule Component
|
||||
-- Manage streaming schedule and upcoming broadcasts
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.render(context)
|
||||
local schedules = context.schedules or {
|
||||
{ id = 1, title = "Morning Gaming Session", date = "2025-01-02", time = "09:00", duration = "3h", recurring = true },
|
||||
{ id = 2, title = "Tutorial Series Ep. 5", date = "2025-01-03", time = "14:00", duration = "2h", recurring = false },
|
||||
{ id = 3, title = "Community Q&A", date = "2025-01-04", time = "18:00", duration = "1h", recurring = true },
|
||||
{ id = 4, title = "Special Event Stream", date = "2025-01-05", time = "20:00", duration = "4h", recurring = false }
|
||||
}
|
||||
|
||||
local user = context.user or {}
|
||||
local canManageSchedule = user.level and user.level >= 3
|
||||
|
||||
local scheduleItems = {}
|
||||
for _, schedule in ipairs(schedules) do
|
||||
table.insert(scheduleItems, {
|
||||
type = "div",
|
||||
className = "card stream_cast_schedule_item",
|
||||
children = {
|
||||
{
|
||||
type = "div",
|
||||
className = "stream_cast_schedule_header",
|
||||
children = {
|
||||
{
|
||||
type = "h4",
|
||||
className = "stream_cast_schedule_title",
|
||||
text = schedule.title
|
||||
},
|
||||
{
|
||||
type = "span",
|
||||
className = "stream_cast_schedule_badge",
|
||||
text = schedule.recurring and "♻️ Recurring" or "📅 One-time"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "stream_cast_schedule_details",
|
||||
children = {
|
||||
{
|
||||
type = "span",
|
||||
text = "📆 " .. schedule.date
|
||||
},
|
||||
{
|
||||
type = "span",
|
||||
text = "🕐 " .. schedule.time
|
||||
},
|
||||
{
|
||||
type = "span",
|
||||
text = "⏱️ " .. schedule.duration
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "stream_cast_schedule_actions",
|
||||
children = {
|
||||
{
|
||||
type = "button",
|
||||
className = "button stream_cast_button_small",
|
||||
text = "Edit",
|
||||
action = "stream.schedule.edit",
|
||||
data = { scheduleId = schedule.id },
|
||||
disabled = not canManageSchedule
|
||||
},
|
||||
{
|
||||
type = "button",
|
||||
className = "button stream_cast_button_small",
|
||||
text = "Delete",
|
||||
action = "stream.schedule.delete",
|
||||
data = { scheduleId = schedule.id },
|
||||
disabled = not canManageSchedule
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
type = "div",
|
||||
className = "stream_cast_schedule",
|
||||
children = {
|
||||
{
|
||||
type = "h2",
|
||||
className = "stream_cast_heading",
|
||||
text = "Stream Schedule"
|
||||
},
|
||||
{
|
||||
type = "div",
|
||||
className = "stream_cast_schedule_list",
|
||||
children = scheduleItems
|
||||
},
|
||||
{
|
||||
type = "button",
|
||||
className = "button stream_cast_button_primary",
|
||||
text = "+ Add Stream",
|
||||
action = "stream.schedule.create",
|
||||
disabled = not canManageSchedule
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user