spine-framework 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.framework/README.md +129 -0
- package/.framework/cli/bin.cjs +14 -0
- package/.framework/cli/commands/agents.ts +153 -0
- package/.framework/cli/commands/auth.ts +94 -0
- package/.framework/cli/commands/create-app.ts +185 -0
- package/.framework/cli/commands/dev.ts +295 -0
- package/.framework/cli/commands/doctor.ts +442 -0
- package/.framework/cli/commands/generate.ts +332 -0
- package/.framework/cli/commands/init.ts +272 -0
- package/.framework/cli/commands/install-app.ts +391 -0
- package/.framework/cli/commands/items.ts +253 -0
- package/.framework/cli/commands/migrations.ts +141 -0
- package/.framework/cli/commands/pipelines.ts +166 -0
- package/.framework/cli/commands/status.ts +197 -0
- package/.framework/cli/commands/system.ts +184 -0
- package/.framework/cli/commands/test.ts +227 -0
- package/.framework/cli/commands/uninstall-app.ts +166 -0
- package/.framework/cli/context.ts +268 -0
- package/.framework/cli/env-loader.ts +36 -0
- package/.framework/cli/index.ts +106 -0
- package/.framework/cli/welcome.cjs +45 -0
- package/.framework/docs/API.md +384 -0
- package/.framework/docs/STABILITY.md +52 -0
- package/.framework/docs/admin-routes.md +76 -0
- package/.framework/docs/api-docs-progress.md +38 -0
- package/.framework/docs/api-governance.md +146 -0
- package/.framework/docs/api-testing-results.md +212 -0
- package/.framework/docs/apis/admin-configs.md +567 -0
- package/.framework/docs/apis/admin-data.md +272 -0
- package/.framework/docs/apis/index.md +231 -0
- package/.framework/docs/apis/internal.md +295 -0
- package/.framework/docs/apis/runtime.md +537 -0
- package/.framework/docs/assembly-launch-guide.md +138 -0
- package/.framework/docs/audit-results.md +590 -0
- package/.framework/docs/authorization-model.md +170 -0
- package/.framework/docs/db-api-inventory.md +95 -0
- package/.framework/docs/examples/custom-app/README.md +77 -0
- package/.framework/docs/examples/custom-function/README.md +27 -0
- package/.framework/docs/examples/custom-function/handler.ts +48 -0
- package/.framework/docs/examples/custom-webhook/README.md +68 -0
- package/.framework/docs/gap-remediation-backlog.md +103 -0
- package/.framework/docs/guides/cli-guide.md +224 -0
- package/.framework/docs/guides/getting-started.md +103 -0
- package/.framework/docs/guides/import-guide.md +193 -0
- package/.framework/docs/guides/testing-guide.md +229 -0
- package/.framework/docs/permission-examples.md +326 -0
- package/.framework/docs/ui-adoption-verification.md +111 -0
- package/.framework/docs/ui-api-coverage.md +84 -0
- package/.framework/docs/v2-compatibility-audit.md +228 -0
- package/.framework/functions/.gitkeep +1 -0
- package/.framework/functions/_shared/agent-runner.ts +1097 -0
- package/.framework/functions/_shared/app-manifest.ts +184 -0
- package/.framework/functions/_shared/audit.ts +150 -0
- package/.framework/functions/_shared/db.ts +174 -0
- package/.framework/functions/_shared/index.ts +382 -0
- package/.framework/functions/_shared/middleware.ts +490 -0
- package/.framework/functions/_shared/permissions.ts +1325 -0
- package/.framework/functions/_shared/pipeline-runner.ts +731 -0
- package/.framework/functions/_shared/principal.ts +760 -0
- package/.framework/functions/_shared/schema-utils.ts +967 -0
- package/.framework/functions/_shared/testing.ts +258 -0
- package/.framework/functions/_shared/trigger-engine.ts +425 -0
- package/.framework/functions/_shared/webhook-registration.ts +168 -0
- package/.framework/functions/_shared/webhook-registry.ts +129 -0
- package/.framework/functions/account-nodes.ts +111 -0
- package/.framework/functions/admin-data.ts +606 -0
- package/.framework/functions/ai-agents.ts +323 -0
- package/.framework/functions/api-keys.ts +376 -0
- package/.framework/functions/apps.ts +483 -0
- package/.framework/functions/auth.ts +196 -0
- package/.framework/functions/debug-auth.ts +107 -0
- package/.framework/functions/embeddings.ts +556 -0
- package/.framework/functions/integration-routes.ts +523 -0
- package/.framework/functions/integrations.ts +319 -0
- package/.framework/functions/item-progress.ts +272 -0
- package/.framework/functions/logs.ts +438 -0
- package/.framework/functions/observability.ts +275 -0
- package/.framework/functions/pipeline-executions.ts +494 -0
- package/.framework/functions/pipelines.ts +485 -0
- package/.framework/functions/prompt-configs.ts +339 -0
- package/.framework/functions/roles.ts +387 -0
- package/.framework/functions/system-cron.ts +742 -0
- package/.framework/functions/system.ts +323 -0
- package/.framework/functions/tests.ts +119 -0
- package/.framework/functions/timers.ts +357 -0
- package/.framework/functions/triggers.ts +563 -0
- package/.framework/functions/types.ts +604 -0
- package/.framework/migrations/000_foundation.sql +1256 -0
- package/.framework/migrations/001_seed.sql +92 -0
- package/.framework/migrations/002_seed_constraints.sql +13 -0
- package/.framework/migrations/003_auth_user_trigger.sql +59 -0
- package/.framework/src/App.tsx +126 -0
- package/.framework/src/apps/admin/index.tsx +173 -0
- package/.framework/src/components/AppWrapper.tsx +56 -0
- package/.framework/src/components/CustomAppLoader.tsx +116 -0
- package/.framework/src/components/admin/AdminListPage.tsx +151 -0
- package/.framework/src/components/admin/AdminSidebar.tsx +166 -0
- package/.framework/src/components/admin/AdminStatsCard.tsx +62 -0
- package/.framework/src/components/admin/SortableTableHeader.tsx +42 -0
- package/.framework/src/components/app-shell/GenericAppShell.tsx +181 -0
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +200 -0
- package/.framework/src/components/app-shell/GenericListPage.tsx +116 -0
- package/.framework/src/components/app-sidebar.tsx +228 -0
- package/.framework/src/components/auth/ProtectedRoute.tsx +88 -0
- package/.framework/src/components/layout/AppShell.tsx +91 -0
- package/.framework/src/components/layout/Header.tsx +88 -0
- package/.framework/src/components/layout/Layout.tsx +95 -0
- package/.framework/src/components/layout/Sidebar.tsx +329 -0
- package/.framework/src/components/runtime/DataDetailHeader.tsx +77 -0
- package/.framework/src/components/runtime/DataDetailPage.tsx +171 -0
- package/.framework/src/components/runtime/DataFilters.tsx +91 -0
- package/.framework/src/components/runtime/DataHeader.tsx +68 -0
- package/.framework/src/components/runtime/DataListPage.tsx +124 -0
- package/.framework/src/components/runtime/DataStats.tsx +70 -0
- package/.framework/src/components/runtime/DataTable.tsx +174 -0
- package/.framework/src/components/runtime/SchemaDetailForm.tsx +134 -0
- package/.framework/src/components/runtime/index.ts +18 -0
- package/.framework/src/components/search-form.tsx +29 -0
- package/.framework/src/components/shared/AgentView.tsx +213 -0
- package/.framework/src/components/shared/FieldRenderer.tsx +478 -0
- package/.framework/src/components/shared/SchemaFields.tsx +226 -0
- package/.framework/src/components/ui/DataTable.tsx +343 -0
- package/.framework/src/components/ui/Form.tsx +281 -0
- package/.framework/src/components/ui/ItemCard.tsx +296 -0
- package/.framework/src/components/ui/ItemListView.tsx +308 -0
- package/.framework/src/components/ui/LoadingSpinner.tsx +52 -0
- package/.framework/src/components/ui/Modal.tsx +61 -0
- package/.framework/src/components/ui/RichTextEditor.tsx +210 -0
- package/.framework/src/components/ui/accordion.tsx +82 -0
- package/.framework/src/components/ui/alert-dialog.tsx +197 -0
- package/.framework/src/components/ui/alert.tsx +76 -0
- package/.framework/src/components/ui/aspect-ratio.tsx +11 -0
- package/.framework/src/components/ui/avatar.tsx +110 -0
- package/.framework/src/components/ui/badge.tsx +49 -0
- package/.framework/src/components/ui/breadcrumb.tsx +122 -0
- package/.framework/src/components/ui/button-group.tsx +83 -0
- package/.framework/src/components/ui/button.tsx +65 -0
- package/.framework/src/components/ui/calendar.tsx +222 -0
- package/.framework/src/components/ui/card.tsx +100 -0
- package/.framework/src/components/ui/carousel.tsx +240 -0
- package/.framework/src/components/ui/chart.tsx +373 -0
- package/.framework/src/components/ui/checkbox.tsx +31 -0
- package/.framework/src/components/ui/collapsible.tsx +33 -0
- package/.framework/src/components/ui/combobox.tsx +299 -0
- package/.framework/src/components/ui/command.tsx +193 -0
- package/.framework/src/components/ui/context-menu.tsx +261 -0
- package/.framework/src/components/ui/dialog.tsx +165 -0
- package/.framework/src/components/ui/direction.tsx +22 -0
- package/.framework/src/components/ui/drawer.tsx +132 -0
- package/.framework/src/components/ui/dropdown-menu.tsx +269 -0
- package/.framework/src/components/ui/empty.tsx +104 -0
- package/.framework/src/components/ui/field.tsx +238 -0
- package/.framework/src/components/ui/hover-card.tsx +42 -0
- package/.framework/src/components/ui/input-group.tsx +153 -0
- package/.framework/src/components/ui/input-otp.tsx +87 -0
- package/.framework/src/components/ui/input.tsx +19 -0
- package/.framework/src/components/ui/item.tsx +196 -0
- package/.framework/src/components/ui/kbd.tsx +26 -0
- package/.framework/src/components/ui/label.tsx +22 -0
- package/.framework/src/components/ui/menubar.tsx +277 -0
- package/.framework/src/components/ui/native-select.tsx +61 -0
- package/.framework/src/components/ui/navigation-menu.tsx +164 -0
- package/.framework/src/components/ui/pagination.tsx +129 -0
- package/.framework/src/components/ui/popover.tsx +87 -0
- package/.framework/src/components/ui/progress.tsx +31 -0
- package/.framework/src/components/ui/radio-group.tsx +42 -0
- package/.framework/src/components/ui/resizable.tsx +50 -0
- package/.framework/src/components/ui/scroll-area.tsx +53 -0
- package/.framework/src/components/ui/select.tsx +195 -0
- package/.framework/src/components/ui/separator.tsx +26 -0
- package/.framework/src/components/ui/sheet.tsx +145 -0
- package/.framework/src/components/ui/sidebar.tsx +706 -0
- package/.framework/src/components/ui/skeleton.tsx +13 -0
- package/.framework/src/components/ui/slider.tsx +59 -0
- package/.framework/src/components/ui/sonner.tsx +47 -0
- package/.framework/src/components/ui/spinner.tsx +10 -0
- package/.framework/src/components/ui/switch.tsx +33 -0
- package/.framework/src/components/ui/table-primitives.tsx +141 -0
- package/.framework/src/components/ui/table.tsx +114 -0
- package/.framework/src/components/ui/tabs.tsx +90 -0
- package/.framework/src/components/ui/textarea.tsx +18 -0
- package/.framework/src/components/ui/toggle-group.tsx +89 -0
- package/.framework/src/components/ui/toggle.tsx +45 -0
- package/.framework/src/components/ui/tooltip.tsx +57 -0
- package/.framework/src/contexts/AppContext.tsx +133 -0
- package/.framework/src/contexts/AuthContext.tsx +371 -0
- package/.framework/src/hooks/use-mobile.ts +19 -0
- package/.framework/src/hooks/useApi.ts +526 -0
- package/.framework/src/hooks/useApps.ts +114 -0
- package/.framework/src/hooks/useEntityList.ts +190 -0
- package/.framework/src/hooks/useEntityRecord.ts +308 -0
- package/.framework/src/hooks/useForm.ts +307 -0
- package/.framework/src/hooks/useListSchema.ts +264 -0
- package/.framework/src/hooks/useSchemaRecord.ts +223 -0
- package/.framework/src/index.css +128 -0
- package/.framework/src/lib/api.ts +156 -0
- package/.framework/src/lib/supabase.ts +94 -0
- package/.framework/src/lib/utils.ts +317 -0
- package/.framework/src/main.tsx +27 -0
- package/.framework/src/pages/DashboardPage.tsx +181 -0
- package/.framework/src/pages/NotFoundPage.tsx +39 -0
- package/.framework/src/pages/admin/AIAgentDetailPage.tsx +161 -0
- package/.framework/src/pages/admin/AIAgentsPage.tsx +318 -0
- package/.framework/src/pages/admin/APIKeyDetailPage.tsx +199 -0
- package/.framework/src/pages/admin/APIKeysPage.tsx +303 -0
- package/.framework/src/pages/admin/AlertsConfigPage.tsx +523 -0
- package/.framework/src/pages/admin/AppDetailPage.tsx +493 -0
- package/.framework/src/pages/admin/AppsPage.tsx +355 -0
- package/.framework/src/pages/admin/DesignedPage.tsx +491 -0
- package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +534 -0
- package/.framework/src/pages/admin/EmbeddingsPage.tsx +424 -0
- package/.framework/src/pages/admin/ExtendedShadcnTestPage.tsx +176 -0
- package/.framework/src/pages/admin/IncrementalShadcnTestPage.tsx +109 -0
- package/.framework/src/pages/admin/IntegratedDashboard.tsx +402 -0
- package/.framework/src/pages/admin/IntegrationDetailPage.tsx +187 -0
- package/.framework/src/pages/admin/IntegrationsPage.tsx +301 -0
- package/.framework/src/pages/admin/LogsPage.tsx +283 -0
- package/.framework/src/pages/admin/MinimalShadcnTestPage.tsx +85 -0
- package/.framework/src/pages/admin/ObservabilityDashboard.tsx +470 -0
- package/.framework/src/pages/admin/PipelineDetailPage.tsx +183 -0
- package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +279 -0
- package/.framework/src/pages/admin/PipelinesPage.tsx +390 -0
- package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +299 -0
- package/.framework/src/pages/admin/PromptConfigsPage.tsx +292 -0
- package/.framework/src/pages/admin/ProperlyDesignedPage.tsx +434 -0
- package/.framework/src/pages/admin/RoleDetailPage.tsx +273 -0
- package/.framework/src/pages/admin/RolesPage.tsx +292 -0
- package/.framework/src/pages/admin/SelectTestPage.tsx +61 -0
- package/.framework/src/pages/admin/ShadcnTestPage.tsx +588 -0
- package/.framework/src/pages/admin/SimpleDashboard.tsx +387 -0
- package/.framework/src/pages/admin/TestRunDetailPage.tsx +172 -0
- package/.framework/src/pages/admin/TestingDashboard.tsx +257 -0
- package/.framework/src/pages/admin/TimerDetailPage.tsx +151 -0
- package/.framework/src/pages/admin/TimersPage.tsx +376 -0
- package/.framework/src/pages/admin/TriggerDetailPage.tsx +149 -0
- package/.framework/src/pages/admin/TriggersPage.tsx +381 -0
- package/.framework/src/pages/admin/TypeDetailPage.tsx +694 -0
- package/.framework/src/pages/admin/TypesPage.tsx +295 -0
- package/.framework/src/pages/auth/LoginPage.tsx +188 -0
- package/.framework/src/pages/auth/RegisterPage.tsx +163 -0
- package/.framework/src/pages/spine-framework/APIPage.tsx +17 -0
- package/.framework/src/pages/spine-framework/CLIPage.tsx +25 -0
- package/.framework/src/types/auth.ts +125 -0
- package/.framework/src/types/types.ts +407 -0
- package/STRUCTURE.md +150 -0
- package/config/components.json +25 -0
- package/config/deno.lock +108 -0
- package/config/package-lock.json +17183 -0
- package/config/postcss.config.cjs +10 -0
- package/config/tailwind.config.cjs +78 -0
- package/config/tsconfig.build.json +32 -0
- package/config/tsconfig.cli.json +18 -0
- package/config/tsconfig.json +41 -0
- package/config/tsconfig.node.json +17 -0
- package/config/tsconfig.node.tsbuildinfo +1 -0
- package/config/tsconfig.tsbuildinfo +1 -0
- package/config/typedoc.json +16 -0
- package/config/vite.config.d.ts +2 -0
- package/config/vite.config.ts +72 -0
- package/dist/cli/commands/agents.d.ts +39 -0
- package/dist/cli/commands/agents.d.ts.map +1 -0
- package/dist/cli/commands/auth.d.ts +36 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/create-app.d.ts +23 -0
- package/dist/cli/commands/create-app.d.ts.map +1 -0
- package/dist/cli/commands/dev.d.ts +39 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/doctor.d.ts +42 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/generate.d.ts +36 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +30 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/install-app.d.ts +30 -0
- package/dist/cli/commands/install-app.d.ts.map +1 -0
- package/dist/cli/commands/items.d.ts +45 -0
- package/dist/cli/commands/items.d.ts.map +1 -0
- package/dist/cli/commands/migrations.d.ts +41 -0
- package/dist/cli/commands/migrations.d.ts.map +1 -0
- package/dist/cli/commands/pipelines.d.ts +40 -0
- package/dist/cli/commands/pipelines.d.ts.map +1 -0
- package/dist/cli/commands/status.d.ts +23 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/system.d.ts +29 -0
- package/dist/cli/commands/system.d.ts.map +1 -0
- package/dist/cli/commands/test.d.ts +46 -0
- package/dist/cli/commands/test.d.ts.map +1 -0
- package/dist/cli/commands/uninstall-app.d.ts +23 -0
- package/dist/cli/commands/uninstall-app.d.ts.map +1 -0
- package/dist/cli/context.d.ts +88 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/env-loader.d.ts +14 -0
- package/dist/cli/env-loader.d.ts.map +1 -0
- package/dist/cli/index.d.ts +41 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/functions/_shared/agent-runner.d.ts +156 -0
- package/dist/functions/_shared/agent-runner.d.ts.map +1 -0
- package/dist/functions/_shared/app-manifest.d.ts +68 -0
- package/dist/functions/_shared/app-manifest.d.ts.map +1 -0
- package/dist/functions/_shared/audit.d.ts +91 -0
- package/dist/functions/_shared/audit.d.ts.map +1 -0
- package/dist/functions/_shared/db.d.ts +125 -0
- package/dist/functions/_shared/db.d.ts.map +1 -0
- package/dist/functions/_shared/index.d.ts +298 -0
- package/dist/functions/_shared/index.d.ts.map +1 -0
- package/dist/functions/_shared/middleware.d.ts +315 -0
- package/dist/functions/_shared/middleware.d.ts.map +1 -0
- package/dist/functions/_shared/permissions.d.ts +626 -0
- package/dist/functions/_shared/permissions.d.ts.map +1 -0
- package/dist/functions/_shared/pipeline-runner.d.ts +124 -0
- package/dist/functions/_shared/pipeline-runner.d.ts.map +1 -0
- package/dist/functions/_shared/principal.d.ts +284 -0
- package/dist/functions/_shared/principal.d.ts.map +1 -0
- package/dist/functions/_shared/schema-utils.d.ts +181 -0
- package/dist/functions/_shared/schema-utils.d.ts.map +1 -0
- package/dist/functions/_shared/testing.d.ts +172 -0
- package/dist/functions/_shared/testing.d.ts.map +1 -0
- package/dist/functions/_shared/trigger-engine.d.ts +140 -0
- package/dist/functions/_shared/trigger-engine.d.ts.map +1 -0
- package/dist/functions/_shared/webhook-registration.d.ts +81 -0
- package/dist/functions/_shared/webhook-registration.d.ts.map +1 -0
- package/dist/functions/_shared/webhook-registry.d.ts +57 -0
- package/dist/functions/_shared/webhook-registry.d.ts.map +1 -0
- package/dist/functions/account-nodes.d.ts +48 -0
- package/dist/functions/account-nodes.d.ts.map +1 -0
- package/dist/functions/admin-data.d.ts +178 -0
- package/dist/functions/admin-data.d.ts.map +1 -0
- package/dist/functions/ai-agents.d.ts +125 -0
- package/dist/functions/ai-agents.d.ts.map +1 -0
- package/dist/functions/api-keys.d.ts +140 -0
- package/dist/functions/api-keys.d.ts.map +1 -0
- package/dist/functions/apps.d.ts +163 -0
- package/dist/functions/apps.d.ts.map +1 -0
- package/dist/functions/auth.d.ts +74 -0
- package/dist/functions/auth.d.ts.map +1 -0
- package/dist/functions/debug-auth.d.ts +33 -0
- package/dist/functions/debug-auth.d.ts.map +1 -0
- package/dist/functions/embeddings.d.ts +205 -0
- package/dist/functions/embeddings.d.ts.map +1 -0
- package/dist/functions/integration-routes.d.ts +45 -0
- package/dist/functions/integration-routes.d.ts.map +1 -0
- package/dist/functions/integrations.d.ts +124 -0
- package/dist/functions/integrations.d.ts.map +1 -0
- package/dist/functions/item-progress.d.ts +41 -0
- package/dist/functions/item-progress.d.ts.map +1 -0
- package/dist/functions/logs.d.ts +162 -0
- package/dist/functions/logs.d.ts.map +1 -0
- package/dist/functions/observability.d.ts +123 -0
- package/dist/functions/observability.d.ts.map +1 -0
- package/dist/functions/pipeline-executions.d.ts +190 -0
- package/dist/functions/pipeline-executions.d.ts.map +1 -0
- package/dist/functions/pipelines.d.ts +171 -0
- package/dist/functions/pipelines.d.ts.map +1 -0
- package/dist/functions/prompt-configs.d.ts +125 -0
- package/dist/functions/prompt-configs.d.ts.map +1 -0
- package/dist/functions/roles.d.ts +118 -0
- package/dist/functions/roles.d.ts.map +1 -0
- package/dist/functions/system-cron.d.ts +65 -0
- package/dist/functions/system-cron.d.ts.map +1 -0
- package/dist/functions/system.d.ts +29 -0
- package/dist/functions/system.d.ts.map +1 -0
- package/dist/functions/tests.d.ts +28 -0
- package/dist/functions/tests.d.ts.map +1 -0
- package/dist/functions/timers.d.ts +139 -0
- package/dist/functions/timers.d.ts.map +1 -0
- package/dist/functions/triggers.d.ts +203 -0
- package/dist/functions/triggers.d.ts.map +1 -0
- package/dist/functions/types.d.ts +151 -0
- package/dist/functions/types.d.ts.map +1 -0
- package/dist/src/types/types.d.ts +364 -0
- package/dist/src/types/types.d.ts.map +1 -0
- package/package.json +192 -0
- package/scripts/app-install-cli.ts +286 -0
- package/scripts/assemble-frontend.sh +79 -0
- package/scripts/assemble-functions.sh +62 -0
- package/scripts/assemble.sh +35 -0
- package/scripts/boundary-check.sh +106 -0
- package/scripts/build-manifest.sh +80 -0
- package/scripts/check-core-integrity.sh +82 -0
- package/scripts/ingest-chunks.cjs +202 -0
- package/scripts/kb-chunk-parser.cjs +312 -0
- package/scripts/kb-chunk-parser.ts +330 -0
- package/scripts/load-test-app-install.ts +484 -0
- package/scripts/netlify-dev-wrapper.sh +22 -0
- package/scripts/verify-integrity.sh +69 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react'
|
|
2
|
+
import { Button } from '../ui/button'
|
|
3
|
+
import { Card, CardContent } from '../ui/card'
|
|
4
|
+
import { Input } from '../ui/input'
|
|
5
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select'
|
|
6
|
+
import { Skeleton } from '../ui/skeleton'
|
|
7
|
+
import { Search } from 'lucide-react'
|
|
8
|
+
import { LucideIcon } from 'lucide-react'
|
|
9
|
+
import { AdminStatsCard } from './AdminStatsCard'
|
|
10
|
+
import { cn } from '../../lib/utils'
|
|
11
|
+
|
|
12
|
+
interface AdminListPageProps {
|
|
13
|
+
title: string
|
|
14
|
+
description: string
|
|
15
|
+
newButtonText?: string
|
|
16
|
+
newButtonHref?: string
|
|
17
|
+
onNewClick?: () => void
|
|
18
|
+
statsCards: Array<{
|
|
19
|
+
title: string
|
|
20
|
+
value: string | number
|
|
21
|
+
icon: LucideIcon
|
|
22
|
+
iconColor?: string
|
|
23
|
+
}>
|
|
24
|
+
searchPlaceholder?: string
|
|
25
|
+
searchValue?: string
|
|
26
|
+
onSearchChange?: (value: string) => void
|
|
27
|
+
filters?: Array<{
|
|
28
|
+
label: string
|
|
29
|
+
value: string
|
|
30
|
+
options: Array<{ value: string; label: string }>
|
|
31
|
+
onChange: (value: string) => void
|
|
32
|
+
}>
|
|
33
|
+
children: ReactNode
|
|
34
|
+
loading?: boolean
|
|
35
|
+
error?: string | null
|
|
36
|
+
onRetry?: () => void
|
|
37
|
+
emptyMessage?: string
|
|
38
|
+
emptyIcon?: LucideIcon
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function AdminListPage({
|
|
42
|
+
title,
|
|
43
|
+
description,
|
|
44
|
+
newButtonText,
|
|
45
|
+
newButtonHref = '#',
|
|
46
|
+
onNewClick,
|
|
47
|
+
statsCards,
|
|
48
|
+
searchPlaceholder = "Search...",
|
|
49
|
+
searchValue = "",
|
|
50
|
+
onSearchChange,
|
|
51
|
+
filters = [],
|
|
52
|
+
children,
|
|
53
|
+
loading = false,
|
|
54
|
+
error = null,
|
|
55
|
+
onRetry,
|
|
56
|
+
}: AdminListPageProps) {
|
|
57
|
+
return (
|
|
58
|
+
<div className="space-y-6">
|
|
59
|
+
{/* Header */}
|
|
60
|
+
<div className="flex justify-between items-center">
|
|
61
|
+
<div>
|
|
62
|
+
<h1 className="text-xl font-semibold">{title}</h1>
|
|
63
|
+
<p className="mt-1 text-sm text-muted-foreground">{description}</p>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
{newButtonText && (
|
|
67
|
+
<Button onClick={() => onNewClick ? onNewClick() : (window.location.href = newButtonHref!)}>
|
|
68
|
+
{newButtonText}
|
|
69
|
+
</Button>
|
|
70
|
+
)}
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
{/* Stats Cards */}
|
|
74
|
+
<div className="grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4">
|
|
75
|
+
{statsCards.map((stat, index) => (
|
|
76
|
+
<AdminStatsCard
|
|
77
|
+
key={index}
|
|
78
|
+
title={stat.title}
|
|
79
|
+
value={stat.value}
|
|
80
|
+
icon={stat.icon}
|
|
81
|
+
iconColor={stat.iconColor}
|
|
82
|
+
/>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
{/* Search and Filters */}
|
|
87
|
+
<Card>
|
|
88
|
+
<CardContent className="p-4">
|
|
89
|
+
<div className="flex flex-col sm:flex-row gap-4">
|
|
90
|
+
{/* Search */}
|
|
91
|
+
{onSearchChange && (
|
|
92
|
+
<div className="flex-1">
|
|
93
|
+
<div className="relative">
|
|
94
|
+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
|
95
|
+
<Input
|
|
96
|
+
placeholder={searchPlaceholder}
|
|
97
|
+
value={searchValue}
|
|
98
|
+
onChange={(e) => onSearchChange(e.target.value)}
|
|
99
|
+
className="pl-9"
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
|
|
105
|
+
{/* Filters */}
|
|
106
|
+
{filters.map((filter, index) => (
|
|
107
|
+
<div key={index} className="sm:w-48">
|
|
108
|
+
<Select value={filter.value} onValueChange={filter.onChange}>
|
|
109
|
+
<SelectTrigger>
|
|
110
|
+
<SelectValue placeholder={filter.label} />
|
|
111
|
+
</SelectTrigger>
|
|
112
|
+
<SelectContent>
|
|
113
|
+
{filter.options.map(option => (
|
|
114
|
+
<SelectItem key={option.value} value={option.value}>
|
|
115
|
+
{option.label}
|
|
116
|
+
</SelectItem>
|
|
117
|
+
))}
|
|
118
|
+
</SelectContent>
|
|
119
|
+
</Select>
|
|
120
|
+
</div>
|
|
121
|
+
))}
|
|
122
|
+
</div>
|
|
123
|
+
</CardContent>
|
|
124
|
+
</Card>
|
|
125
|
+
|
|
126
|
+
{/* Content */}
|
|
127
|
+
<Card>
|
|
128
|
+
{loading ? (
|
|
129
|
+
<div className="p-8 space-y-4">
|
|
130
|
+
<Skeleton className="h-8 w-full" />
|
|
131
|
+
<Skeleton className="h-8 w-full" />
|
|
132
|
+
<Skeleton className="h-8 w-3/4" />
|
|
133
|
+
</div>
|
|
134
|
+
) : error ? (
|
|
135
|
+
<div className="p-8 text-center">
|
|
136
|
+
<p className="text-destructive">Error: {error}</p>
|
|
137
|
+
{onRetry && (
|
|
138
|
+
<Button onClick={onRetry} className="mt-4">
|
|
139
|
+
Retry
|
|
140
|
+
</Button>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
) : (
|
|
144
|
+
<CardContent className="p-0">
|
|
145
|
+
{children}
|
|
146
|
+
</CardContent>
|
|
147
|
+
)}
|
|
148
|
+
</Card>
|
|
149
|
+
</div>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module src/components/admin/AdminSidebar
|
|
3
|
+
* @audience installer
|
|
4
|
+
* @layer frontend-component
|
|
5
|
+
* @stability stable
|
|
6
|
+
*
|
|
7
|
+
* Admin sidebar with proper sections, React Router navigation, and active link highlighting.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import * as React from "react"
|
|
11
|
+
import { Link, useLocation } from "react-router-dom"
|
|
12
|
+
import {
|
|
13
|
+
PlusIcon,
|
|
14
|
+
Database,
|
|
15
|
+
Settings,
|
|
16
|
+
Type,
|
|
17
|
+
Users,
|
|
18
|
+
Layout,
|
|
19
|
+
FileText,
|
|
20
|
+
BarChart3,
|
|
21
|
+
AlertTriangle,
|
|
22
|
+
Activity,
|
|
23
|
+
FileSearch,
|
|
24
|
+
FlaskConical,
|
|
25
|
+
Brain,
|
|
26
|
+
Cpu,
|
|
27
|
+
Timer,
|
|
28
|
+
Puzzle,
|
|
29
|
+
Shield,
|
|
30
|
+
MessageSquare,
|
|
31
|
+
Key,
|
|
32
|
+
TestTube
|
|
33
|
+
} from "lucide-react"
|
|
34
|
+
import {
|
|
35
|
+
Sidebar,
|
|
36
|
+
SidebarContent,
|
|
37
|
+
SidebarFooter,
|
|
38
|
+
SidebarGroup,
|
|
39
|
+
SidebarGroupContent,
|
|
40
|
+
SidebarGroupLabel,
|
|
41
|
+
SidebarHeader,
|
|
42
|
+
SidebarMenu,
|
|
43
|
+
SidebarMenuButton,
|
|
44
|
+
SidebarMenuItem,
|
|
45
|
+
SidebarRail,
|
|
46
|
+
} from "../ui/sidebar"
|
|
47
|
+
import { Button } from "../ui/button"
|
|
48
|
+
|
|
49
|
+
// Navigation sections with correct admin URLs
|
|
50
|
+
const navigationSections = [
|
|
51
|
+
{
|
|
52
|
+
title: "Configs",
|
|
53
|
+
items: [
|
|
54
|
+
{ title: "Types", url: "/spine-framework/admin/configs/types", icon: Type },
|
|
55
|
+
{ title: "Apps", url: "/spine-framework/admin/configs/apps", icon: Layout },
|
|
56
|
+
{ title: "Pipelines", url: "/spine-framework/admin/configs/pipelines", icon: Activity },
|
|
57
|
+
{ title: "Triggers", url: "/spine-framework/admin/configs/triggers", icon: AlertTriangle },
|
|
58
|
+
{ title: "AI Agents", url: "/spine-framework/admin/configs/ai-agents", icon: Brain },
|
|
59
|
+
{ title: "Embeddings", url: "/spine-framework/admin/configs/embeddings", icon: Cpu },
|
|
60
|
+
{ title: "Timers", url: "/spine-framework/admin/configs/timers", icon: Timer },
|
|
61
|
+
{ title: "Integrations", url: "/spine-framework/admin/configs/integrations", icon: Puzzle },
|
|
62
|
+
{ title: "Roles", url: "/spine-framework/admin/configs/roles", icon: Shield },
|
|
63
|
+
{ title: "Prompts", url: "/spine-framework/admin/configs/prompts", icon: MessageSquare },
|
|
64
|
+
{ title: "API Keys", url: "/spine-framework/admin/configs/api-keys", icon: Key },
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: "Runtime",
|
|
69
|
+
items: [
|
|
70
|
+
{ title: "Items", url: "/spine-framework/admin/runtime/items", icon: Database },
|
|
71
|
+
{ title: "Accounts", url: "/spine-framework/admin/runtime/accounts", icon: Users },
|
|
72
|
+
{ title: "People", url: "/spine-framework/admin/runtime/people", icon: Users },
|
|
73
|
+
{ title: "Threads", url: "/spine-framework/admin/runtime/threads", icon: MessageSquare },
|
|
74
|
+
{ title: "Messages", url: "/spine-framework/admin/runtime/messages", icon: FileText },
|
|
75
|
+
{ title: "Attachments", url: "/spine-framework/admin/runtime/attachments", icon: FileSearch },
|
|
76
|
+
{ title: "Watchers", url: "/spine-framework/admin/runtime/watchers", icon: Activity },
|
|
77
|
+
{ title: "Links", url: "/spine-framework/admin/runtime/links", icon: Puzzle },
|
|
78
|
+
{ title: "Progress", url: "/spine-framework/admin/runtime/item_progress", icon: BarChart3 },
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
title: "Observability",
|
|
83
|
+
items: [
|
|
84
|
+
{ title: "Dashboard", url: "/spine-framework/admin/observability", icon: BarChart3 },
|
|
85
|
+
{ title: "Alerts", url: "/spine-framework/admin/observability/alerts", icon: AlertTriangle },
|
|
86
|
+
{ title: "Executions", url: "/spine-framework/admin/observability/executions", icon: Activity },
|
|
87
|
+
{ title: "Logs", url: "/spine-framework/admin/observability/logs", icon: FileSearch },
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
title: "Testing",
|
|
92
|
+
items: [
|
|
93
|
+
{ title: "Test Runs", url: "/spine-framework/admin/testing", icon: TestTube },
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
export function AdminSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|
99
|
+
const location = useLocation()
|
|
100
|
+
|
|
101
|
+
// Check if a URL is active (exact match or starts with path)
|
|
102
|
+
const isActive = (url: string) => {
|
|
103
|
+
return location.pathname === url || location.pathname.startsWith(url + '/')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Sidebar {...props}>
|
|
108
|
+
<SidebarHeader>
|
|
109
|
+
{/* Brand Header */}
|
|
110
|
+
<SidebarMenu>
|
|
111
|
+
<SidebarMenuItem>
|
|
112
|
+
<SidebarMenuButton size="lg" asChild>
|
|
113
|
+
<Link to="/spine-framework/admin/configs/types">
|
|
114
|
+
<div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground">
|
|
115
|
+
<span className="text-sm font-bold">S</span>
|
|
116
|
+
</div>
|
|
117
|
+
<div className="flex flex-col gap-0.5 leading-none">
|
|
118
|
+
<span className="font-semibold">Spine</span>
|
|
119
|
+
<span className="text-xs text-muted-foreground">Framework</span>
|
|
120
|
+
</div>
|
|
121
|
+
</Link>
|
|
122
|
+
</SidebarMenuButton>
|
|
123
|
+
</SidebarMenuItem>
|
|
124
|
+
</SidebarMenu>
|
|
125
|
+
|
|
126
|
+
{/* Quick Create Button */}
|
|
127
|
+
<SidebarGroup className="py-2">
|
|
128
|
+
<Button className="w-full" size="sm">
|
|
129
|
+
<PlusIcon className="mr-2 h-4 w-4" />
|
|
130
|
+
Quick Create
|
|
131
|
+
</Button>
|
|
132
|
+
</SidebarGroup>
|
|
133
|
+
</SidebarHeader>
|
|
134
|
+
|
|
135
|
+
<SidebarContent>
|
|
136
|
+
{navigationSections.map((section) => (
|
|
137
|
+
<SidebarGroup key={section.title}>
|
|
138
|
+
<SidebarGroupLabel>{section.title}</SidebarGroupLabel>
|
|
139
|
+
<SidebarGroupContent>
|
|
140
|
+
<SidebarMenu>
|
|
141
|
+
{section.items.map((item) => (
|
|
142
|
+
<SidebarMenuItem key={item.title}>
|
|
143
|
+
<SidebarMenuButton asChild isActive={isActive(item.url)}>
|
|
144
|
+
<Link to={item.url}>
|
|
145
|
+
<item.icon className="h-4 w-4" />
|
|
146
|
+
<span>{item.title}</span>
|
|
147
|
+
</Link>
|
|
148
|
+
</SidebarMenuButton>
|
|
149
|
+
</SidebarMenuItem>
|
|
150
|
+
))}
|
|
151
|
+
</SidebarMenu>
|
|
152
|
+
</SidebarGroupContent>
|
|
153
|
+
</SidebarGroup>
|
|
154
|
+
))}
|
|
155
|
+
</SidebarContent>
|
|
156
|
+
|
|
157
|
+
<SidebarFooter className="p-4">
|
|
158
|
+
<div className="text-xs text-muted-foreground">
|
|
159
|
+
Spine v2.0
|
|
160
|
+
</div>
|
|
161
|
+
</SidebarFooter>
|
|
162
|
+
|
|
163
|
+
<SidebarRail />
|
|
164
|
+
</Sidebar>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module src/components/admin/AdminStatsCard
|
|
3
|
+
* @audience installer
|
|
4
|
+
* @layer frontend-component
|
|
5
|
+
* @stability stable
|
|
6
|
+
*
|
|
7
|
+
* Single stat card used in admin list page headers. Renders an icon,
|
|
8
|
+
* a title, and a numeric or string value inside a white rounded panel.
|
|
9
|
+
* Icon colour defaults to `'text-blue-500'` but can be overridden per card.
|
|
10
|
+
*
|
|
11
|
+
* @seeAlso src/components/admin/AdminListPage.tsx (mounts this component)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import React from 'react'
|
|
15
|
+
import { LucideIcon } from 'lucide-react'
|
|
16
|
+
import { Card, CardContent } from '../ui/card'
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Props for `AdminStatsCard`.
|
|
20
|
+
*
|
|
21
|
+
* @prop title - Stat label
|
|
22
|
+
* @prop value - Numeric or formatted string value to display
|
|
23
|
+
* @prop icon - Lucide icon component
|
|
24
|
+
* @prop iconColor - Tailwind text-colour class (default: `'text-blue-500'`)
|
|
25
|
+
*/
|
|
26
|
+
interface AdminStatsCardProps {
|
|
27
|
+
title: string
|
|
28
|
+
value: string | number
|
|
29
|
+
icon: LucideIcon
|
|
30
|
+
iconColor?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Single stat card.
|
|
35
|
+
*
|
|
36
|
+
* @param props - `AdminStatsCardProps`
|
|
37
|
+
* @returns White rounded card with icon and stat value
|
|
38
|
+
* @sideEffects none (pure rendering)
|
|
39
|
+
*/
|
|
40
|
+
export function AdminStatsCard({ title, value, icon: Icon, iconColor = "text-primary" }: AdminStatsCardProps) {
|
|
41
|
+
return (
|
|
42
|
+
<Card>
|
|
43
|
+
<CardContent className="p-5">
|
|
44
|
+
<div className="flex items-center">
|
|
45
|
+
<div className="flex-shrink-0">
|
|
46
|
+
<Icon className={`h-6 w-6 ${iconColor}`} />
|
|
47
|
+
</div>
|
|
48
|
+
<div className="ml-5 w-0 flex-1">
|
|
49
|
+
<dl>
|
|
50
|
+
<dt className="text-sm font-medium text-muted-foreground truncate">
|
|
51
|
+
{title}
|
|
52
|
+
</dt>
|
|
53
|
+
<dd className="text-lg font-semibold text-foreground">
|
|
54
|
+
{value}
|
|
55
|
+
</dd>
|
|
56
|
+
</dl>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</CardContent>
|
|
60
|
+
</Card>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ChevronUp, ChevronDown } from 'lucide-react'
|
|
3
|
+
import { TableHead } from '../ui/table'
|
|
4
|
+
|
|
5
|
+
interface SortableTableHeaderProps {
|
|
6
|
+
title: string
|
|
7
|
+
sortKey: string
|
|
8
|
+
currentSortKey?: string
|
|
9
|
+
currentSortDirection?: 'asc' | 'desc'
|
|
10
|
+
onSort: (key: string) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function SortableTableHeader({
|
|
14
|
+
title,
|
|
15
|
+
sortKey,
|
|
16
|
+
currentSortKey,
|
|
17
|
+
currentSortDirection,
|
|
18
|
+
onSort,
|
|
19
|
+
}: SortableTableHeaderProps) {
|
|
20
|
+
const isSorted = currentSortKey === sortKey
|
|
21
|
+
const isAscending = currentSortDirection === 'asc'
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<TableHead
|
|
25
|
+
className="cursor-pointer"
|
|
26
|
+
onClick={() => onSort(sortKey)}
|
|
27
|
+
>
|
|
28
|
+
<div className="flex items-center gap-1">
|
|
29
|
+
<span>{title}</span>
|
|
30
|
+
{isSorted && (
|
|
31
|
+
<span className="inline-flex">
|
|
32
|
+
{isAscending ? (
|
|
33
|
+
<ChevronUp className="h-4 w-4 text-foreground" />
|
|
34
|
+
) : (
|
|
35
|
+
<ChevronDown className="h-4 w-4 text-foreground" />
|
|
36
|
+
)}
|
|
37
|
+
</span>
|
|
38
|
+
)}
|
|
39
|
+
</div>
|
|
40
|
+
</TableHead>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Routes, Route, Navigate, useNavigate, useLocation } from 'react-router-dom'
|
|
3
|
+
import { AppRecord } from '../../hooks/useApps'
|
|
4
|
+
import { GenericListPage } from './GenericListPage'
|
|
5
|
+
import { GenericDetailPage } from './GenericDetailPage'
|
|
6
|
+
|
|
7
|
+
interface NavItem {
|
|
8
|
+
id: string
|
|
9
|
+
label: string
|
|
10
|
+
icon?: string
|
|
11
|
+
path: string
|
|
12
|
+
type_slug?: string
|
|
13
|
+
view?: string
|
|
14
|
+
min_role?: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface GenericAppShellProps {
|
|
18
|
+
app: AppRecord
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Data-driven app shell. Reads nav_items from the app record to build
|
|
23
|
+
* a sidebar and child routes. Each nav entry with a type_slug renders
|
|
24
|
+
* a GenericListPage (at path) and GenericDetailPage (at path/:id).
|
|
25
|
+
*/
|
|
26
|
+
export function GenericAppShell({ app }: GenericAppShellProps) {
|
|
27
|
+
const navigate = useNavigate()
|
|
28
|
+
const location = useLocation()
|
|
29
|
+
const [sidebarOpen, setSidebarOpen] = useState(false)
|
|
30
|
+
|
|
31
|
+
const navItems: NavItem[] = (app.nav_items || []) as NavItem[]
|
|
32
|
+
|
|
33
|
+
// Derive relative paths from app's route_prefix
|
|
34
|
+
const prefix = app.route_prefix || `/${app.slug}`
|
|
35
|
+
|
|
36
|
+
// Check if a nav item is active
|
|
37
|
+
const isActive = (item: NavItem) => {
|
|
38
|
+
const fullPath = item.path.startsWith('/') ? item.path : `${prefix}/${item.path}`
|
|
39
|
+
return location.pathname.startsWith(fullPath)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="min-h-screen bg-slate-50 flex">
|
|
44
|
+
{/* Sidebar */}
|
|
45
|
+
<aside className={`
|
|
46
|
+
fixed inset-y-0 left-0 z-40 w-64 bg-white border-r border-slate-200
|
|
47
|
+
transform transition-transform duration-200 ease-in-out
|
|
48
|
+
lg:translate-x-0 lg:static lg:inset-auto
|
|
49
|
+
${sidebarOpen ? 'translate-x-0' : '-translate-x-full'}
|
|
50
|
+
`}>
|
|
51
|
+
<div className="flex items-center gap-3 h-16 px-6 border-b border-slate-200">
|
|
52
|
+
{app.icon && (
|
|
53
|
+
<div className={`w-8 h-8 rounded-lg flex items-center justify-center text-white text-sm font-bold`}
|
|
54
|
+
style={{ backgroundColor: app.color || '#475569' }}>
|
|
55
|
+
{app.name.charAt(0).toUpperCase()}
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
<div>
|
|
59
|
+
<h2 className="font-semibold text-slate-900 text-sm">{app.name}</h2>
|
|
60
|
+
{app.description && (
|
|
61
|
+
<p className="text-xs text-slate-500 truncate max-w-[160px]">{app.description}</p>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<nav className="px-3 py-4 space-y-1">
|
|
67
|
+
{navItems.map(item => (
|
|
68
|
+
<button
|
|
69
|
+
key={item.id || item.path}
|
|
70
|
+
onClick={() => {
|
|
71
|
+
const target = item.path.startsWith('/') ? item.path : `${prefix}/${item.path}`
|
|
72
|
+
navigate(target)
|
|
73
|
+
setSidebarOpen(false)
|
|
74
|
+
}}
|
|
75
|
+
className={`
|
|
76
|
+
w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors
|
|
77
|
+
${isActive(item)
|
|
78
|
+
? 'bg-slate-100 text-slate-900 font-medium'
|
|
79
|
+
: 'text-slate-600 hover:bg-slate-50 hover:text-slate-900'
|
|
80
|
+
}
|
|
81
|
+
`}
|
|
82
|
+
>
|
|
83
|
+
<span>{item.label}</span>
|
|
84
|
+
</button>
|
|
85
|
+
))}
|
|
86
|
+
</nav>
|
|
87
|
+
</aside>
|
|
88
|
+
|
|
89
|
+
{/* Overlay for mobile sidebar */}
|
|
90
|
+
{sidebarOpen && (
|
|
91
|
+
<div
|
|
92
|
+
className="fixed inset-0 z-30 bg-black/20 lg:hidden"
|
|
93
|
+
onClick={() => setSidebarOpen(false)}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
|
|
97
|
+
{/* Main content */}
|
|
98
|
+
<div className="flex-1 min-w-0">
|
|
99
|
+
{/* Mobile header */}
|
|
100
|
+
<div className="lg:hidden flex items-center h-16 px-4 border-b border-slate-200 bg-white">
|
|
101
|
+
<button
|
|
102
|
+
onClick={() => setSidebarOpen(true)}
|
|
103
|
+
className="p-2 -ml-2 text-slate-600 hover:text-slate-900"
|
|
104
|
+
>
|
|
105
|
+
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
106
|
+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
|
|
107
|
+
</svg>
|
|
108
|
+
</button>
|
|
109
|
+
<span className="ml-3 font-semibold text-slate-900">{app.name}</span>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<main className="p-6">
|
|
113
|
+
<Routes>
|
|
114
|
+
{/* Default: redirect to first nav item */}
|
|
115
|
+
{navItems.length > 0 && (
|
|
116
|
+
<Route index element={
|
|
117
|
+
<Navigate to={navItems[0].path.startsWith('/') ? navItems[0].path : navItems[0].path} replace />
|
|
118
|
+
} />
|
|
119
|
+
)}
|
|
120
|
+
|
|
121
|
+
{/* Generate list + detail routes for each nav item with type_slug */}
|
|
122
|
+
{navItems.filter(item => item.type_slug).map(item => {
|
|
123
|
+
// Strip leading prefix to get relative route path
|
|
124
|
+
const relativePath = item.path.startsWith(prefix)
|
|
125
|
+
? item.path.slice(prefix.length).replace(/^\//, '')
|
|
126
|
+
: item.path.replace(/^\//, '')
|
|
127
|
+
|
|
128
|
+
return [
|
|
129
|
+
<Route
|
|
130
|
+
key={`${item.id}-list`}
|
|
131
|
+
path={relativePath}
|
|
132
|
+
element={
|
|
133
|
+
<GenericListPage
|
|
134
|
+
typeSlug={item.type_slug!}
|
|
135
|
+
viewSlug={item.view}
|
|
136
|
+
appPrefix={prefix}
|
|
137
|
+
detailPath={`${relativePath}`}
|
|
138
|
+
/>
|
|
139
|
+
}
|
|
140
|
+
/>,
|
|
141
|
+
<Route
|
|
142
|
+
key={`${item.id}-new`}
|
|
143
|
+
path={`${relativePath}/new`}
|
|
144
|
+
element={
|
|
145
|
+
<GenericDetailPage
|
|
146
|
+
typeSlug={item.type_slug!}
|
|
147
|
+
viewSlug={item.view}
|
|
148
|
+
isCreating={true}
|
|
149
|
+
/>
|
|
150
|
+
}
|
|
151
|
+
/>,
|
|
152
|
+
<Route
|
|
153
|
+
key={`${item.id}-detail`}
|
|
154
|
+
path={`${relativePath}/:id`}
|
|
155
|
+
element={
|
|
156
|
+
<GenericDetailPage
|
|
157
|
+
typeSlug={item.type_slug!}
|
|
158
|
+
viewSlug={item.view}
|
|
159
|
+
/>
|
|
160
|
+
}
|
|
161
|
+
/>
|
|
162
|
+
]
|
|
163
|
+
})}
|
|
164
|
+
|
|
165
|
+
{/* Empty state */}
|
|
166
|
+
{navItems.length === 0 && (
|
|
167
|
+
<Route path="*" element={
|
|
168
|
+
<div className="text-center py-16">
|
|
169
|
+
<h2 className="text-lg font-medium text-slate-900">No pages configured</h2>
|
|
170
|
+
<p className="mt-2 text-sm text-slate-500">
|
|
171
|
+
Add nav_items to this app's record to create pages.
|
|
172
|
+
</p>
|
|
173
|
+
</div>
|
|
174
|
+
} />
|
|
175
|
+
)}
|
|
176
|
+
</Routes>
|
|
177
|
+
</main>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
)
|
|
181
|
+
}
|