diff --git a/examples/crm/src/Header.tsx b/examples/crm/src/Header.tsx index 20eefb0b70..f5405a2491 100644 --- a/examples/crm/src/Header.tsx +++ b/examples/crm/src/Header.tsx @@ -100,7 +100,7 @@ const Header = () => { /> {permissions === 'admin' && ( - - - - - + + + + Create sale person + + + + + + ); } diff --git a/examples/crm/src/sales/SalesEdit.tsx b/examples/crm/src/sales/SalesEdit.tsx index 4996072b3f..fb6facd299 100644 --- a/examples/crm/src/sales/SalesEdit.tsx +++ b/examples/crm/src/sales/SalesEdit.tsx @@ -9,7 +9,8 @@ import { useRecordContext, } from 'react-admin'; import { Sale } from '../types'; -import { SalesForm } from './SalesForm'; +import { SalesInputs } from './SalesInputs'; +import { Container, Typography } from '@mui/material'; function EditToolbar() { const { identity } = useGetIdentity(); @@ -33,14 +34,28 @@ function EditToolbar() { export function SalesEdit() { return ( - <> + }> - - - + + + + - + ); } + +const SaleEditTitle = () => { + const record = useRecordContext(); + if (!record) return null; + return ( + + Edit {record?.first_name} {record?.last_name} + + ); +}; diff --git a/examples/crm/src/sales/SalesForm.tsx b/examples/crm/src/sales/SalesForm.tsx deleted file mode 100644 index 0a816cd2d0..0000000000 --- a/examples/crm/src/sales/SalesForm.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - BooleanInput, - required, - TextInput, - useGetIdentity, - useRecordContext, -} from 'react-admin'; -import { Sale } from '../types'; - -export function SalesForm() { - const { identity } = useGetIdentity(); - const record = useRecordContext(); - - return ( - <> - - - - - - - ); -} diff --git a/examples/crm/src/sales/SalesInputs.tsx b/examples/crm/src/sales/SalesInputs.tsx new file mode 100644 index 0000000000..f68a389c59 --- /dev/null +++ b/examples/crm/src/sales/SalesInputs.tsx @@ -0,0 +1,41 @@ +import { + BooleanInput, + required, + TextInput, + useGetIdentity, + useRecordContext, +} from 'react-admin'; +import { Sale } from '../types'; +import { ReactNode } from 'react'; +import { Stack } from '@mui/material'; + +export function SalesInputs({ children }: { children: ReactNode }) { + const { identity } = useGetIdentity(); + const record = useRecordContext(); + + return ( + + + + + {children} + + + ); +} diff --git a/examples/crm/src/sales/SalesList.tsx b/examples/crm/src/sales/SalesList.tsx index 03695e57d0..59589b80af 100644 --- a/examples/crm/src/sales/SalesList.tsx +++ b/examples/crm/src/sales/SalesList.tsx @@ -15,7 +15,7 @@ function SalesListActions() { return ( - + ); } @@ -34,7 +34,7 @@ export function SalesList() { - + diff --git a/examples/crm/src/settings/SettingsPage.tsx b/examples/crm/src/settings/SettingsPage.tsx index bf28bf465f..a78bcf4224 100644 --- a/examples/crm/src/settings/SettingsPage.tsx +++ b/examples/crm/src/settings/SettingsPage.tsx @@ -105,7 +105,7 @@ const SettingsForm = ({ {isEditMode ? 'Show' : 'Edit'} - + diff --git a/examples/crm/src/settings/UpdatePassword.tsx b/examples/crm/src/settings/UpdatePassword.tsx index 79006b1cf2..12061bf2b9 100644 --- a/examples/crm/src/settings/UpdatePassword.tsx +++ b/examples/crm/src/settings/UpdatePassword.tsx @@ -8,8 +8,15 @@ import { TextField, Typography, } from '@mui/material'; -import { useGetIdentity, useGetOne, useNotify, useUpdate } from 'react-admin'; +import { + Toolbar, + useGetIdentity, + useGetOne, + useNotify, + useUpdate, +} from 'react-admin'; import { useForm } from 'react-hook-form'; +import { DialogCloseButton } from '../misc/DialogCloseButton'; const PASSWORD_POLICY = { regex: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/, // Example policy: Minimum 8 characters, at least one letter and one number @@ -75,17 +82,18 @@ export const UpdatePassword = ({ return ( + Change Password - - - Password for Jane Doe account is "demo" - -
- + + + + Password for Jane Doe account is "demo" + + - - + + + - - -
+ + +
); };