diff --git a/package.json b/package.json index 5cb63de..d743261 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "react-dom": "^18.0.0", "react-router": "^6.22.0", "react-router-dom": "^6.22.0", - "recharts": "^2.1.5", + "recharts": "^2.15.1", "rrule": "^2.7.2" }, "scripts": { @@ -82,5 +82,9 @@ "start-server-and-test": "^1.12.2", "typescript": "^5.1.3", "vite": "^5.0.11" + }, + "resolutions": { + "react-router": "^6.28.2", + "react-router-dom": "^6.28.2" } } diff --git a/src/dashboard/NewCustomers.tsx b/src/dashboard/NewCustomers.tsx index a3995df..9ab0e29 100644 --- a/src/dashboard/NewCustomers.tsx +++ b/src/dashboard/NewCustomers.tsx @@ -4,8 +4,8 @@ import { Box, Button, List, - ListItem, ListItemAvatar, + ListItemButton, ListItemText, } from '@mui/material'; import CustomerIcon from '@mui/icons-material/PersonAdd'; @@ -46,8 +46,7 @@ const NewCustomers = () => { {visitors ? visitors.map((record: Customer) => ( - { - + )) : null} diff --git a/src/dashboard/PendingOrder.tsx b/src/dashboard/PendingOrder.tsx index 155eddb..7b4b8f7 100644 --- a/src/dashboard/PendingOrder.tsx +++ b/src/dashboard/PendingOrder.tsx @@ -1,11 +1,11 @@ import * as React from 'react'; import { ListItem, - ListItemSecondaryAction, ListItemAvatar, ListItemText, Avatar, Box, + ListItemButton, } from '@mui/material'; import { Link } from 'react-router-dom'; import { useTranslate, useReference } from 'react-admin'; @@ -26,30 +26,9 @@ export const PendingOrder = (props: Props) => { }); return ( - - - {isPending ? ( - - ) : ( - - )} - - - + { > {formatNumberAsUSD(order.total, 2)} - + } + > + + + {isPending ? ( + + ) : ( + + )} + + + ); }; diff --git a/src/dashboard/PendingReviews.tsx b/src/dashboard/PendingReviews.tsx index df0ed62..2d99fc5 100644 --- a/src/dashboard/PendingReviews.tsx +++ b/src/dashboard/PendingReviews.tsx @@ -4,8 +4,8 @@ import { Box, Button, List, - ListItem, ListItemAvatar, + ListItemButton, ListItemText, } from '@mui/material'; import CommentIcon from '@mui/icons-material/Comment'; @@ -54,9 +54,8 @@ const PendingReviews = () => { > {reviews?.map((record: Review) => ( - { paddingRight: 0, }} /> - + ))}   diff --git a/src/products/GridList.tsx b/src/products/GridList.tsx index 0c27daf..86c59de 100644 --- a/src/products/GridList.tsx +++ b/src/products/GridList.tsx @@ -72,7 +72,7 @@ const LoadedGridList = () => { const { data: locks } = useGetLocks(resource!, {}, { enabled: !!resource }); const cols = useColsForWidth(); const createPath = useCreatePath(); - const firstLockRecordId = React.useRef(); + const firstLockRecordId = React.useRef(undefined); if (!data) return null; diff --git a/src/reviews/ReviewItem.tsx b/src/reviews/ReviewItem.tsx index 1c87221..5cfe2c2 100644 --- a/src/reviews/ReviewItem.tsx +++ b/src/reviews/ReviewItem.tsx @@ -1,15 +1,14 @@ import * as React from 'react'; import { Fragment } from 'react'; -import { ListItem, ListItemAvatar, ListItemText } from '@mui/material'; +import { ListItemAvatar, ListItemButton, ListItemText } from '@mui/material'; import { useCreatePath, ReferenceField, FunctionField, - Link, TextField, useRecordContext, } from 'react-admin'; - +import { Link } from 'react-router-dom'; import AvatarField from '../visitors/AvatarField'; import { Review, Customer } from './../types'; @@ -20,59 +19,53 @@ export const ReviewItem = () => { return null; } return ( - - - - - - - - - - - render={record => - record - ? `${record.first_name} ${record.last_name}` - : '' - } - variant="subtitle1" - /> - {' '} - on{' '} - - - - - } - secondary={record.comment} - secondaryTypographyProps={{ noWrap: true }} - /> - - + + + + + + + + + render={record => + record + ? `${record.first_name} ${record.last_name}` + : '' + } + variant="subtitle1" + /> + {' '} + on{' '} + + + + + } + secondary={record.comment} + secondaryTypographyProps={{ noWrap: true }} + /> + ); }; diff --git a/src/visitors/DesktopGrid.tsx b/src/visitors/DesktopGrid.tsx index d67027b..eff8275 100644 --- a/src/visitors/DesktopGrid.tsx +++ b/src/visitors/DesktopGrid.tsx @@ -3,6 +3,7 @@ import { Box, Card, CardContent, IconButton, useTheme } from '@mui/material'; import { Link as RouterLink } from 'react-router-dom'; import { + FieldProps, RecordContextProvider, useCreatePath, useListContext, @@ -82,7 +83,9 @@ const DesktopGrid = ({ children }: { children: ReactElement[] }) => { {Children.map(children, field => { - const fieldName = field.props.source; + const fieldName = ( + field as ReactElement + ).props.source; // We already display the customer above if (fieldName === 'customer_id') { diff --git a/vite.config.ts b/vite.config.ts index 4e12884..0307ba9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -14,14 +14,21 @@ export default defineConfig(async () => { for (const dirName of packages) { if (dirName === 'create-react-admin') continue; // eslint-disable-next-line prettier/prettier - const packageJson = await import( - path.resolve(__dirname, '../packages', dirName, 'package.json'), - { assert: { type: 'json' } } + const packageJson = JSON.parse( + fs.readFileSync( + path.resolve( + __dirname, + '../packages', + dirName, + 'package.json' + ), + 'utf8' + ) ); - aliases[packageJson.default.name] = path.resolve( + aliases[packageJson.name] = path.resolve( __dirname, `${path.resolve('../')}/packages/${ - packageJson.default.name.split('@react-admin/')[1] + packageJson.name.split('@react-admin/')[1] }/src` ); }