Skip to content

Commit

Permalink
Competition year format without spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Smilinko committed Dec 10, 2023
1 parent 38acee9 commit 067c19e
Showing 1 changed file with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import {Divider} from '@mui/material'
import {FC} from 'react'
import {
ArrayField,
Datagrid,
DateField,
FunctionField,
NumberField,
RaRecord,
Show,
SimpleShowLayout,
Tab,
TabbedShowLayout,
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 = () => (
<Show actions={<MyShowActions />}>
<TabbedShowLayout>
Expand All @@ -26,24 +30,29 @@ export const CompetitionShow: FC = () => (
<TextField source="start_year" />
<TruncatedTextField source="description" maxTextWidth={100} expandable />
<TruncatedTextField source="rules" maxTextWidth={200} expandable />
<NumberField source="competition_type.id" />
<TextField source="competition_type.name" />
<TextField source="competition_type.name" label="Competition type" />
<SitesArrayField source="sites" />
<NumberField source="min_years_until_graduation" />
<TextField source="who_can_participate" />
<JsonField source="upcoming_or_current_event" />
<NumberField source="min_years_until_graduation" />

<Divider />
<UpcomingOrCurrentEvent />
</SimpleShowLayout>
</Tab>
<Tab label="history_events">
<SimpleShowLayout>
<ArrayField source="history_events">
<Datagrid>
<Datagrid rowClick={(id) => `/competition/event/${id}/show`}>
<NumberField source="year" />
<NumberField source="season_code" />
<TextField source="school_year" />
<DateField source="start" />
<DateField source="end" />
<NumberField source="season_code" />
<NumberField source="competition" />
<FunctionField<RaRecord>
source="publication_set"
label="Publication count"
render={(record) => record && <span>{record['publication_set'].length}</span>}
/>
</Datagrid>
</ArrayField>
</SimpleShowLayout>
Expand Down

0 comments on commit 067c19e

Please sign in to comment.