From a8660b6c52d32f75faafd4c9525303d9c33ef35c Mon Sep 17 00:00:00 2001 From: vgeffer Date: Sun, 15 Dec 2024 11:58:14 +0100 Subject: [PATCH 1/2] Unified fields across page --- .../competition/problems/ProblemCreate.tsx | 13 +++++++++++-- .../competition/problems/ProblemEdit.tsx | 13 +++++++++++-- .../competition/series/SeriesCreate.tsx | 16 +++++++++++----- .../resources/competition/series/SeriesEdit.tsx | 7 +++---- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/components/Admin/resources/competition/problems/ProblemCreate.tsx b/src/components/Admin/resources/competition/problems/ProblemCreate.tsx index 34079f67..f53e54bd 100644 --- a/src/components/Admin/resources/competition/problems/ProblemCreate.tsx +++ b/src/components/Admin/resources/competition/problems/ProblemCreate.tsx @@ -1,5 +1,14 @@ import {FC} from 'react' -import {FileInput, FormTab, ImageInput, ReferenceInput, required, SelectInput, TabbedForm, TextInput} from 'react-admin' +import { + AutocompleteInput, + FileInput, + FormTab, + ImageInput, + ReferenceInput, + required, + TabbedForm, + TextInput, +} from 'react-admin' import {LatexPreview} from '@/components/Admin/custom/LatexPreview' import {MyCreate} from '@/components/Admin/custom/MyCreate' @@ -19,7 +28,7 @@ export const ProblemCreate: FC = () => ( - + diff --git a/src/components/Admin/resources/competition/problems/ProblemEdit.tsx b/src/components/Admin/resources/competition/problems/ProblemEdit.tsx index ca9d2e9c..51f69cbe 100644 --- a/src/components/Admin/resources/competition/problems/ProblemEdit.tsx +++ b/src/components/Admin/resources/competition/problems/ProblemEdit.tsx @@ -1,5 +1,14 @@ import {FC} from 'react' -import {FileInput, FormTab, ImageInput, ReferenceInput, required, SelectInput, TabbedForm, TextInput} from 'react-admin' +import { + AutocompleteInput, + FileInput, + FormTab, + ImageInput, + ReferenceInput, + required, + TabbedForm, + TextInput, +} from 'react-admin' import {LatexPreview} from '@/components/Admin/custom/LatexPreview' import {MyEdit} from '@/components/Admin/custom/MyEdit' @@ -19,7 +28,7 @@ export const ProblemEdit: FC = () => ( - + diff --git a/src/components/Admin/resources/competition/series/SeriesCreate.tsx b/src/components/Admin/resources/competition/series/SeriesCreate.tsx index 5b3ca9e0..e29db966 100644 --- a/src/components/Admin/resources/competition/series/SeriesCreate.tsx +++ b/src/components/Admin/resources/competition/series/SeriesCreate.tsx @@ -1,19 +1,25 @@ import {FC} from 'react' -import {BooleanInput, FormTab, ReferenceInput, required, SelectInput, TabbedForm, TextInput} from 'react-admin' +import {AutocompleteInput, FormTab, NumberInput, ReferenceInput, required, TabbedForm} from 'react-admin' import {MyCreate} from '@/components/Admin/custom/MyCreate' import {MyDateTimeInput} from '@/components/Admin/custom/MyDateTimeInput' export const SeriesCreate: FC = () => ( - + { + // automaticky sa na BE posiela cely record, ale BE read_only (aj neexistujuce) fieldy ignoruje + // radsej z payloadu odstranime aspon sety + delete record.problems + return record + }} + > - + - - + diff --git a/src/components/Admin/resources/competition/series/SeriesEdit.tsx b/src/components/Admin/resources/competition/series/SeriesEdit.tsx index e49759eb..0e64586c 100644 --- a/src/components/Admin/resources/competition/series/SeriesEdit.tsx +++ b/src/components/Admin/resources/competition/series/SeriesEdit.tsx @@ -1,5 +1,5 @@ import {FC} from 'react' -import {BooleanInput, FormTab, ReferenceInput, required, SelectInput, TabbedForm, TextInput} from 'react-admin' +import {AutocompleteInput, FormTab, NumberInput, ReferenceInput, required, TabbedForm} from 'react-admin' import {MyDateTimeInput} from '@/components/Admin/custom/MyDateTimeInput' import {MyEdit} from '@/components/Admin/custom/MyEdit' @@ -16,11 +16,10 @@ export const SeriesEdit: FC = () => ( - + - - + From 6afec26321ae4823551a6c9f8f027654119e10c1 Mon Sep 17 00:00:00 2001 From: vgeffer Date: Sun, 15 Dec 2024 12:16:25 +0100 Subject: [PATCH 2/2] Remove unneceseary code --- .../Admin/resources/competition/series/SeriesCreate.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/components/Admin/resources/competition/series/SeriesCreate.tsx b/src/components/Admin/resources/competition/series/SeriesCreate.tsx index e29db966..000cde3a 100644 --- a/src/components/Admin/resources/competition/series/SeriesCreate.tsx +++ b/src/components/Admin/resources/competition/series/SeriesCreate.tsx @@ -5,14 +5,7 @@ import {MyCreate} from '@/components/Admin/custom/MyCreate' import {MyDateTimeInput} from '@/components/Admin/custom/MyDateTimeInput' export const SeriesCreate: FC = () => ( - { - // automaticky sa na BE posiela cely record, ale BE read_only (aj neexistujuce) fieldy ignoruje - // radsej z payloadu odstranime aspon sety - delete record.problems - return record - }} - > +