diff --git a/src/components/Admin/Admin.tsx b/src/components/Admin/Admin.tsx index 76d8b64e..bdf3ab25 100644 --- a/src/components/Admin/Admin.tsx +++ b/src/components/Admin/Admin.tsx @@ -10,7 +10,6 @@ import {PostCreate} from './resources/cms/post/PostCreate' import {PostEdit} from './resources/cms/post/PostEdit' import {PostList} from './resources/cms/post/PostList' import {PostShow} from './resources/cms/post/PostShow' -import {CompetitionCreate} from './resources/competition/competition/CompetitionCreate' import {CompetitionEdit} from './resources/competition/competition/CompetitionEdit' import {CompetitionList} from './resources/competition/competition/CompetitionList' import {CompetitionShow} from './resources/competition/competition/CompetitionShow' @@ -31,13 +30,8 @@ export const Admin: FC = () => { - + {/* nedovolujeme create na competition - velmi rare vec, ani nemame BE POST endpoint na to */} + ( - - - - {/* */} - - - - - {/* TODO: radio buttons / select */} - - - - - {/* maju sa dat eventy vytvarat pri tvoreni competition? */} - - - - {/* */} - - - - - - {/* unspecifiedpublication_set: UnspecifiedPublication[] - registration_links: RegistrationLink[] */} - - - - - -) diff --git a/src/components/Admin/resources/competition/competition/CompetitionEdit.tsx b/src/components/Admin/resources/competition/competition/CompetitionEdit.tsx index 8e5f06ca..e7b8fad2 100644 --- a/src/components/Admin/resources/competition/competition/CompetitionEdit.tsx +++ b/src/components/Admin/resources/competition/competition/CompetitionEdit.tsx @@ -1,34 +1,21 @@ import {FC} from 'react' -import {ArrayInput, FormTab, NumberInput, required, SimpleFormIterator, TabbedForm, TextInput} from 'react-admin' +import {NumberInput, SimpleForm, TextInput} from 'react-admin' import {MyEdit} from '@/components/Admin/custom/MyEdit' import {SitesCheckboxInput} from '@/components/Admin/custom/SitesCheckboxInput' export const CompetitionEdit: FC = () => ( - - - - - - - - - - - - - - {/* unspecifiedpublication_set: UnspecifiedPublication[] - registration_links: RegistrationLink[] */} - - - - - - - - - + + + + + + + + + + + ) diff --git a/src/components/Admin/resources/competition/competition/CompetitionList.tsx b/src/components/Admin/resources/competition/competition/CompetitionList.tsx index 30be4165..0a0d17bd 100644 --- a/src/components/Admin/resources/competition/competition/CompetitionList.tsx +++ b/src/components/Admin/resources/competition/competition/CompetitionList.tsx @@ -12,7 +12,6 @@ export const CompetitionList: FC = () => ( - {/* */} diff --git a/src/components/Admin/resources/competition/competition/CompetitionShow.tsx b/src/components/Admin/resources/competition/competition/CompetitionShow.tsx index 42bc394b..a690a0f0 100644 --- a/src/components/Admin/resources/competition/competition/CompetitionShow.tsx +++ b/src/components/Admin/resources/competition/competition/CompetitionShow.tsx @@ -1,9 +1,12 @@ +import {Divider} from '@mui/material' import {FC} from 'react' import { ArrayField, Datagrid, DateField, + FunctionField, NumberField, + RaRecord, Show, SimpleShowLayout, Tab, @@ -11,11 +14,12 @@ import { TextField, } from 'react-admin' -import {JsonField} from '@/components/Admin/custom/JsonField' import {MyShowActions} from '@/components/Admin/custom/MyShowActions' import {SitesArrayField} from '@/components/Admin/custom/SitesArrayField' import {TruncatedTextField} from '@/components/Admin/custom/TruncatedTextField' +import {UpcomingOrCurrentEvent} from './UpcomingOrCurrentEvent' + export const CompetitionShow: FC = () => ( }> @@ -26,24 +30,29 @@ export const CompetitionShow: FC = () => ( - - + - - + + + + - + `/competition/event/${id}/show`}> + - - + + source="publication_set" + label="Publication count" + render={(record) => record && {record['publication_set'].length}} + /> diff --git a/src/components/Admin/resources/competition/competition/UpcomingOrCurrentEvent.tsx b/src/components/Admin/resources/competition/competition/UpcomingOrCurrentEvent.tsx new file mode 100644 index 00000000..661109a0 --- /dev/null +++ b/src/components/Admin/resources/competition/competition/UpcomingOrCurrentEvent.tsx @@ -0,0 +1,45 @@ +import {FC} from 'react' +import { + DateField, + FunctionField, + Labeled, + NumberField, + RaRecord, + SimpleShowLayout, + TextField, + useRecordContext, + useRedirect, +} from 'react-admin' + +export const UpcomingOrCurrentEvent: FC = () => { + const record = useRecordContext() + const redirect = useRedirect() + + return ( + redirect('show', 'competition/event', record.upcoming_or_current_event.competition)} + sx={{cursor: 'pointer'}} + > + + + + + + + + + + + + + + + source="publication_set" + label="Publication count" + render={(record) => record && {record['publication_set'].length}} + /> + + + ) +}