mirror of
https://github.com/evroon/bracket.git
synced 2026-03-10 11:06:42 -04:00
Cleanup unnecessary scheduling code (#333)
This commit is contained in:
@@ -27,6 +27,7 @@ tournaments = Table(
|
||||
Column('dashboard_endpoint', String, nullable=True),
|
||||
Column('players_can_be_in_multiple_teams', Boolean, nullable=False, server_default='f'),
|
||||
Column('auto_assign_courts', Boolean, nullable=False, server_default='f'),
|
||||
Column('duration_minutes', Integer, nullable=False, server_default='15'),
|
||||
)
|
||||
|
||||
stages = Table(
|
||||
@@ -96,6 +97,7 @@ matches = Table(
|
||||
Column('created', DateTimeTZ, nullable=False),
|
||||
Column('start_time', DateTimeTZ, nullable=True),
|
||||
Column('duration_minutes', Integer, nullable=True),
|
||||
Column('custom_duration_minutes', Integer, nullable=True),
|
||||
Column('round_id', BigInteger, ForeignKey('rounds.id'), nullable=False),
|
||||
Column('team1_id', BigInteger, ForeignKey('teams.id'), nullable=True),
|
||||
Column('team2_id', BigInteger, ForeignKey('teams.id'), nullable=True),
|
||||
|
||||
@@ -69,7 +69,7 @@ export default function MatchLarge({
|
||||
const [opened, setOpened] = useState(false);
|
||||
|
||||
const bracket = (
|
||||
<>
|
||||
<div>
|
||||
<MatchBadge match={match} theme={theme} />
|
||||
<div className={classes.top} style={team1_style}>
|
||||
<Grid grow>
|
||||
@@ -84,7 +84,7 @@ export default function MatchLarge({
|
||||
<Grid.Col span={2}>{match.team2_score}</Grid.Col>
|
||||
</Grid>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (readOnly) {
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function Round({
|
||||
if (matches.length < 1) return null;
|
||||
|
||||
return (
|
||||
<div style={{ minHeight: 320, minWidth: 500, marginRight: '1rem' }}>
|
||||
<div style={{ minHeight: 320, minWidth: 500, marginRight: '1rem', marginBottom: '1rem' }}>
|
||||
<div
|
||||
style={{
|
||||
height: '100%',
|
||||
|
||||
@@ -9,29 +9,10 @@ import { Tournament } from '../../interfaces/tournament';
|
||||
import { getRoundsLookup } from '../../services/lookups';
|
||||
import { AutoCreateMatchesButton } from '../buttons/create_matches_auto';
|
||||
import UpcomingMatchesTable from '../tables/upcoming_matches';
|
||||
import Elimination from './settings/elimination';
|
||||
import LadderFixed from './settings/ladder_fixed';
|
||||
import SchedulingPlaceholder from './settings/placeholder';
|
||||
import RoundRobin from './settings/round_robin';
|
||||
import SwissSettings from './settings/ladder_fixed';
|
||||
|
||||
function StageSettings({
|
||||
activeStage,
|
||||
schedulerSettings,
|
||||
}: {
|
||||
activeStage?: StageWithStageItems;
|
||||
schedulerSettings: SchedulerSettings;
|
||||
}) {
|
||||
if (activeStage == null) {
|
||||
return <SchedulingPlaceholder />;
|
||||
}
|
||||
const stageItem = getStageItem(activeStage);
|
||||
if (stageItem.type === 'ROUND_ROBIN') {
|
||||
return <RoundRobin />;
|
||||
}
|
||||
if (stageItem.type === 'SINGLE_ELIMINATION') {
|
||||
return <Elimination />;
|
||||
}
|
||||
return <LadderFixed schedulerSettings={schedulerSettings} />;
|
||||
function StageSettings({ schedulerSettings }: { schedulerSettings: SchedulerSettings }) {
|
||||
return <SwissSettings schedulerSettings={schedulerSettings} />;
|
||||
}
|
||||
|
||||
function SchedulingSystem({
|
||||
@@ -80,13 +61,13 @@ export default function Scheduler({
|
||||
}) {
|
||||
const draftRound = getRoundsLookup(swrRoundsResponse)[roundId];
|
||||
return (
|
||||
<div style={{ marginTop: '3rem' }}>
|
||||
<div style={{ marginTop: '1rem' }}>
|
||||
<h2>
|
||||
Schedule new matches for <u>{draftRound.name}</u> in <u>{activeStage.name}</u>
|
||||
</h2>
|
||||
<Grid>
|
||||
<Grid.Col span={6}>
|
||||
<StageSettings activeStage={activeStage} schedulerSettings={schedulerSettings} />
|
||||
<StageSettings schedulerSettings={schedulerSettings} />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<Group position="right">
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Alert } from '@mantine/core';
|
||||
import { IconAlertCircle } from '@tabler/icons-react';
|
||||
import React from 'react';
|
||||
|
||||
export default function Elimination() {
|
||||
return (
|
||||
<Alert icon={<IconAlertCircle size={16} />} title="No options" color="blue" radius="lg">
|
||||
For elimination, scheduling is handled automatically.
|
||||
<br />
|
||||
Therefore, no options are available.
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Alert } from '@mantine/core';
|
||||
import { IconAlertCircle } from '@tabler/icons-react';
|
||||
import React from 'react';
|
||||
|
||||
export default function SchedulingPlaceholder() {
|
||||
return (
|
||||
<Alert icon={<IconAlertCircle size={16} />} title="No options" color="yellow" radius="lg">
|
||||
There is no active stage.
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Alert } from '@mantine/core';
|
||||
import { IconAlertCircle } from '@tabler/icons-react';
|
||||
import React from 'react';
|
||||
|
||||
export default function RoundRobin() {
|
||||
return (
|
||||
<Alert icon={<IconAlertCircle size={16} />} title="No options" color="blue" radius="lg">
|
||||
For round robin scheduling, scheduling is handled automatically.
|
||||
<br />
|
||||
Therefore, no options are available.
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user