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 c657558 commit e2022e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const CompetitionList: FC = () => (
<Datagrid rowClick="show">
<TextField source="name" />
<TextField source="slug" />
<NumberField source="start_year" />
<TextField source="start_year" />
<TruncatedTextField source="description" maxTextWidth={30} />
<TruncatedTextField source="rules" maxTextWidth={30} />
<TextField source="competition_type.name" label="Competition type" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,58 +1,49 @@
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>
<Tab label="general">
<SimpleShowLayout>
<TextField source="name" />
<TextField source="slug" />
<NumberField source="start_year" />
<TextField source="start_year" />
<TruncatedTextField source="description" maxTextWidth={100} expandable />
<TruncatedTextField source="rules" maxTextWidth={200} expandable />
<TextField source="competition_type.name" label="Competition type" />
<NumberField source="competition_type.id" />
<TextField source="competition_type.name" />
<SitesArrayField source="sites" />
<TextField source="who_can_participate" />
<NumberField source="min_years_until_graduation" />

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

0 comments on commit e2022e4

Please sign in to comment.