import React from 'react'; import { Query } from 'react-apollo'; import { DateTime } from 'luxon'; import { Typography, AppBar, Tabs, Tab, } from '@material-ui/core'; import { GetApp as OngoingIcon, AlarmAdd as FutureIcon, History as HistoryIcon, } from '@material-ui/icons'; import { withStyles } from '@material-ui/core/styles'; import styles from './styles'; import BannerTopBar from '../BannerTopBar'; import { listEventsCalls } from '../../GraphQL/Calls/index'; import { Future, History, Ongoing, Past, } from './Tabs'; function TabContainer(props) { return ( {props.children} ); } class Search extends React.Component { constructor(props) { super(props); this.state = { value: 0, }; } handleChange = (event, value) => { this.setState({ value }); } render() { 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 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.endDatetime < now); return (
} /> } /> } /> } /> {value === 0 && } {value === 1 && } {value === 2 && } {value === 3 && }
); }}
); } } export default withStyles(styles)(Search);