Refactor event details to show the occurrence

This commit is contained in:
Amit Jakubowicz 2019-11-25 19:19:51 +01:00
parent 4a0f8a3c43
commit 2b917b0908
3 changed files with 6 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import {format} from "date-fns"
import styled, { css } from "qpa-emotion"
import { Button, Spinner } from "qpa-components"
import { useMessageCenter } from "qpa-message-center"
@ -62,7 +63,7 @@ const EventDetails = (props: Props) => {
{
props.occurrence ? (
<OccurrenceTime>
{ props.occurrence.start }
{ format(new Date(props.occurrence.start), 'yyyy-MM-dd HH:mm') }
</OccurrenceTime>
) : null
}
@ -125,6 +126,6 @@ const StyledEventTags = styled(EventTags)`
`
const OccurrenceTime = styled.div`
grid-column: content;
`
export default hot(module)(withRouter(EventDetails))

View File

@ -34,7 +34,7 @@ const OccurrenceDetails = (props: Props) => {
props.history.push("/")
return <br />
}
return <EventDetails event={data.occurrence.event} />
return <EventDetails event={data.occurrence.event} occurrence={data.occurrence}/>
}
export default withRouter(OccurrenceDetails)

View File

@ -9,6 +9,7 @@ const query = gql`
${EventDetailsDataFragment}
query GetOccurrenceDetails($id: ID!) {
occurrence(id: $id) {
id
start
end
event {
@ -20,6 +21,7 @@ const query = gql`
interface Data {
occurrence: {
id: string
start: string
end: string
event: EventDetailsData