import { useCallback, useEffect, useRef, useState, type ReactNode } from "react"; import { App, Button, Skeleton } from "antd"; import { Switch } from "@/pages/admin/ui/controls"; import { AlertTriangle, Clapperboard, Coins, ListChecks, MonitorCog, PlugZap, RadioTower, RefreshCw, ShieldCheck, Sparkles } from "lucide-react"; import { cn } from "@/lib/utils"; import { getAdminFeatureAvailability, updateAdminFeatureAvailability } from "@/services/api/auth"; import { useUserStore, type FeatureAvailability } from "@/stores/use-user-store"; import { AdminStatusBadge } from "./admin-ui"; type FeatureKey = "shortDramaEnabled" | "taskCenterEnabled" | "creditsEnabled" | "customChannelsEnabled" | "frontendModelsEnabled" | "pluginCenterEnabled" | "systemPluginsVisibleToUsers"; type FeatureRow = { key: FeatureKey; title: string; description: string; icon: ReactNode; dependsOn?: FeatureKey; }; const editableFeatureKeys: FeatureKey[] = ["shortDramaEnabled", "taskCenterEnabled", "creditsEnabled", "customChannelsEnabled", "frontendModelsEnabled", "pluginCenterEnabled", "systemPluginsVisibleToUsers"]; const workspaceFeatureRows: FeatureRow[] = [ { key: "shortDramaEnabled", title: "短剧创作", description: "开放短剧入口、项目列表与项目详情。关闭不删除已有项目。", icon: