diff --git a/public/schemas/analytics-dashboard.json b/public/schemas/analytics-dashboard.json index fb69757..0caad8f 100644 --- a/public/schemas/analytics-dashboard.json +++ b/public/schemas/analytics-dashboard.json @@ -39,9 +39,13 @@ }, { "id": "trends", - "type": "computed", - "compute": "(data) => ({ filesGrowth: 12, modelsGrowth: -3, componentsGrowth: 8, testsGrowth: 15 })", - "dependencies": ["metrics"] + "type": "static", + "defaultValue": { + "filesGrowth": 12, + "modelsGrowth": -3, + "componentsGrowth": 8, + "testsGrowth": 15 + } } ], "components": [ diff --git a/public/schemas/file-manager.json b/public/schemas/file-manager.json index 0ceabe6..45ece9c 100644 --- a/public/schemas/file-manager.json +++ b/public/schemas/file-manager.json @@ -25,9 +25,12 @@ }, { "id": "filteredFiles", - "type": "computed", - "compute": "(data) => {\n if (!data.searchQuery) return data.files;\n return data.files.filter(f => f.name.toLowerCase().includes(data.searchQuery.toLowerCase()));\n}", - "dependencies": ["files", "searchQuery"] + "type": "static", + "expression": "data.files", + "dependencies": [ + "files", + "searchQuery" + ] } ], "components": [ diff --git a/src/components/ProjectDashboard.tsx b/src/components/ProjectDashboard.tsx index 3d72c11..2c176cd 100644 --- a/src/components/ProjectDashboard.tsx +++ b/src/components/ProjectDashboard.tsx @@ -45,11 +45,12 @@ function getCompletionMessage(score: number): string { } export function ProjectDashboard(props: ProjectDashboardProps) { + const completionMetrics = calculateCompletionScore(props) + return ( ) } diff --git a/src/components/atoms/DataSourceBadge.tsx b/src/components/atoms/DataSourceBadge.tsx index 8d2b2de..0837490 100644 --- a/src/components/atoms/DataSourceBadge.tsx +++ b/src/components/atoms/DataSourceBadge.tsx @@ -1,6 +1,6 @@ import { Badge } from '@/components/ui/badge' import { DataSourceType } from '@/types/json-ui' -import { Database, Function, File } from '@phosphor-icons/react' +import { Database, File } from '@phosphor-icons/react' interface DataSourceBadgeProps { type: DataSourceType @@ -13,11 +13,6 @@ const dataSourceConfig = { label: 'KV Storage', className: 'bg-accent/20 text-accent border-accent/30' }, - computed: { - icon: Function, - label: 'Computed', - className: 'bg-primary/20 text-primary border-primary/30' - }, static: { icon: File, label: 'Static', diff --git a/src/components/json-page-renderer/SectionRenderer.tsx b/src/components/json-page-renderer/SectionRenderer.tsx index e698c50..ac85f6d 100644 --- a/src/components/json-page-renderer/SectionRenderer.tsx +++ b/src/components/json-page-renderer/SectionRenderer.tsx @@ -108,7 +108,7 @@ function PageCard({ card, data, functions }: PageCardProps) { if (card.type === 'gradient-card') { const computeFn = functions[card.dataSource?.compute] - const computedData = computeFn ? computeFn(data) : {} + const computedData = computeFn ? computeFn(data) : data return ( diff --git a/src/components/molecules/DataSourceCard.tsx b/src/components/molecules/DataSourceCard.tsx index 2387604..8e0d03a 100644 --- a/src/components/molecules/DataSourceCard.tsx +++ b/src/components/molecules/DataSourceCard.tsx @@ -1,7 +1,7 @@ -import { Card, Badge, IconButton, Stack, Flex, Text } from '@/components/atoms' +import { Card, IconButton, Stack, Flex, Text } from '@/components/atoms' import { DataSourceBadge } from '@/components/atoms/DataSourceBadge' import { DataSource } from '@/types/json-ui' -import { Pencil, Trash, ArrowsDownUp } from '@phosphor-icons/react' +import { Pencil, Trash } from '@phosphor-icons/react' interface DataSourceCardProps { dataSource: DataSource @@ -11,13 +11,6 @@ interface DataSourceCardProps { } export function DataSourceCard({ dataSource, dependents = [], onEdit, onDelete }: DataSourceCardProps) { - const getDependencyCount = () => { - if (dataSource.type === 'computed') { - return dataSource.dependencies?.length || 0 - } - return 0 - } - const renderTypeSpecificInfo = () => { if (dataSource.type === 'kv') { return ( @@ -27,18 +20,6 @@ export function DataSourceCard({ dataSource, dependents = [], onEdit, onDelete } ) } - if (dataSource.type === 'computed') { - const depCount = getDependencyCount() - return ( - - - - {depCount} {depCount === 1 ? 'dependency' : 'dependencies'} - - - ) - } - return null } @@ -59,7 +40,7 @@ export function DataSourceCard({ dataSource, dependents = [], onEdit, onDelete } {dependents.length > 0 && (
- Used by {dependents.length} computed {dependents.length === 1 ? 'source' : 'sources'} + Used by {dependents.length} dependent {dependents.length === 1 ? 'source' : 'sources'}
)} diff --git a/src/components/molecules/DataSourceEditorDialog.tsx b/src/components/molecules/DataSourceEditorDialog.tsx index 20de4ae..1fa2ced 100644 --- a/src/components/molecules/DataSourceEditorDialog.tsx +++ b/src/components/molecules/DataSourceEditorDialog.tsx @@ -5,14 +5,12 @@ import { DataSourceBadge } from '@/components/atoms/DataSourceBadge' import { DataSourceIdField } from '@/components/molecules/data-source-editor/DataSourceIdField' import { KvSourceFields } from '@/components/molecules/data-source-editor/KvSourceFields' import { StaticSourceFields } from '@/components/molecules/data-source-editor/StaticSourceFields' -import { ComputedSourceFields } from '@/components/molecules/data-source-editor/ComputedSourceFields' import dataSourceEditorCopy from '@/data/data-source-editor-dialog.json' import { useDataSourceEditor } from '@/hooks/data/use-data-source-editor' interface DataSourceEditorDialogProps { open: boolean dataSource: DataSource | null - allDataSources: DataSource[] onOpenChange: (open: boolean) => void onSave: (dataSource: DataSource) => void } @@ -20,19 +18,13 @@ interface DataSourceEditorDialogProps { export function DataSourceEditorDialog({ open, dataSource, - allDataSources, onOpenChange, onSave, }: DataSourceEditorDialogProps) { const { editingSource, updateField, - addDependency, - removeDependency, - availableDeps, - selectedDeps, - unselectedDeps, - } = useDataSourceEditor(dataSource, allDataSources) + } = useDataSourceEditor(dataSource) const handleSave = () => { if (!editingSource) return @@ -80,18 +72,6 @@ export function DataSourceEditorDialog({ /> )} - {editingSource.type === 'computed' && ( - - )} diff --git a/src/components/molecules/data-source-editor/ComputedSourceFields.tsx b/src/components/molecules/data-source-editor/ComputedSourceFields.tsx deleted file mode 100644 index fa70389..0000000 --- a/src/components/molecules/data-source-editor/ComputedSourceFields.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import { Button } from '@/components/ui/button' -import { Label } from '@/components/ui/label' -import { Textarea } from '@/components/ui/textarea' -import { Badge } from '@/components/ui/badge' -import { DataSource } from '@/types/json-ui' -import { X } from '@phosphor-icons/react' - -interface ComputedSourceFieldsCopy { - expressionLabel: string - expressionPlaceholder: string - expressionHelp: string - valueTemplateLabel: string - valueTemplatePlaceholder: string - valueTemplateHelp: string - dependenciesLabel: string - availableSourcesLabel: string - emptyDependencies: string -} - -interface ComputedSourceFieldsProps { - editingSource: DataSource - availableDeps: DataSource[] - selectedDeps: string[] - unselectedDeps: DataSource[] - copy: ComputedSourceFieldsCopy - onUpdateField: (field: K, value: DataSource[K]) => void - onAddDependency: (depId: string) => void - onRemoveDependency: (depId: string) => void -} - -export function ComputedSourceFields({ - editingSource, - availableDeps, - selectedDeps, - unselectedDeps, - copy, - onUpdateField, - onAddDependency, - onRemoveDependency, -}: ComputedSourceFieldsProps) { - return ( - <> -
- -