New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | RecordContextProvider, |
| | | ReferenceManyField, |
| | | ShowBase, |
| | | SortButton, |
| | | TabbedShowLayout, |
| | | useListContext, |
| | | useRecordContext, |
| | | useShowContext, |
| | | } from 'react-admin'; |
| | | import { Link as RouterLink, useLocation } from 'react-router-dom'; |
| | | import { |
| | | Box, |
| | | Button, |
| | | Card, |
| | | CardContent, |
| | | List, |
| | | ListItem, |
| | | ListItemAvatar, |
| | | ListItemSecondaryAction, |
| | | ListItemText, |
| | | Stack, |
| | | Typography, |
| | | } from '@mui/material'; |
| | | import { formatDistance } from 'date-fns'; |
| | | |
| | | |
| | | export const AgvShow = () => { |
| | | |
| | | return ( |
| | | <> |
| | | <ShowBase> |
| | | <AgvShowContent /> |
| | | </ShowBase> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | const AgvShowContent = (props) => { |
| | | const { record, isPending } = useShowContext(); |
| | | if (isPending || !record) return null; |
| | | |
| | | return ( |
| | | <> |
| | | <Box mt={2} display="flex"> |
| | | <Box flex="1"> |
| | | <Card> |
| | | <CardContent> |
| | | <Box display="flex" mb={1}> |
| | | <Typography variant="h5" ml={2} flex="1"> |
| | | {record.uuid} |
| | | </Typography> |
| | | </Box> |
| | | |
| | | <TabbedShowLayout |
| | | sx={{ |
| | | '& .RaTabbedShowLayout-content': { p: 0 }, |
| | | }} |
| | | > |
| | | <TabbedShowLayout.Tab label="Activity"> |
| | | </TabbedShowLayout.Tab> |
| | | </TabbedShowLayout> |
| | | </CardContent> |
| | | </Card> |
| | | </Box> |
| | | <AgvShowAside /> |
| | | </Box> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | const AgvShowAside = (props) => { |
| | | const { record, isPending } = useShowContext(); |
| | | |
| | | return (<> |
| | | <h1>{JSON.stringify(record)}</h1> |
| | | </>) |
| | | } |
| | |
| | | |
| | | import { AgvList, AgvGrid } from "./AgvList"; |
| | | import AgvEdit from "./AgvEdit"; |
| | | import { AgvShow } from "./AgvShow"; |
| | | |
| | | export default { |
| | | // list: AgvList, |
| | | list: AgvGrid, |
| | | edit: AgvEdit, |
| | | show: ShowGuesser, |
| | | show: AgvShow, |
| | | recordRepresentation: (record) => { |
| | | return `${record.uuid}` |
| | | } |