From e47b4a4b7aed91c107ba3836ec9b17f9a27cba11 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 8 Nov 2018 14:32:17 +0100 Subject: [PATCH] Integration of the new topbar --- client/src/Components/Event/Create/index.js | 175 ++++++++++---------- client/src/Components/Event/Edit/index.js | 3 + client/src/Components/Events/index.js | 5 +- client/src/Components/HostedEvents/index.js | 3 + client/src/Components/Search/index.js | 123 +++++++------- 5 files changed, 164 insertions(+), 145 deletions(-) diff --git a/client/src/Components/Event/Create/index.js b/client/src/Components/Event/Create/index.js index f281854c0..06e3e74ee 100644 --- a/client/src/Components/Event/Create/index.js +++ b/client/src/Components/Event/Create/index.js @@ -18,6 +18,8 @@ import { import { withStyles } from '@material-ui/core/styles'; import styles from './styles'; +import TopBar from '../../TopBar'; + import { Basic, PresentationPage, @@ -69,95 +71,98 @@ class Create extends React.Component { } = this.state; const { classes } = this.props; return ( - { - this.props.history.push(`/events/edit/${data.events_CreateEvent.id}`); - } - } - > - {hostEvent => ( -
- - - } - /> - } - /> - } - disabled - /> - } - disabled - /> - - - - - Create a new event - -
{ - e.preventDefault(); - hostEvent({ - variables: { - event: { + + + { + this.props.history.push(`/events/edit/${data.events_CreateEvent.id}`); + } + } + > + {hostEvent => ( +
+ + + } + /> + } + /> + } + disabled + /> + } + disabled + /> + + + + + Create a new event + + { + e.preventDefault(); + hostEvent({ + variables: { + event: { + name, + description, + startDatetime: startDatetime.valueOf() / 1000, + finishDatetime: finishDatetime.valueOf() / 1000, + formulaId, + plotterId, + }, + }, + }); + }} + > + {value === 0 && + this.handleEventChange(newType, newVal)} + /> + } + {value === 1 && + - {value === 0 && - this.handleEventChange(newType, newVal)} - /> - } - {value === 1 && - this.handleEventChange(newType, newVal)} - /> - } - {value === 2 && } - {value === 3 && } - - -
- )} -
+ }} + edit={(newType, newVal) => this.handleEventChange(newType, newVal)} + /> + } + {value === 2 && } + {value === 3 && } + +
+
+ )} +
+ ); } } diff --git a/client/src/Components/Event/Edit/index.js b/client/src/Components/Event/Edit/index.js index f63874df6..0ed096d23 100644 --- a/client/src/Components/Event/Edit/index.js +++ b/client/src/Components/Event/Edit/index.js @@ -6,12 +6,15 @@ import { withStyles } from '@material-ui/core/styles'; import styles from './styles'; +import TopBar from '../../TopBar'; + import { showEventCalls } from '../../../GraphQL/Calls/index'; class Edit extends React.Component { render() { return ( +

Here will come a list the competitions you applied for

; +const Index = () => ( + +); export default Index; diff --git a/client/src/Components/HostedEvents/index.js b/client/src/Components/HostedEvents/index.js index 32989e655..d3a67dd94 100644 --- a/client/src/Components/HostedEvents/index.js +++ b/client/src/Components/HostedEvents/index.js @@ -1,12 +1,15 @@ import React from 'react'; import { Query } from 'react-apollo'; +import TopBar from '../TopBar'; + import { hostedEventsCalls } from '../../GraphQL/Calls/index'; import Event from './Event'; const HostedEvent = () => ( + diff --git a/client/src/Components/Search/index.js b/client/src/Components/Search/index.js index d1799aa7f..945248476 100644 --- a/client/src/Components/Search/index.js +++ b/client/src/Components/Search/index.js @@ -17,6 +17,8 @@ import { import { withStyles } from '@material-ui/core/styles'; import styles from './styles'; +import TopBar from '../TopBar'; + import { listEventsCalls } from '../../GraphQL/Calls/index'; import { @@ -50,67 +52,70 @@ class Search extends React.Component { const { classes } = this.props; const { value } = this.state; return ( - - {({ loading, error, data }) => { - 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); + + + + {({ loading, error, data }) => { + 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 - && event.startDatetime < now); - const FutureEvents = data.events_Events.filter(event => event.startDatetime > now); - const PastEvents = data.events_Events.filter(event => event.finishDatetime < now); + const IncomingEvents = data.events_Events.filter(event => event.startDatetime > now + && event.startDatetime < inTwoWeeks); + const OngoingEvents = data.events_Events.filter(event => event.finishDatetime > now + && event.startDatetime < now); + const FutureEvents = data.events_Events.filter(event => event.startDatetime > now); + const PastEvents = data.events_Events.filter(event => event.finishDatetime < now); - return ( - -
- - - } - /> - } - /> - } - /> - } - /> - - - {value === 0 && - - } - {value === 1 && } - {value === 2 && } - {value === 3 && } -
-
- ); - }} -
+ return ( + +
+ + + } + /> + } + /> + } + /> + } + /> + + + {value === 0 && + + } + {value === 1 && } + {value === 2 && } + {value === 3 && } +
+
+ ); + }} +
+
); } }