From 3acd9004d8f485802d84c0a1c7385738ba387bf6 Mon Sep 17 00:00:00 2001 From: Michal Masrna Date: Sun, 24 Nov 2024 00:25:02 +0100 Subject: [PATCH 1/2] RA Profile --- src/components/Admin/Admin.tsx | 11 ++++++++- .../personal/profiles/ProfileCreate.tsx | 24 +++++++++++++++++++ .../personal/profiles/ProfileEdit.tsx | 1 + .../personal/profiles/ProfileList.tsx | 15 ++++++++++++ .../personal/profiles/ProfileShow.tsx | 17 +++++++++++++ 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/components/Admin/resources/personal/profiles/ProfileCreate.tsx create mode 100644 src/components/Admin/resources/personal/profiles/ProfileEdit.tsx create mode 100644 src/components/Admin/resources/personal/profiles/ProfileList.tsx create mode 100644 src/components/Admin/resources/personal/profiles/ProfileShow.tsx diff --git a/src/components/Admin/Admin.tsx b/src/components/Admin/Admin.tsx index 71198c37..d5a29fcc 100644 --- a/src/components/Admin/Admin.tsx +++ b/src/components/Admin/Admin.tsx @@ -38,6 +38,9 @@ import {SolutionCreate} from './resources/competition/solution/SolutionCreate' import {SolutionEdit} from './resources/competition/solution/SolutionEdit' import {SolutionList} from './resources/competition/solution/SolutionList' import {SolutionShow} from './resources/competition/solution/SolutionShow' +import {ProfileCreate} from './resources/personal/profiles/ProfileCreate' +import {ProfileList} from './resources/personal/profiles/ProfileList' +import {ProfileShow} from './resources/personal/profiles/ProfileShow' import {useAuthProvider} from './useAuthProvider' export const Admin: FC = () => { @@ -110,7 +113,13 @@ export const Admin: FC = () => { create={EventRegistrationCreate} /> - + ) diff --git a/src/components/Admin/resources/personal/profiles/ProfileCreate.tsx b/src/components/Admin/resources/personal/profiles/ProfileCreate.tsx new file mode 100644 index 00000000..693c8b18 --- /dev/null +++ b/src/components/Admin/resources/personal/profiles/ProfileCreate.tsx @@ -0,0 +1,24 @@ +import {FC} from 'react' +import {AutocompleteInput, ReferenceInput, required, SimpleForm, TextInput} from 'react-admin' + +import {MyCreate} from '@/components/Admin/custom/MyCreate' + +export const ProfileCreate: FC = () => ( + { + const {school, ...rest} = record + return {...rest, school_id: school} + }} + > + + + + + + + + + + + +) diff --git a/src/components/Admin/resources/personal/profiles/ProfileEdit.tsx b/src/components/Admin/resources/personal/profiles/ProfileEdit.tsx new file mode 100644 index 00000000..ccf157ab --- /dev/null +++ b/src/components/Admin/resources/personal/profiles/ProfileEdit.tsx @@ -0,0 +1 @@ +// For now we have decided we do not want to edit user profile in React Admin diff --git a/src/components/Admin/resources/personal/profiles/ProfileList.tsx b/src/components/Admin/resources/personal/profiles/ProfileList.tsx new file mode 100644 index 00000000..f481cabb --- /dev/null +++ b/src/components/Admin/resources/personal/profiles/ProfileList.tsx @@ -0,0 +1,15 @@ +import {FC} from 'react' +import {Datagrid, List, ReferenceField, TextField} from 'react-admin' + +export const ProfileList: FC = () => ( + + + + + + + + + + +) diff --git a/src/components/Admin/resources/personal/profiles/ProfileShow.tsx b/src/components/Admin/resources/personal/profiles/ProfileShow.tsx new file mode 100644 index 00000000..b0c5af85 --- /dev/null +++ b/src/components/Admin/resources/personal/profiles/ProfileShow.tsx @@ -0,0 +1,17 @@ +import {FC} from 'react' +import {ReferenceField, SimpleShowLayout, TextField} from 'react-admin' + +import {MyShow} from '@/components/Admin/custom/MyShow' + +export const ProfileShow: FC = () => ( + + + + + + + + + + +) From 6c6861e23087fe77dd7cd5d85352621391b93095 Mon Sep 17 00:00:00 2001 From: Michal Masrna Date: Sun, 24 Nov 2024 00:34:20 +0100 Subject: [PATCH 2/2] lint fix --- .../Admin/resources/personal/profiles/ProfileCreate.tsx | 8 ++++---- .../Admin/resources/personal/profiles/ProfileList.tsx | 2 +- .../Admin/resources/personal/profiles/ProfileShow.tsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Admin/resources/personal/profiles/ProfileCreate.tsx b/src/components/Admin/resources/personal/profiles/ProfileCreate.tsx index 693c8b18..06ab0963 100644 --- a/src/components/Admin/resources/personal/profiles/ProfileCreate.tsx +++ b/src/components/Admin/resources/personal/profiles/ProfileCreate.tsx @@ -13,11 +13,11 @@ export const ProfileCreate: FC = () => ( - - + + - - + + diff --git a/src/components/Admin/resources/personal/profiles/ProfileList.tsx b/src/components/Admin/resources/personal/profiles/ProfileList.tsx index f481cabb..8bdf98d9 100644 --- a/src/components/Admin/resources/personal/profiles/ProfileList.tsx +++ b/src/components/Admin/resources/personal/profiles/ProfileList.tsx @@ -7,7 +7,7 @@ export const ProfileList: FC = () => ( - + diff --git a/src/components/Admin/resources/personal/profiles/ProfileShow.tsx b/src/components/Admin/resources/personal/profiles/ProfileShow.tsx index b0c5af85..69392172 100644 --- a/src/components/Admin/resources/personal/profiles/ProfileShow.tsx +++ b/src/components/Admin/resources/personal/profiles/ProfileShow.tsx @@ -9,7 +9,7 @@ export const ProfileShow: FC = () => ( - +