diff --git a/client/src/Components/HostedEvents/Event.js b/client/src/Components/HostedEvents/Event.js
index 383efc3c5..e222c7731 100644
--- a/client/src/Components/HostedEvents/Event.js
+++ b/client/src/Components/HostedEvents/Event.js
@@ -83,7 +83,7 @@ class Event extends React.Component {
color='primary'
size='small'
component={Link}
- to={'/events/' + designator}
+ to={'/event/' + designator}
>
Show
diff --git a/client/src/Components/Search/Competition.js b/client/src/Components/Search/Competition.js
deleted file mode 100644
index bccb5df88..000000000
--- a/client/src/Components/Search/Competition.js
+++ /dev/null
@@ -1,124 +0,0 @@
-import React from 'react'
-
-import { toLocalTime } from '../../utils'
-
-import {
- Grid, Paper, Typography, Button,
- Dialog, DialogContent, DialogContentText, DialogTitle
-} from '@material-ui/core'
-import { withStyles } from '@material-ui/core/styles'
-
-const styles = theme => ({
- root: {
- flexGrow: 1,
- padding: 20,
- margin: 10
- },
- image: {
- width: 128,
- height: '100%',
- cursor: 'default'
- },
- img: {
- margin: 'auto',
- display: 'block',
- maxWidth: '100%',
- maxHeight: '100%'
-
- },
- buttonList: {
- margin: theme.spacing.unit,
- float: 'right'
- },
- buttonGrid: {
- marginTop: -20
- }
-
-})
-
-class Competition extends React.Component {
- render () {
- const classes = this.props.classes
- const { displayName,
- startDatetime,
- finishDatetime,
- host,
- description,
- formula,
- prizes
- } = this.props.competition
- const firstPrice = prizes.find(prize => {
- return prize.position === 1
- })
- return (
-
-
-
- { displayName }
- From : {toLocalTime(startDatetime)}
- To : {toLocalTime(finishDatetime)}
-
-
- Hosted by: { host }
- Formula: { formula }
- First prize: { firstPrice ? firstPrice.algoPrize + ' ALGOS' : 'none' }
-
-
-
-
- Description :
- { description }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
- }
-}
-export default withStyles(styles)(Competition)
diff --git a/client/src/Components/Search/Event.js b/client/src/Components/Search/Event.js
new file mode 100644
index 000000000..756bac3d8
--- /dev/null
+++ b/client/src/Components/Search/Event.js
@@ -0,0 +1,89 @@
+import React from 'react'
+import { Link } from 'react-router-dom'
+
+import {
+ Grid, Paper,
+ Typography,
+ Button
+} from '@material-ui/core'
+import { withStyles } from '@material-ui/core/styles'
+
+const styles = theme => ({
+ root: {
+ flexGrow: 1,
+ padding: 20,
+ margin: 10
+ },
+ image: {
+ width: 128,
+ height: '100%',
+ cursor: 'default'
+ },
+ img: {
+ margin: 'auto',
+ display: 'block',
+ maxWidth: '100%',
+ maxHeight: '100%'
+
+ },
+ buttonList: {
+ margin: theme.spacing.unit,
+ float: 'right'
+ },
+ buttonGrid: {
+ marginTop: -20
+ }
+
+})
+
+class Event extends React.Component {
+ render () {
+ const classes = this.props.classes
+ const {
+ name,
+ designator,
+ startDatetime,
+ finishDatetime,
+ host,
+ description
+ } = this.props.event
+ return (
+
+
+
+ {name}
+ From : {startDatetime}
+ To : {finishDatetime}
+
+
+ Hosted by: {host.alias} ({host.lastName} {host.firstName})
+ Formula:
+ First prize:
+
+
+
+
+ Description :
+ {description}
+
+
+
+
+
+
+
+
+ )
+ }
+}
+
+export default withStyles(styles)(Event)
diff --git a/client/src/Components/Search/index.js b/client/src/Components/Search/index.js
index 7c46f096e..a459ca9d4 100644
--- a/client/src/Components/Search/index.js
+++ b/client/src/Components/Search/index.js
@@ -1,33 +1,14 @@
import React from 'react'
-import gql from 'graphql-tag'
import { Query } from 'react-apollo'
-import Typography from '@material-ui/core/Typography'
+import { Typography } from '@material-ui/core'
+
import { withStyles } from '@material-ui/core/styles'
-
-import Competition from './Competition'
-
import styles from './styles'
-const HOST_COMPETITIONS = gql`
- query Hosts_Competitions{
- hosts_Competitions {
- displayName
- host
- startDatetime
- finishDatetime
- description
- formula
- participants {
- devTeam
- }
- prizes {
- position
- algoPrize
- }
- }
- }
-`
+import { listEventsCalls } from '../../GraphQL/Calls/index'
+
+import Event from './Event'
class Search extends React.Component {
render () {
@@ -42,14 +23,14 @@ class Search extends React.Component {
Enroll in an competition
{({ loading, error, data }) => {
if (loading) return 'Loading...'
if (error) return `Error! ${error.message}`
- const list = data.hosts_Competitions.map((competition, index) => {
+ const list = data.hosts_Events.map((event, index) => {
return (
-
+
)
})
return (
diff --git a/client/src/GraphQL/Calls/index.js b/client/src/GraphQL/Calls/index.js
index 953d0edfb..d3fe57c6d 100644
--- a/client/src/GraphQL/Calls/index.js
+++ b/client/src/GraphQL/Calls/index.js
@@ -1,7 +1,9 @@
import hostedEventsCalls from './hostedEvents'
+import listEventsCalls from './listEvents'
import showEventCalls from './showEvent'
export {
hostedEventsCalls,
+ listEventsCalls,
showEventCalls
}
diff --git a/client/src/GraphQL/Calls/listEvents.js b/client/src/GraphQL/Calls/listEvents.js
new file mode 100644
index 000000000..39084f491
--- /dev/null
+++ b/client/src/GraphQL/Calls/listEvents.js
@@ -0,0 +1,14 @@
+import gql from 'graphql-tag'
+import { eventMinimalInfo } from '../Fragments'
+
+const HOSTS_EVENTS = gql`
+ query Hosts_Events{
+ hosts_Events {
+ ...EventMinimalInfo
+ }
+ }
+ ${eventMinimalInfo}
+`
+export default {
+ HOSTS_EVENTS
+}