This commit is contained in:
2026-04-03 20:09:36 +05:30
parent c73b55b737
commit cddc4d350f

View File

@@ -131,9 +131,9 @@ export default function EnhancedTable({
Add Add
</Button> </Button>
</Box> </Box>
<Grid container spacing={2}> <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
{data.map((row) => ( {data.map((row) => (
<Grid item xs={12} key={row[config.primaryKey] || Math.random()}> <Box key={row[config.primaryKey] || Math.random()}>
<MobileCardRow <MobileCardRow
row={row} row={row}
config={config} config={config}
@@ -142,9 +142,9 @@ export default function EnhancedTable({
onNavigate={onNavigateToResource} onNavigate={onNavigateToResource}
navigate={navigate} navigate={navigate}
/> />
</Grid> </Box>
))} ))}
</Grid> </Box>
</Box> </Box>
); );
} }
@@ -228,18 +228,18 @@ function MobileCardRow({ row, config, onDelete, onNavigate, navigate }: any) {
</Menu> </Menu>
</Box> </Box>
<Divider sx={{ mb: 2 }} /> <Divider sx={{ mb: 2 }} />
<Grid container spacing={1}> <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 2 }}>
{Object.entries(config.fields).slice(0, 5).map(([key, field]: [string, any]) => ( {Object.entries(config.fields).slice(0, 5).map(([key, field]: [string, any]) => (
<Grid item xs={6} key={key}> <Box key={key}>
<Typography variant="caption" color="text.secondary" sx={{ display: 'block' }}> <Typography variant="caption" color="text.secondary" sx={{ display: 'block' }}>
{field.label} {field.label}
</Typography> </Typography>
<Typography variant="body2" sx={{ fontWeight: 500, wordBreak: 'break-all' }}> <Typography variant="body2" sx={{ fontWeight: 500, wordBreak: 'break-all' }}>
<FieldRenderer params={{ value: row[key], row }} field={field} fieldKey={key} config={config} onNavigate={onNavigate} navigate={navigate} isMobile /> <FieldRenderer params={{ value: row[key], row }} field={field} fieldKey={key} config={config} onNavigate={onNavigate} navigate={navigate} isMobile />
</Typography> </Typography>
</Grid> </Box>
))} ))}
</Grid> </Box>
</CardContent> </CardContent>
<CardActions sx={{ justifyContent: 'flex-end', px: 2, pb: 2 }}> <CardActions sx={{ justifyContent: 'flex-end', px: 2, pb: 2 }}>
<Button size="small" onClick={() => navigate(`/${config.name}/${id}`)}>View Details</Button> <Button size="small" onClick={() => navigate(`/${config.name}/${id}`)}>View Details</Button>