From 3a8b9694bc3545969a06e01bd5e1966f82a4eab3 Mon Sep 17 00:00:00 2001 From: Richard Ward Date: Tue, 30 Dec 2025 12:30:39 +0000 Subject: [PATCH] code: tsx,nextjs,frontends (20 files) --- .../auth/god-credentials/Summary.tsx | 2 +- .../auth/unified-login/LoginForm.tsx | 2 +- .../auth/unified-login/ProviderList.tsx | 2 +- .../src/components/editors/CodeEditor.tsx | 2 +- .../src/components/editors/JsonEditor.tsx | 2 +- .../src/components/editors/json/Toolbar.tsx | 2 +- .../lua-editor/code/LuaCodeEditorSection.tsx | 2 +- .../components/level/level3/CommentsTable.tsx | 2 +- .../components/level/level3/Level3Stats.tsx | 2 +- .../src/components/level/level3/UserTable.tsx | 2 +- .../level/level5/Level5Navigator.tsx | 2 +- .../level/level5/TransferConfirmDialog.tsx | 2 +- .../src/components/level/levels/Level2.tsx | 2 +- .../src/components/level/levels/Level3.tsx | 2 +- packages/ui_level6/seed/scripts/tenants.lua | 84 +------------------ .../scripts/tenants/create_tenant_form.lua | 29 +++++++ .../ui_level6/seed/scripts/tenants/init.lua | 10 +++ .../seed/scripts/tenants/tenant_card.lua | 32 +++++++ .../seed/scripts/tenants/tenant_list.lua | 27 ++++++ .../ui_level6/seed/scripts/tenants/types.lua | 39 +++++++++ 20 files changed, 154 insertions(+), 95 deletions(-) create mode 100644 packages/ui_level6/seed/scripts/tenants/create_tenant_form.lua create mode 100644 packages/ui_level6/seed/scripts/tenants/init.lua create mode 100644 packages/ui_level6/seed/scripts/tenants/tenant_card.lua create mode 100644 packages/ui_level6/seed/scripts/tenants/tenant_list.lua create mode 100644 packages/ui_level6/seed/scripts/tenants/types.lua diff --git a/frontends/nextjs/src/components/auth/god-credentials/Summary.tsx b/frontends/nextjs/src/components/auth/god-credentials/Summary.tsx index 756e46d25..70198120a 100644 --- a/frontends/nextjs/src/components/auth/god-credentials/Summary.tsx +++ b/frontends/nextjs/src/components/auth/god-credentials/Summary.tsx @@ -1,4 +1,4 @@ -import { CheckCircle, WarningCircle } from '@phosphor-icons/react' +import { CheckCircle, WarningCircle } from '@/fakemui/icons' import { Alert, AlertDescription, Badge } from '@/components/ui' diff --git a/frontends/nextjs/src/components/auth/unified-login/LoginForm.tsx b/frontends/nextjs/src/components/auth/unified-login/LoginForm.tsx index a6ca54734..6e3972623 100644 --- a/frontends/nextjs/src/components/auth/unified-login/LoginForm.tsx +++ b/frontends/nextjs/src/components/auth/unified-login/LoginForm.tsx @@ -1,4 +1,4 @@ -import { SignIn } from '@phosphor-icons/react' +import { SignIn } from '@/fakemui/icons' import { Alert, AlertDescription, Button, Input, Label } from '@/components/ui' diff --git a/frontends/nextjs/src/components/auth/unified-login/ProviderList.tsx b/frontends/nextjs/src/components/auth/unified-login/ProviderList.tsx index 0902531a9..eda46c333 100644 --- a/frontends/nextjs/src/components/auth/unified-login/ProviderList.tsx +++ b/frontends/nextjs/src/components/auth/unified-login/ProviderList.tsx @@ -1,4 +1,4 @@ -import { GithubLogo, GoogleLogo, IconProps } from '@phosphor-icons/react' +import { GithubLogo, GoogleLogo, type IconProps } from '@/fakemui/icons' import { Button, Separator } from '@/components/ui' diff --git a/frontends/nextjs/src/components/editors/CodeEditor.tsx b/frontends/nextjs/src/components/editors/CodeEditor.tsx index e83ad7ca9..29c7463b4 100644 --- a/frontends/nextjs/src/components/editors/CodeEditor.tsx +++ b/frontends/nextjs/src/components/editors/CodeEditor.tsx @@ -1,5 +1,5 @@ import Editor from '@monaco-editor/react' -import { FloppyDisk, ShieldCheck, Warning, X } from '@phosphor-icons/react' +import { FloppyDisk, ShieldCheck, Warning, X } from '@/fakemui/icons' import { useState } from 'react' import { toast } from 'sonner' diff --git a/frontends/nextjs/src/components/editors/JsonEditor.tsx b/frontends/nextjs/src/components/editors/JsonEditor.tsx index 97bb2b052..3d1fad8a5 100644 --- a/frontends/nextjs/src/components/editors/JsonEditor.tsx +++ b/frontends/nextjs/src/components/editors/JsonEditor.tsx @@ -1,5 +1,5 @@ import Editor from '@monaco-editor/react' -import { Warning } from '@phosphor-icons/react' +import { Warning } from '@/fakemui/icons' import { useEffect, useState } from 'react' import { toast } from 'sonner' diff --git a/frontends/nextjs/src/components/editors/json/Toolbar.tsx b/frontends/nextjs/src/components/editors/json/Toolbar.tsx index aa89c8a86..29a39bbda 100644 --- a/frontends/nextjs/src/components/editors/json/Toolbar.tsx +++ b/frontends/nextjs/src/components/editors/json/Toolbar.tsx @@ -1,4 +1,4 @@ -import { FloppyDisk, ShieldCheck, X } from '@phosphor-icons/react' +import { FloppyDisk, ShieldCheck, X } from '@/fakemui/icons' import { Button, DialogFooter } from '@/components/ui' diff --git a/frontends/nextjs/src/components/editors/lua/lua-editor/code/LuaCodeEditorSection.tsx b/frontends/nextjs/src/components/editors/lua/lua-editor/code/LuaCodeEditorSection.tsx index a314ab028..4f4e41731 100644 --- a/frontends/nextjs/src/components/editors/lua/lua-editor/code/LuaCodeEditorSection.tsx +++ b/frontends/nextjs/src/components/editors/lua/lua-editor/code/LuaCodeEditorSection.tsx @@ -1,5 +1,5 @@ import Editor, { useMonaco } from '@monaco-editor/react' -import { ArrowsOut, BookOpen, FileCode } from '@phosphor-icons/react' +import { ArrowsOut, BookOpen, FileCode } from '@/fakemui/icons' import { useRef } from 'react' import { toast } from 'sonner' diff --git a/frontends/nextjs/src/components/level/level3/CommentsTable.tsx b/frontends/nextjs/src/components/level/level3/CommentsTable.tsx index 923e5fd96..2987e3008 100644 --- a/frontends/nextjs/src/components/level/level3/CommentsTable.tsx +++ b/frontends/nextjs/src/components/level/level3/CommentsTable.tsx @@ -1,4 +1,4 @@ -import { Trash } from '@phosphor-icons/react' +import { Trash } from '@/fakemui/icons' import { useMemo } from 'react' import { diff --git a/frontends/nextjs/src/components/level/level3/Level3Stats.tsx b/frontends/nextjs/src/components/level/level3/Level3Stats.tsx index e629073be..054e61557 100644 --- a/frontends/nextjs/src/components/level/level3/Level3Stats.tsx +++ b/frontends/nextjs/src/components/level/level3/Level3Stats.tsx @@ -1,4 +1,4 @@ -import { ChatCircle, Users } from '@phosphor-icons/react' +import { ChatCircle, Users } from '@/fakemui/icons' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui' import type { Comment, User } from '@/lib/level-types' diff --git a/frontends/nextjs/src/components/level/level3/UserTable.tsx b/frontends/nextjs/src/components/level/level3/UserTable.tsx index 60d2c7171..aee193996 100644 --- a/frontends/nextjs/src/components/level/level3/UserTable.tsx +++ b/frontends/nextjs/src/components/level/level3/UserTable.tsx @@ -1,4 +1,4 @@ -import { ChatCircle, MagnifyingGlass, PencilSimple, Trash, Users } from '@phosphor-icons/react' +import { ChatCircle, MagnifyingGlass, PencilSimple, Trash, Users } from '@/fakemui/icons' import { useMemo } from 'react' import { diff --git a/frontends/nextjs/src/components/level/level5/Level5Navigator.tsx b/frontends/nextjs/src/components/level/level5/Level5Navigator.tsx index f50d3ad8c..e549925df 100644 --- a/frontends/nextjs/src/components/level/level5/Level5Navigator.tsx +++ b/frontends/nextjs/src/components/level/level5/Level5Navigator.tsx @@ -1,4 +1,4 @@ -import { ArrowsLeftRight, Buildings, Camera, Eye, Users, Warning } from '@phosphor-icons/react' +import { ArrowsLeftRight, Buildings, Camera, Eye, Users, Warning } from '@/fakemui/icons' import { Box, Typography } from '@mui/material' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui' diff --git a/frontends/nextjs/src/components/level/level5/TransferConfirmDialog.tsx b/frontends/nextjs/src/components/level/level5/TransferConfirmDialog.tsx index fb39208d0..76acc72ab 100644 --- a/frontends/nextjs/src/components/level/level5/TransferConfirmDialog.tsx +++ b/frontends/nextjs/src/components/level/level5/TransferConfirmDialog.tsx @@ -1,4 +1,4 @@ -import { Crown } from '@phosphor-icons/react' +import { Crown } from '@/fakemui/icons' import { AlertDialog, diff --git a/frontends/nextjs/src/components/level/levels/Level2.tsx b/frontends/nextjs/src/components/level/levels/Level2.tsx index 360d320db..3215e5401 100644 --- a/frontends/nextjs/src/components/level/levels/Level2.tsx +++ b/frontends/nextjs/src/components/level/levels/Level2.tsx @@ -1,6 +1,6 @@ 'use client' -import { ChatCircle, User } from '@phosphor-icons/react' +import { ChatCircle, User } from '@/fakemui/icons' import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui' import type { User as UserType } from '@/lib/level-types' diff --git a/frontends/nextjs/src/components/level/levels/Level3.tsx b/frontends/nextjs/src/components/level/levels/Level3.tsx index 2bb01f3de..72e1ef836 100644 --- a/frontends/nextjs/src/components/level/levels/Level3.tsx +++ b/frontends/nextjs/src/components/level/levels/Level3.tsx @@ -1,6 +1,6 @@ 'use client' -import { ChatCircle, Users } from '@phosphor-icons/react' +import { ChatCircle, Users } from '@/fakemui/icons' import { useEffect, useState } from 'react' import { toast } from 'sonner' diff --git a/packages/ui_level6/seed/scripts/tenants.lua b/packages/ui_level6/seed/scripts/tenants.lua index 1fd5ca7dd..9091cda84 100644 --- a/packages/ui_level6/seed/scripts/tenants.lua +++ b/packages/ui_level6/seed/scripts/tenants.lua @@ -1,81 +1,3 @@ --- Tenant management for supergod - ----@class ColumnDefinition ----@field id string ----@field label string ----@field type? string - ----@class TenantListComponent ----@field type string ----@field columns ColumnDefinition[] - ----@class TenantInfo ----@field id string ----@field name string ----@field owner string ----@field userCount number ----@field status string - ----@class TenantCardComponent ----@field type string ----@field id string ----@field name string ----@field owner string ----@field userCount number ----@field status string - ----@class FormField ----@field id string ----@field type string ----@field label string ----@field required? boolean ----@field options? string[] - ----@class FormComponent ----@field type string ----@field id string ----@field fields FormField[] - -local M = {} - ----@return TenantListComponent -function M.tenant_list() - return { - type = "tenant_list", - columns = { - { id = "name", label = "Tenant Name" }, - { id = "owner", label = "Owner" }, - { id = "users", label = "Users", type = "number" }, - { id = "status", label = "Status", type = "badge" }, - { id = "actions", label = "", type = "actions" } - } - } -end - ----@param tenant TenantInfo ----@return TenantCardComponent -function M.tenant_card(tenant) - return { - type = "tenant_card", - id = tenant.id, - name = tenant.name, - owner = tenant.owner, - userCount = tenant.userCount, - status = tenant.status - } -end - ----@return FormComponent -function M.create_tenant_form() - return { - type = "form", - id = "create_tenant", - fields = { - { id = "name", type = "text", label = "Tenant Name", required = true }, - { id = "owner", type = "user_select", label = "Owner", required = true }, - { id = "plan", type = "select", label = "Plan", options = { "free", "pro", "enterprise" } } - } - } -end - -return M +-- Tenants module redirect +-- This file now redirects to the modular implementation in tenants/ +return require("tenants.init") diff --git a/packages/ui_level6/seed/scripts/tenants/create_tenant_form.lua b/packages/ui_level6/seed/scripts/tenants/create_tenant_form.lua new file mode 100644 index 000000000..40b44516b --- /dev/null +++ b/packages/ui_level6/seed/scripts/tenants/create_tenant_form.lua @@ -0,0 +1,29 @@ +-- Create tenant form component + +---@class FormField +---@field id string +---@field type string +---@field label string +---@field required? boolean +---@field options? string[] + +---@class FormComponent +---@field type string +---@field id string +---@field fields FormField[] + +---Returns the create tenant form configuration +---@return FormComponent +local function create_tenant_form() + return { + type = "form", + id = "create_tenant", + fields = { + { id = "name", type = "text", label = "Tenant Name", required = true }, + { id = "owner", type = "user_select", label = "Owner", required = true }, + { id = "plan", type = "select", label = "Plan", options = { "free", "pro", "enterprise" } } + } + } +end + +return create_tenant_form diff --git a/packages/ui_level6/seed/scripts/tenants/init.lua b/packages/ui_level6/seed/scripts/tenants/init.lua new file mode 100644 index 000000000..031f81896 --- /dev/null +++ b/packages/ui_level6/seed/scripts/tenants/init.lua @@ -0,0 +1,10 @@ +-- Tenants module facade +-- Re-exports all tenant management functions for backward compatibility + +local M = {} + +M.tenant_list = require("tenants.tenant_list") +M.tenant_card = require("tenants.tenant_card") +M.create_tenant_form = require("tenants.create_tenant_form") + +return M diff --git a/packages/ui_level6/seed/scripts/tenants/tenant_card.lua b/packages/ui_level6/seed/scripts/tenants/tenant_card.lua new file mode 100644 index 000000000..63eabb1d2 --- /dev/null +++ b/packages/ui_level6/seed/scripts/tenants/tenant_card.lua @@ -0,0 +1,32 @@ +-- Tenant card component + +---@class TenantInfo +---@field id string +---@field name string +---@field owner string +---@field userCount number +---@field status string + +---@class TenantCardComponent +---@field type string +---@field id string +---@field name string +---@field owner string +---@field userCount number +---@field status string + +---Returns a tenant card component for the given tenant +---@param tenant TenantInfo +---@return TenantCardComponent +local function tenant_card(tenant) + return { + type = "tenant_card", + id = tenant.id, + name = tenant.name, + owner = tenant.owner, + userCount = tenant.userCount, + status = tenant.status + } +end + +return tenant_card diff --git a/packages/ui_level6/seed/scripts/tenants/tenant_list.lua b/packages/ui_level6/seed/scripts/tenants/tenant_list.lua new file mode 100644 index 000000000..b201cfe4a --- /dev/null +++ b/packages/ui_level6/seed/scripts/tenants/tenant_list.lua @@ -0,0 +1,27 @@ +-- Tenant list component + +---@class ColumnDefinition +---@field id string +---@field label string +---@field type? string + +---@class TenantListComponent +---@field type string +---@field columns ColumnDefinition[] + +---Returns the tenant list component configuration +---@return TenantListComponent +local function tenant_list() + return { + type = "tenant_list", + columns = { + { id = "name", label = "Tenant Name" }, + { id = "owner", label = "Owner" }, + { id = "users", label = "Users", type = "number" }, + { id = "status", label = "Status", type = "badge" }, + { id = "actions", label = "", type = "actions" } + } + } +end + +return tenant_list diff --git a/packages/ui_level6/seed/scripts/tenants/types.lua b/packages/ui_level6/seed/scripts/tenants/types.lua new file mode 100644 index 000000000..1594136af --- /dev/null +++ b/packages/ui_level6/seed/scripts/tenants/types.lua @@ -0,0 +1,39 @@ +-- Type definitions for tenant management + +---@class ColumnDefinition +---@field id string +---@field label string +---@field type? string + +---@class TenantInfo +---@field id string +---@field name string +---@field owner string +---@field userCount number +---@field status string + +---@class TenantListComponent +---@field type string +---@field columns ColumnDefinition[] + +---@class TenantCardComponent +---@field type string +---@field id string +---@field name string +---@field owner string +---@field userCount number +---@field status string + +---@class FormField +---@field id string +---@field type string +---@field label string +---@field required? boolean +---@field options? string[] + +---@class FormComponent +---@field type string +---@field id string +---@field fields FormField[] + +return {}