configuration for how fields look and EnhancedTable component for enhanced table display

This commit is contained in:
2026-04-01 18:47:23 +05:30
parent 344106f1a4
commit 44567496a1
8 changed files with 298 additions and 512 deletions

View File

@@ -1,15 +1,16 @@
import * as React from 'react';
import { Box, Typography, Button, Paper, CircularProgress } from '@mui/material';
import { Box, Typography, Paper, CircularProgress } from '@mui/material';
import { ResourceConfig } from '../types/config';
import { useResource } from '../hooks/useResource';
import GenericTable from './GenericTable';
import GenericForm from './GenericForm';
import EnhancedTable from './EnhancedTable';
interface ResourceViewProps {
config: ResourceConfig;
onNavigateToResource?: (resourceName: string, id: string) => void;
}
export default function ResourceView({ config }: ResourceViewProps) {
export default function ResourceView({ config, onNavigateToResource }: ResourceViewProps) {
const [view, setView] = React.useState<'list' | 'create' | 'edit'>('list');
const [selectedItem, setSelectedItem] = React.useState<any>(null);
@@ -56,12 +57,13 @@ export default function ResourceView({ config }: ResourceViewProps) {
return (
<Box>
{view === 'list' ? (
<GenericTable
<EnhancedTable
config={config}
data={data || []}
onEdit={handleEdit}
onDelete={handleDelete}
onCreate={handleCreate}
onNavigateToResource={onNavigateToResource}
/>
) : (
<Paper sx={{ p: 4 }}>