vincentlu
2025-02-05 9d79b8c8d34077ebf782a7b61d54ee4e1debdba1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React, { useState, useRef, useEffect, useMemo } from "react";
import {
    useTranslate,
    useRecordContext,
    SimpleShowLayout,
    DateField,
} from 'react-admin';
import { Card, CardContent, Box, Typography, Grid } from '@mui/material';
import StatusField from "./StatusField";
import AccessTimeIcon from '@mui/icons-material/AccessTime';
 
const BasicAside = () => {
    const translate = useTranslate();
    const record = useRecordContext();
 
    return (
        <Box width={400} display={{ xs: 'none', lg: 'block' }}>
            {record && (
                <Box ml={2}>
                    <Card>
                        <CardContent>
                            <Typography variant="h6" gutterBottom>
                                {translate('common.edit.side.title')}
                            </Typography>
                            <Grid container rowSpacing={2} columnSpacing={1}>
                                <Grid item xs={12} display="flex" gap={1}>
                                    <StatusField label="Status" />
                                </Grid>
                                <Grid item xs={12} display="flex" gap={1}>
                                    <AccessTimeIcon fontSize="small" color="disabled" />
                                    <Box flexGrow={1}>
                                        <Typography variant="body2">
                                            {translate('common.field.createTime')}
                                        </Typography>
                                        <DateField
                                            record={record}
                                            source="createTime"
                                            showTime
                                        />
                                    </Box>
                                </Grid>
                                <Grid item xs={12} display="flex" gap={1}>
                                    <AccessTimeIcon fontSize="small" color="disabled" />
                                    <Box flexGrow={1}>
                                        <Typography variant="body2">
                                            {translate('common.field.updateTime')}
                                        </Typography>
                                        <DateField
                                            record={record}
                                            source="updateTime"
                                            showTime
                                        />
                                    </Box>
                                </Grid>
                            </Grid>
                        </CardContent>
                    </Card>
                </Box>
            )}
        </Box>
    );
}
 
export default BasicAside;