code: tsx,nextjs,frontends (20 files)

This commit is contained in:
Richard Ward
2025-12-30 12:30:39 +00:00
parent e4426830df
commit 3a8b9694bc
20 changed files with 154 additions and 95 deletions

View File

@@ -1,4 +1,4 @@
import { CheckCircle, WarningCircle } from '@phosphor-icons/react'
import { CheckCircle, WarningCircle } from '@/fakemui/icons'
import { Alert, AlertDescription, Badge } from '@/components/ui'

View File

@@ -1,4 +1,4 @@
import { SignIn } from '@phosphor-icons/react'
import { SignIn } from '@/fakemui/icons'
import { Alert, AlertDescription, Button, Input, Label } from '@/components/ui'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -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'

View File

@@ -1,4 +1,4 @@
import { Trash } from '@phosphor-icons/react'
import { Trash } from '@/fakemui/icons'
import { useMemo } from 'react'
import {

View File

@@ -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'

View File

@@ -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 {

View File

@@ -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'

View File

@@ -1,4 +1,4 @@
import { Crown } from '@phosphor-icons/react'
import { Crown } from '@/fakemui/icons'
import {
AlertDialog,

View File

@@ -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'

View File

@@ -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'

View File

@@ -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")

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 {}