Renaming hosts to events at as many places as possible
This commit is contained in:
1 parent
a94371f750
commit
7e7dbc1401
10 files changed
+31
-31
No files matched your search
@@ -21,7 +21,7 @@ class Edit extends React.Component {
|
||||
Enroll in an competition {this.props.match.params.slug}
|
||||
</Typography>
|
||||
<Query
|
||||
query={showEventCalls.HOSTS_EVENT}
|
||||
query={showEventCalls.EVENTS_EVENT}
|
||||
variables={{ designator: this.props.match.params.slug }}
|
||||
>
|
||||
{({ loading, error, data }) => {
|
||||
@@ -29,7 +29,7 @@ class Edit extends React.Component {
|
||||
if (error) return `Error! ${error.message}`
|
||||
return (
|
||||
<p>
|
||||
{data.hosts_Event.description}
|
||||
{data.events_Event.description}
|
||||
</p>
|
||||
)
|
||||
}}
|
||||
|
||||
@@ -21,7 +21,7 @@ class Show extends React.Component {
|
||||
Enroll in an competition {this.props.match.params.slug}
|
||||
</Typography>
|
||||
<Query
|
||||
query={showEventCalls.HOSTS_EVENT}
|
||||
query={showEventCalls.EVENTS_EVENT}
|
||||
variables={{ designator: this.props.match.params.slug }}
|
||||
>
|
||||
{({ loading, error, data }) => {
|
||||
@@ -29,7 +29,7 @@ class Show extends React.Component {
|
||||
if (error) return `Error! ${error.message}`
|
||||
return (
|
||||
<p>
|
||||
{data.hosts_Event.description}
|
||||
{data.events_Event.description}
|
||||
</p>
|
||||
)
|
||||
}}
|
||||
|
||||
@@ -24,14 +24,14 @@ class New extends React.Component {
|
||||
render () {
|
||||
const { name, description, startDatetime, finishDatetime } = this.state
|
||||
return (
|
||||
<Mutation mutation={hostedEventsCalls.HOSTS_HOSTEVENT}
|
||||
<Mutation mutation={hostedEventsCalls.EVENTS_HOSTEVENT}
|
||||
update={(store, { data }) => {
|
||||
const { hosts_EventsByHost: hostedEvents } = store.readQuery({ query: hostedEventsCalls.HOSTS_EVENTSBYHOST })
|
||||
const { events_EventsByHost: hostedEvents } = store.readQuery({ query: hostedEventsCalls.EVENTS_EVENTSBYHOST })
|
||||
store.writeQuery({
|
||||
query: hostedEventsCalls.HOSTS_EVENTSBYHOST,
|
||||
data: { hosts_EventsByHost: hostedEvents.concat([data.hosts_HostEvent]) }
|
||||
query: hostedEventsCalls.EVENTS_EVENTSBYHOST,
|
||||
data: { events_EventsByHost: hostedEvents.concat([data.events_HostEvent]) }
|
||||
})
|
||||
this.props.handleNewEvent(data.hosts_HostEvent)
|
||||
this.props.handleNewEvent(data.events_HostEvent)
|
||||
}
|
||||
}
|
||||
>
|
||||
|
||||
@@ -40,12 +40,12 @@ class HostedEvent extends React.Component {
|
||||
</Button>
|
||||
|
||||
<Query
|
||||
query={hostedEventsCalls.HOSTS_EVENTSBYHOST}
|
||||
query={hostedEventsCalls.EVENTS_EVENTSBYHOST}
|
||||
>
|
||||
{({ loading, error, data }) => {
|
||||
if (loading) return 'Loading...'
|
||||
if (error) return `Error! ${error.message}`
|
||||
const list = data.hosts_EventsByHost.map((event, index) => {
|
||||
const list = data.events_EventsByHost.map((event, index) => {
|
||||
return (
|
||||
<Event key={index} event={event} />
|
||||
)
|
||||
|
||||
@@ -51,7 +51,7 @@ class Search extends React.Component {
|
||||
const { value } = this.state
|
||||
return (
|
||||
<Query
|
||||
query={listEventsCalls.HOSTS_EVENTS}
|
||||
query={listEventsCalls.EVENTS_EVENTS}
|
||||
>
|
||||
{({ loading, error, data }) => {
|
||||
if (loading) return 'Loading...'
|
||||
@@ -59,10 +59,10 @@ class Search extends React.Component {
|
||||
const now = ~~(DateTime.local().valueOf() / 1000)
|
||||
const inTwoWeeks = ~~(DateTime.local().plus({ weeks: 2 }).valueOf() / 1000)
|
||||
|
||||
const IncomingEvents = data.hosts_Events.filter(event => event.startDatetime > now && event.startDatetime < inTwoWeeks)
|
||||
const OngoingEvents = data.hosts_Events.filter(event => event.finishDatetime > now && event.startDatetime < now)
|
||||
const FutureEvents = data.hosts_Events.filter(event => event.startDatetime > now)
|
||||
const PastEvents = data.hosts_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 (
|
||||
<React.Fragment>
|
||||
|
||||
Reference in new issue
Block a user