mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
code: tsx,nextjs,frontends (34 files)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Shield, Users } from '@phosphor-icons/react'
|
||||
import { Shield, Users } from '@/fakemui/icons'
|
||||
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui'
|
||||
import { ScrollArea } from '@/components/ui'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { ArrowsLeftRight, Crown } from '@phosphor-icons/react'
|
||||
import { ArrowsLeftRight, Crown } from '@/fakemui/icons'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { Button } from '@/components/ui'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Eye } from '@phosphor-icons/react'
|
||||
import { Eye } from '@/fakemui/icons'
|
||||
|
||||
import { Button } from '@/components/ui'
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Warning } from '@phosphor-icons/react'
|
||||
import { Warning } from '@/fakemui/icons'
|
||||
|
||||
import {
|
||||
AlertDialog,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Broom } from '@phosphor-icons/react'
|
||||
import { Broom } from '@/fakemui/icons'
|
||||
|
||||
import {
|
||||
Badge,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CheckCircle, Info, Trash, Warning } from '@phosphor-icons/react'
|
||||
import { CheckCircle, Info, Trash, Warning } from '@/fakemui/icons'
|
||||
|
||||
import { Badge, Button, Card, CardContent, ScrollArea } from '@/components/ui'
|
||||
import type { ErrorLog } from '@/lib/db/error-logs'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Warning } from '@phosphor-icons/react'
|
||||
import { Warning } from '@/fakemui/icons'
|
||||
|
||||
import { Button, Card, CardContent } from '@/components/ui'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import { Broom, Warning } from '@phosphor-icons/react'
|
||||
import { Broom, Warning } from '@/fakemui/icons'
|
||||
|
||||
import {
|
||||
AlertDialog,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Info, Warning } from '@phosphor-icons/react'
|
||||
import { Info, Warning } from '@/fakemui/icons'
|
||||
|
||||
export const getLevelIcon = (level: string) => {
|
||||
switch (level) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CheckCircle, Trash } from '@phosphor-icons/react'
|
||||
import { CheckCircle, Trash } from '@/fakemui/icons'
|
||||
|
||||
import { Badge, Button, Card, CardContent, ScrollArea } from '@/components/ui'
|
||||
import type { ErrorLog } from '@/lib/db/error-logs'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { ArrowsLeftRight } from '@phosphor-icons/react'
|
||||
import { ArrowsLeftRight } from '@/fakemui/icons'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { Crown } from '@phosphor-icons/react'
|
||||
import { Crown } from '@/fakemui/icons'
|
||||
|
||||
import {
|
||||
Alert,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { House, List, SignOut, X } from '@phosphor-icons/react'
|
||||
import { House, List, SignOut, X } from '@/fakemui/icons'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Code, ListDashes, Package, Palette, Sparkle, Terminal } from '@phosphor-icons/react'
|
||||
import { Code, ListDashes, Package, Palette, Sparkle, Terminal } from '@/fakemui/icons'
|
||||
|
||||
import { Card } from '@/components/ui'
|
||||
import { Badge } from '@/components/ui'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FloppyDisk, X } from '@phosphor-icons/react'
|
||||
import { FloppyDisk, X } from '@/fakemui/icons'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Envelope, FloppyDisk, PaperPlaneTilt } from '@phosphor-icons/react'
|
||||
import { Envelope, FloppyDisk, PaperPlaneTilt } from '@/fakemui/icons'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ListNumbers, Plus, PushPinSimple, SquaresFour } from '@phosphor-icons/react'
|
||||
import { ListNumbers, Plus, PushPinSimple, SquaresFour } from '@/fakemui/icons'
|
||||
|
||||
import {
|
||||
Badge,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EnvelopeSimple, FloppyDisk } from '@phosphor-icons/react'
|
||||
import { EnvelopeSimple, FloppyDisk } from '@/fakemui/icons'
|
||||
import { useMemo } from 'react'
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CheckCircle, Clock, WarningCircle } from '@phosphor-icons/react'
|
||||
import { CheckCircle, Clock, WarningCircle } from '@/fakemui/icons'
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
import { Badge, Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useKV } from '@github/spark/hooks'
|
||||
import { ArrowDown, ArrowUp, MagnifyingGlass, Pencil, Plus, Trash } from '@phosphor-icons/react'
|
||||
import { ArrowDown, ArrowUp, MagnifyingGlass, Pencil, Plus, Trash } from '@/fakemui/icons'
|
||||
import { motion } from 'motion/react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MagnifyingGlass } from '@phosphor-icons/react'
|
||||
import { MagnifyingGlass } from '@/fakemui/icons'
|
||||
|
||||
import {
|
||||
Input,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ArrowDown, ArrowUp, Pencil, Trash } from '@phosphor-icons/react'
|
||||
import { ArrowDown, ArrowUp, Pencil, Trash } from '@/fakemui/icons'
|
||||
import { ReactNode } from 'react'
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useKV } from '@github/spark/hooks'
|
||||
import { Eye, FloppyDisk, SignOut } from '@phosphor-icons/react'
|
||||
import { Eye, FloppyDisk, SignOut } from '@/fakemui/icons'
|
||||
import { useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Trash } from '@phosphor-icons/react'
|
||||
import { Trash } from '@/fakemui/icons'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { CssClassBuilder } from '@/components/CssClassBuilder'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Palette } from '@phosphor-icons/react'
|
||||
import { Palette } from '@/fakemui/icons'
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Code, PaintBrush } from '@phosphor-icons/react'
|
||||
import { Code, PaintBrush } from '@/fakemui/icons'
|
||||
|
||||
import { Button, ScrollArea, Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui'
|
||||
import type { DropdownConfig } from '@/lib/database'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Plus, Trash } from '@phosphor-icons/react'
|
||||
import { Plus, Trash } from '@/fakemui/icons'
|
||||
|
||||
import { ValidationPanel } from '@/components/schema/level4/ValidationPanel'
|
||||
import { Button, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Plus, Trash } from '@phosphor-icons/react'
|
||||
import { Plus, Trash } from '@/fakemui/icons'
|
||||
|
||||
import { ValidationPanel } from '@/components/schema/level4/ValidationPanel'
|
||||
import { Button, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Plus, Trash } from '@phosphor-icons/react'
|
||||
import { Plus, Trash } from '@/fakemui/icons'
|
||||
|
||||
import { ValidationPanel } from '@/components/schema/level4/ValidationPanel'
|
||||
import { Button, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui'
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
-- Ban user moderation action
|
||||
-- Single function module for admin moderation
|
||||
|
||||
local check = require("check")
|
||||
local LEVELS = require("levels")
|
||||
|
||||
---@class BanUser
|
||||
local M = {}
|
||||
|
||||
---Bans a user account after permission verification
|
||||
---@param ctx ModerationContext Context with user and targetId
|
||||
---@return ActionResult Result of the ban operation
|
||||
function M.banUser(ctx)
|
||||
if not check.can_access(ctx.user, LEVELS.ADMIN) then
|
||||
return { success = false, error = "Admin required" }
|
||||
end
|
||||
return { success = true, action = "ban_user", id = ctx.targetId }
|
||||
end
|
||||
|
||||
return M
|
||||
-- Ban user moderation action
|
||||
-- Single function module for admin moderation
|
||||
|
||||
local check = require("check")
|
||||
local LEVELS = require("levels")
|
||||
|
||||
---@class BanUser
|
||||
local M = {}
|
||||
|
||||
---Bans a user account after permission verification
|
||||
---@param ctx ModerationContext Context with user and targetId
|
||||
---@return ActionResult Result of the ban operation
|
||||
function M.banUser(ctx)
|
||||
if not check.can_access(ctx.user, LEVELS.ADMIN) then
|
||||
return { success = false, error = "Admin required" }
|
||||
end
|
||||
return { success = true, action = "ban_user", id = ctx.targetId }
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
-- Delete user moderation action
|
||||
-- Single function module for admin moderation
|
||||
|
||||
local check = require("check")
|
||||
local LEVELS = require("levels")
|
||||
|
||||
---@class DeleteUser
|
||||
local M = {}
|
||||
|
||||
---Deletes a user account after permission verification
|
||||
---@param ctx ModerationContext Context with user and targetId
|
||||
---@return ActionResult Result of the delete operation
|
||||
function M.deleteUser(ctx)
|
||||
if not check.can_access(ctx.user, LEVELS.ADMIN) then
|
||||
return { success = false, error = "Admin required" }
|
||||
end
|
||||
if ctx.targetId == ctx.user.id then
|
||||
return { success = false, error = "Cannot delete yourself" }
|
||||
end
|
||||
return { success = true, action = "delete_user", id = ctx.targetId }
|
||||
end
|
||||
|
||||
return M
|
||||
-- Delete user moderation action
|
||||
-- Single function module for admin moderation
|
||||
|
||||
local check = require("check")
|
||||
local LEVELS = require("levels")
|
||||
|
||||
---@class DeleteUser
|
||||
local M = {}
|
||||
|
||||
---Deletes a user account after permission verification
|
||||
---@param ctx ModerationContext Context with user and targetId
|
||||
---@return ActionResult Result of the delete operation
|
||||
function M.deleteUser(ctx)
|
||||
if not check.can_access(ctx.user, LEVELS.ADMIN) then
|
||||
return { success = false, error = "Admin required" }
|
||||
end
|
||||
if ctx.targetId == ctx.user.id then
|
||||
return { success = false, error = "Cannot delete yourself" }
|
||||
end
|
||||
return { success = true, action = "delete_user", id = ctx.targetId }
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
-- Edit user moderation action
|
||||
-- Single function module for admin moderation
|
||||
|
||||
local check = require("check")
|
||||
local LEVELS = require("levels")
|
||||
|
||||
---@class EditUser
|
||||
local M = {}
|
||||
|
||||
---Opens edit dialog for a user after permission verification
|
||||
---@param ctx ModerationContext Context with user and targetId
|
||||
---@return ActionResult Result with dialog action
|
||||
function M.editUser(ctx)
|
||||
if not check.can_access(ctx.user, LEVELS.ADMIN) then
|
||||
return { success = false, error = "Admin required" }
|
||||
end
|
||||
return { success = true, action = "open_edit_dialog", id = ctx.targetId }
|
||||
end
|
||||
|
||||
return M
|
||||
-- Edit user moderation action
|
||||
-- Single function module for admin moderation
|
||||
|
||||
local check = require("check")
|
||||
local LEVELS = require("levels")
|
||||
|
||||
---@class EditUser
|
||||
local M = {}
|
||||
|
||||
---Opens edit dialog for a user after permission verification
|
||||
---@param ctx ModerationContext Context with user and targetId
|
||||
---@return ActionResult Result with dialog action
|
||||
function M.editUser(ctx)
|
||||
if not check.can_access(ctx.user, LEVELS.ADMIN) then
|
||||
return { success = false, error = "Admin required" }
|
||||
end
|
||||
return { success = true, action = "open_edit_dialog", id = ctx.targetId }
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
-- Moderation module facade
|
||||
-- Re-exports all moderation functions for backward compatibility
|
||||
-- Each function is defined in its own file following 1-function-per-file pattern
|
||||
|
||||
---@class Moderation
|
||||
local M = {}
|
||||
|
||||
-- Import all single-function modules
|
||||
local deleteUser = require("moderation.delete_user")
|
||||
local editUser = require("moderation.edit_user")
|
||||
local banUser = require("moderation.ban_user")
|
||||
|
||||
-- Re-export all functions
|
||||
M.deleteUser = deleteUser.deleteUser
|
||||
M.editUser = editUser.editUser
|
||||
M.banUser = banUser.banUser
|
||||
|
||||
return M
|
||||
-- Moderation module facade
|
||||
-- Re-exports all moderation functions for backward compatibility
|
||||
-- Each function is defined in its own file following 1-function-per-file pattern
|
||||
|
||||
---@class Moderation
|
||||
local M = {}
|
||||
|
||||
-- Import all single-function modules
|
||||
local deleteUser = require("moderation.delete_user")
|
||||
local editUser = require("moderation.edit_user")
|
||||
local banUser = require("moderation.ban_user")
|
||||
|
||||
-- Re-export all functions
|
||||
M.deleteUser = deleteUser.deleteUser
|
||||
M.editUser = editUser.editUser
|
||||
M.banUser = banUser.banUser
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
-- Type definitions for moderation module
|
||||
-- Shared across all moderation functions
|
||||
|
||||
---@class ModerationContext
|
||||
---@field user table User object for permission checking
|
||||
---@field targetId string ID of the target user for moderation action
|
||||
|
||||
---@class ActionResult
|
||||
---@field success boolean Whether the action was successful
|
||||
---@field error string? Error message if unsuccessful
|
||||
---@field action string? Action type to perform
|
||||
---@field id string? ID of the affected user
|
||||
|
||||
return {}
|
||||
-- Type definitions for moderation module
|
||||
-- Shared across all moderation functions
|
||||
|
||||
---@class ModerationContext
|
||||
---@field user table User object for permission checking
|
||||
---@field targetId string ID of the target user for moderation action
|
||||
|
||||
---@class ActionResult
|
||||
---@field success boolean Whether the action was successful
|
||||
---@field error string? Error message if unsuccessful
|
||||
---@field action string? Action type to perform
|
||||
---@field id string? ID of the affected user
|
||||
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user