configuration for how fields look and EnhancedTable component for enhanced table display
This commit is contained in:
@@ -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 }}>
|
||||
|
||||
Reference in New Issue
Block a user