switching from end to finish date
This commit is contained in:
1 parent
57163d34c2
commit
14c8f8a915
13 files changed
+90
-110
No files matched your search
@@ -87,9 +87,9 @@ class Basic extends React.Component {
|
||||
showTabs={false}
|
||||
leftArrowIcon={<ChevronLeft />}
|
||||
rightArrowIcon={<ChevronRight />}
|
||||
value={event.finishDatetime}
|
||||
helperText='Competition finishing date'
|
||||
onChange={newVal => edit('finishDatetime', newVal)}
|
||||
value={event.endDatetime}
|
||||
helperText='Competition ending date'
|
||||
onChange={newVal => edit('endDatetime', newVal)}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -46,7 +46,7 @@ class Create extends React.Component {
|
||||
subtitle: '',
|
||||
description: '',
|
||||
startDatetime: DateTime.local().plus({ days: 1 }).startOf('day'),
|
||||
finishDatetime: DateTime.local().plus({ days: 8 }).startOf('day'),
|
||||
endDatetime: DateTime.local().plus({ days: 8 }).startOf('day'),
|
||||
formulaId: '',
|
||||
plotterId: '',
|
||||
prizes: [],
|
||||
@@ -68,7 +68,7 @@ class Create extends React.Component {
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime,
|
||||
finishDatetime,
|
||||
endDatetime,
|
||||
value,
|
||||
formulaId,
|
||||
plotterId,
|
||||
@@ -132,7 +132,7 @@ class Create extends React.Component {
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime,
|
||||
finishDatetime,
|
||||
endDatetime,
|
||||
}}
|
||||
edit={(newType, newVal) => this.handleEventChange(newType, newVal)}
|
||||
create={() => hostEvent({
|
||||
@@ -142,7 +142,7 @@ class Create extends React.Component {
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime: startDatetime.valueOf() / 1000,
|
||||
finishDatetime: finishDatetime.valueOf() / 1000,
|
||||
endDatetime: endDatetime.valueOf() / 1000,
|
||||
formulaId,
|
||||
plotterId,
|
||||
prizes,
|
||||
@@ -168,7 +168,7 @@ class Create extends React.Component {
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime: startDatetime.valueOf() / 1000,
|
||||
finishDatetime: finishDatetime.valueOf() / 1000,
|
||||
endDatetime: endDatetime.valueOf() / 1000,
|
||||
formulaId,
|
||||
plotterId,
|
||||
prizes,
|
||||
|
||||
@@ -87,9 +87,9 @@ class Basic extends React.Component {
|
||||
showTabs={false}
|
||||
leftArrowIcon={<ChevronLeft />}
|
||||
rightArrowIcon={<ChevronRight />}
|
||||
value={event.finishDatetime}
|
||||
helperText='Competition finishing date'
|
||||
onChange={newVal => edit('finishDatetime', newVal)}
|
||||
value={event.endDatetime}
|
||||
helperText='Competition ending date'
|
||||
onChange={newVal => edit('endDatetime', newVal)}
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -44,7 +44,7 @@ class Queried extends React.Component {
|
||||
subtitle: this.props.event.subtitle,
|
||||
description: this.props.event.description,
|
||||
startDatetime: this.props.event.startDatetime * 1000,
|
||||
finishDatetime: this.props.event.finishDatetime * 1000,
|
||||
endDatetime: this.props.event.endDatetime * 1000,
|
||||
formulaId: this.props.event.formula.id,
|
||||
plotterId: this.props.event.plotter.id,
|
||||
prizes: this.props.event.prizes,
|
||||
@@ -68,7 +68,7 @@ class Queried extends React.Component {
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime,
|
||||
finishDatetime,
|
||||
endDatetime,
|
||||
value,
|
||||
formulaId,
|
||||
plotterId,
|
||||
@@ -131,7 +131,7 @@ class Queried extends React.Component {
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime,
|
||||
finishDatetime,
|
||||
endDatetime,
|
||||
prizes,
|
||||
rules,
|
||||
}}
|
||||
@@ -144,7 +144,7 @@ class Queried extends React.Component {
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime: startDatetime.valueOf() / 1000,
|
||||
finishDatetime: finishDatetime.valueOf() / 1000,
|
||||
endDatetime: endDatetime.valueOf() / 1000,
|
||||
formulaId,
|
||||
plotterId,
|
||||
},
|
||||
@@ -169,7 +169,7 @@ class Queried extends React.Component {
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime: startDatetime.valueOf() / 1000,
|
||||
finishDatetime: finishDatetime.valueOf() / 1000,
|
||||
endDatetime: endDatetime.valueOf() / 1000,
|
||||
formulaId,
|
||||
plotterId,
|
||||
prizes,
|
||||
|
||||
@@ -17,17 +17,17 @@ import { toLocalTime } from '../../utils';
|
||||
|
||||
class Event extends React.Component {
|
||||
render() {
|
||||
const { classes, showOnly } = this.props;
|
||||
const { classes, showOnly, event } = this.props;
|
||||
const {
|
||||
id,
|
||||
title,
|
||||
subtitle,
|
||||
startDatetime,
|
||||
finishDatetime,
|
||||
endDatetime,
|
||||
host,
|
||||
formula,
|
||||
description,
|
||||
} = this.props.event;
|
||||
} = event;
|
||||
return (
|
||||
<Paper className={classes.card}>
|
||||
<Grid container spacing={16}>
|
||||
@@ -35,7 +35,7 @@ class Event extends React.Component {
|
||||
<Typography gutterBottom variant='h5'> {title} </Typography>
|
||||
<Typography gutterBottom variant='h6'> {subtitle} </Typography>
|
||||
<Typography gutterBottom>From : {toLocalTime(startDatetime)} </Typography>
|
||||
<Typography gutterBottom>To : {toLocalTime(finishDatetime)} </Typography>
|
||||
<Typography gutterBottom>To : {toLocalTime(endDatetime)} </Typography>
|
||||
</Grid>
|
||||
<Grid item xs>
|
||||
<Typography gutterBottom variant='h6'> Description : </Typography>
|
||||
@@ -54,7 +54,7 @@ class Event extends React.Component {
|
||||
? <React.Fragment>
|
||||
<Mutation mutation={hostedEventsCalls.EVENTS_PUBLISHEVENT}
|
||||
update={() => {
|
||||
this.props.history.push(`/events/edit/${id}`);
|
||||
window.location.reload();
|
||||
}}
|
||||
>
|
||||
{publishEvent => (
|
||||
@@ -82,7 +82,6 @@ class Event extends React.Component {
|
||||
</React.Fragment>
|
||||
: ''
|
||||
}
|
||||
|
||||
<Button
|
||||
className={classes.buttonList}
|
||||
variant='outlined'
|
||||
|
||||
@@ -13,35 +13,37 @@ import { toLocalTime } from '../../utils';
|
||||
|
||||
class Event extends React.Component {
|
||||
render() {
|
||||
const { classes } = this.props;
|
||||
const { classes, event } = this.props;
|
||||
const {
|
||||
id,
|
||||
name,
|
||||
title,
|
||||
subtitle,
|
||||
startDatetime,
|
||||
finishDatetime,
|
||||
endDatetime,
|
||||
host,
|
||||
formula,
|
||||
description,
|
||||
} = this.props.event;
|
||||
} = event;
|
||||
return (
|
||||
<Paper className={classes.card}>
|
||||
<Grid container spacing={16}>
|
||||
<Grid item xs>
|
||||
<Typography gutterBottom variant='h5'> {name} </Typography>
|
||||
<Typography gutterBottom variant='h5'> {title} </Typography>
|
||||
<Typography gutterBottom variant='h6'> {subtitle} </Typography>
|
||||
<Typography gutterBottom>From : {toLocalTime(startDatetime)} </Typography>
|
||||
<Typography gutterBottom>To : {toLocalTime(finishDatetime)} </Typography>
|
||||
<Typography gutterBottom>To : {toLocalTime(endDatetime)} </Typography>
|
||||
</Grid>
|
||||
<Grid item xs>
|
||||
<Typography gutterBottom>
|
||||
Hosted by: {host.alias} ({host.lastName} {host.firstName})
|
||||
</Typography>
|
||||
<Typography gutterBottom>Formula: </Typography>
|
||||
<Typography gutterBottom>First prize: </Typography>
|
||||
<Typography gutterBottom variant='h6'> Description : </Typography>
|
||||
<Typography gutterBottom> {description} </Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12} sm container>
|
||||
<Grid item xs container direction='column' spacing={16}>
|
||||
<Grid item xs>
|
||||
<Typography gutterBottom variant='h5'> Description : </Typography>
|
||||
<Typography gutterBottom> {description} </Typography>
|
||||
<Typography gutterBottom>
|
||||
Hosted by: {host.alias} ({host.lastName} {host.firstName})
|
||||
</Typography>
|
||||
<Typography gutterBottom>Formula: {formula.name} </Typography>
|
||||
</Grid>
|
||||
<Grid item className={classes.buttonGrid}>
|
||||
<Button
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Typography } from '@material-ui/core';
|
||||
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import styles from '../styles';
|
||||
|
||||
import Event from '../Event';
|
||||
|
||||
class Incoming extends React.Component {
|
||||
render() {
|
||||
const { classes } = this.props;
|
||||
const { IncomingEvents, OngoingEvents } = this.props;
|
||||
|
||||
const incomingEvents = IncomingEvents.map((event, index) => (
|
||||
<Event key={index} event={event} />
|
||||
));
|
||||
const ongoingEvents = OngoingEvents.map((event, index) => (
|
||||
<Event key={index} event={event} />
|
||||
));
|
||||
return (
|
||||
<div className='container'>
|
||||
<Typography
|
||||
className={classes.title}
|
||||
variant='h4'
|
||||
align='center'
|
||||
color='textPrimary'
|
||||
gutterBottom
|
||||
>
|
||||
Ongoing and incoming competitions
|
||||
</Typography>
|
||||
<Typography
|
||||
variant='h5'
|
||||
color='textPrimary'
|
||||
gutterBottom
|
||||
>
|
||||
Ongoing events:
|
||||
</Typography>
|
||||
{ongoingEvents}
|
||||
<Typography
|
||||
variant='h5'
|
||||
color='textPrimary'
|
||||
gutterBottom
|
||||
>
|
||||
Incoming events:
|
||||
</Typography>
|
||||
{incomingEvents}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withStyles(styles)(Incoming);
|
||||
@@ -0,0 +1,33 @@
|
||||
import React from 'react';
|
||||
import { Typography } from '@material-ui/core';
|
||||
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import styles from '../styles';
|
||||
|
||||
import Event from '../Event';
|
||||
|
||||
class Ongoing extends React.Component {
|
||||
render() {
|
||||
const { OngoingEvents, classes } = this.props;
|
||||
|
||||
const ongoingEvents = OngoingEvents.map((event, index) => (
|
||||
<Event key={index} event={event} />
|
||||
));
|
||||
return (
|
||||
<div className='container'>
|
||||
<Typography
|
||||
className={classes.title}
|
||||
variant='h4'
|
||||
align='center'
|
||||
color='textPrimary'
|
||||
gutterBottom
|
||||
>
|
||||
Ongoing events:
|
||||
</Typography>
|
||||
{ongoingEvents}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withStyles(styles)(Ongoing);
|
||||
@@ -1,11 +1,11 @@
|
||||
import Future from './Future';
|
||||
import History from './History';
|
||||
import Incoming from './Incoming';
|
||||
import Ongoing from './Ongoing';
|
||||
import Past from './Past';
|
||||
|
||||
export {
|
||||
Future,
|
||||
History,
|
||||
Incoming,
|
||||
Ongoing,
|
||||
Past,
|
||||
};
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
Tab,
|
||||
} from '@material-ui/core';
|
||||
import {
|
||||
GetApp as IncomingIcon,
|
||||
GetApp as OngoingIcon,
|
||||
AlarmAdd as FutureIcon,
|
||||
History as HistoryIcon,
|
||||
} from '@material-ui/icons';
|
||||
@@ -24,7 +24,7 @@ import { listEventsCalls } from '../../GraphQL/Calls/index';
|
||||
import {
|
||||
Future,
|
||||
History,
|
||||
Incoming,
|
||||
Ongoing,
|
||||
Past,
|
||||
} from './Tabs';
|
||||
|
||||
@@ -66,14 +66,11 @@ class Search extends React.Component {
|
||||
if (loading) return 'Loading...';
|
||||
if (error) return `Error! ${error.message}`;
|
||||
const now = Math.floor(DateTime.local().valueOf() / 1000);
|
||||
const inTwoWeeks = Math.floor(DateTime.local().plus({ weeks: 2 }).valueOf() / 1000);
|
||||
|
||||
const IncomingEvents = data.events_Events.filter(event => event.startDatetime > now
|
||||
&& event.startDatetime < inTwoWeeks);
|
||||
const OngoingEvents = data.events_Events.filter(event => event.finishDatetime > now
|
||||
const OngoingEvents = data.events_Events.filter(event => event.endDatetime > now
|
||||
&& event.startDatetime < now);
|
||||
const FutureEvents = data.events_Events.filter(event => event.startDatetime > now);
|
||||
const PastEvents = data.events_Events.filter(event => event.finishDatetime < now);
|
||||
const PastEvents = data.events_Events.filter(event => event.endDatetime < now);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
@@ -89,8 +86,8 @@ class Search extends React.Component {
|
||||
>
|
||||
<Tab
|
||||
className={classes.tabTitle}
|
||||
label='Ongoing & Incoming'
|
||||
icon={<IncomingIcon />}
|
||||
label='Ongoing'
|
||||
icon={<OngoingIcon />}
|
||||
/>
|
||||
<Tab
|
||||
className={classes.tabTitle}
|
||||
@@ -110,7 +107,7 @@ class Search extends React.Component {
|
||||
</Tabs>
|
||||
</AppBar>
|
||||
{value === 0 && <TabContainer>
|
||||
<Incoming IncomingEvents={IncomingEvents} OngoingEvents={OngoingEvents} />
|
||||
<Ongoing OngoingEvents={OngoingEvents} />
|
||||
</TabContainer>}
|
||||
{value === 1 && <TabContainer><Future FutureEvents={FutureEvents} /></TabContainer>}
|
||||
{value === 2 && <TabContainer><History /></TabContainer>}
|
||||
|
||||
@@ -20,8 +20,8 @@ const EVENTS_EDITEVENT = gql`
|
||||
`;
|
||||
|
||||
const EVENTS_EVENTSBYHOST = gql`
|
||||
query Events_Events($hostId: String!, $state: events_EventStateEnum){
|
||||
events_Events(hostId: $hostId, state: $state) {
|
||||
query Events_Events($hostId: String!, $state: events_EventStateEnum, $maxEndDate: Int, $minEndDate: Int){
|
||||
events_Events(hostId: $hostId, state: $state, maxEndDate: $maxEndDate, minEndDate: $minEndDate) {
|
||||
...EventFullInfo
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@ const EVENTS_EVENTSBYHOST = gql`
|
||||
`;
|
||||
|
||||
const EVENTS_PUBLISHEVENT = gql`
|
||||
mutation Events_ChangeEventState($eventId: ID!, $state: events_EventStateEnum, $maxEndDate: Number, $minEndDate: Number) {
|
||||
events_ChangeEventState(eventId: $eventId, state: $state, maxEndDate: $maxEndDate, minEndDate: $minEndDate ) {
|
||||
mutation Events_ChangeEventState($eventId: ID!, $state: events_EventStateEnum) {
|
||||
events_ChangeEventState(eventId: $eventId, state: $state) {
|
||||
...EventFullInfo
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import gql from 'graphql-tag';
|
||||
import { eventMinimalInfo } from '../Fragments';
|
||||
import { eventFullInfo } from '../Fragments';
|
||||
|
||||
const EVENTS_EVENTS = gql`
|
||||
query Events_Events{
|
||||
events_Events {
|
||||
...EventMinimalInfo
|
||||
query Events_Events($minStartDate: Int, $maxStartDate: Int, $minEndDate: Int, $maxEndDate: Int){
|
||||
events_Events(minStartDate: $minStartDate, maxStartDate: $maxStartDate, minEndDate: $minEndDate, maxEndDate: $maxEndDate) {
|
||||
...EventFullInfo
|
||||
}
|
||||
}
|
||||
${eventMinimalInfo}
|
||||
${eventFullInfo}
|
||||
`;
|
||||
|
||||
export default {
|
||||
EVENTS_EVENTS,
|
||||
};
|
||||
@@ -6,7 +6,7 @@ export const eventMinimalInfo = gql`
|
||||
state
|
||||
title
|
||||
startDatetime
|
||||
finishDatetime
|
||||
endDatetime
|
||||
host {
|
||||
alias
|
||||
firstName
|
||||
@@ -37,7 +37,7 @@ export const eventFullInfo = gql`
|
||||
}
|
||||
description
|
||||
startDatetime
|
||||
finishDatetime
|
||||
endDatetime
|
||||
state
|
||||
rules {
|
||||
title
|
||||
|
||||
Reference in new issue
Block a user