Skip to content

Commit

Permalink
Merge branch 'frontend-manual-rescheduling'
Browse files Browse the repository at this point in the history
  • Loading branch information
robigan committed Jul 10, 2024
2 parents f43c199 + 6d10c1c commit c8727e2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function CommonCustomTimeMatchesForm<
<Grid align="center">
<Grid.Col span={{ sm: 8 }}>
<NumberInput
label={t('custom_match_margin_label')}
label={t('custom_match_duration_label')}
disabled={!customDurationEnabled}
rightSection={<Text>{t('minutes')}</Text>}
placeholder={`${match.duration_minutes}`}
Expand Down Expand Up @@ -112,12 +112,6 @@ export default function CommonCustomTimeMatchesForm<
</Grid>

<Input.Wrapper label={t('next_match_time_label')} mt="sm">
{/* <Input component={BareDateTime}
datetime={fromUnixTime(
getUnixTime(parseISO(match.start_time)) + matchDuration * 60 + matchMargin * 60
)}
formatStr="d LLLL yyyy HH:mm"
/> */}
<Input
component="time"
dateTime={endDatetime.toISOString()}
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/modals/match_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ export default function MatchModal({
/>
<Divider mt="lg" />

<CommonCustomTimeMatchesForm customDurationEnabled={customDurationEnabled} customMarginEnabled={customMarginEnabled} form={form} match={match} setCustomDurationEnabled={setCustomDurationEnabled} setCustomMarginEnabled={setCustomMarginEnabled} />
<CommonCustomTimeMatchesForm customDurationEnabled={customDurationEnabled} customMarginEnabled={customMarginEnabled} form={form} match={match} setCustomDurationEnabled={(val) => {
setCustomDurationEnabled(val);
if (val === false) form.setFieldValue('custom_duration_minutes', null);
}} setCustomMarginEnabled={(val) => {
setCustomMarginEnabled(val);
if (val === false) form.setFieldValue('custom_margin_minutes', null);
}} />

<Button fullWidth style={{ marginTop: 20 }} color="green" type="submit">
{t('save_button')}
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/components/modals/match_update_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ export default function MatchUpdateModal({
disabled={date === null}
onClick={async () => {
const computedMargin = Math.floor(
(date!.getTime() +
(previousMatch.custom_duration_minutes ??
previousMatch.duration_minutes) *
(date!.getTime() -
parseISO(previousMatch.start_time).getTime() +
(previousMatch.custom_duration_minutes === null
? previousMatch.duration_minutes
: previousMatch.custom_duration_minutes) *
60 *
1000 -
parseISO(previousMatch.start_time).getTime()) /
1000) /
60 /
1000
);
Expand Down

0 comments on commit c8727e2

Please sign in to comment.