Skip to content

Commit

Permalink
Unified fields across page (#543)
Browse files Browse the repository at this point in the history
* Unified fields across page

* Remove unneceseary code
  • Loading branch information
vgeffer authored Dec 15, 2024
1 parent 66315d1 commit 5b79ef7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -19,7 +28,7 @@ export const ProblemCreate: FC = () => (
<TabbedForm>
<FormTab label="content.labels.general">
<ReferenceInput source="series" reference="competition/series">
<SelectInput fullWidth validate={required()} />
<AutocompleteInput optionText="verbose_name" fullWidth validate={required()} />
</ReferenceInput>
<TextInput source="text" multiline fullWidth validate={required()} />
<LatexPreview source="text" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -19,7 +28,7 @@ export const ProblemEdit: FC = () => (
<TabbedForm>
<FormTab label="content.labels.general">
<ReferenceInput source="series" reference="competition/series">
<SelectInput fullWidth validate={required()} />
<AutocompleteInput optionText="verbose_name" validate={required()} />
</ReferenceInput>
<TextInput source="text" multiline fullWidth validate={required()} />
<LatexPreview source="text" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {MyCreate} from '@/components/Admin/custom/MyCreate'
import {MyDateTimeInput} from '@/components/Admin/custom/MyDateTimeInput'
Expand All @@ -9,11 +9,10 @@ export const SeriesCreate: FC = () => (
<TabbedForm>
<FormTab label="content.labels.general">
<ReferenceInput source="semester" reference="competition/semester">
<SelectInput fullWidth validate={required()} />
<AutocompleteInput optionText="verbose_name" fullWidth validate={required()} />
</ReferenceInput>
<MyDateTimeInput source="deadline" fullWidth validate={required()} />
<TextInput source="order" fullWidth validate={required()} />
<BooleanInput source="complete" disabled />
<NumberInput source="order" fullWidth validate={required()} />
</FormTab>
</TabbedForm>
</MyCreate>
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -16,11 +16,10 @@ export const SeriesEdit: FC = () => (
<TabbedForm>
<FormTab label="content.labels.general">
<ReferenceInput source="semester" reference="competition/semester">
<SelectInput fullWidth validate={required()} />
<AutocompleteInput optionText="verbose_name" fullWidth validate={required()} />
</ReferenceInput>
<MyDateTimeInput source="deadline" fullWidth validate={required()} />
<TextInput source="order" fullWidth validate={required()} />
<BooleanInput source="complete" disabled />
<NumberInput source="order" fullWidth validate={required()} />
</FormTab>
</TabbedForm>
</MyEdit>
Expand Down

0 comments on commit 5b79ef7

Please sign in to comment.