Refactor event details to show the occurrence
This commit is contained in:
parent
4a0f8a3c43
commit
2b917b0908
|
@ -1,3 +1,4 @@
|
||||||
|
import {format} from "date-fns"
|
||||||
import styled, { css } from "qpa-emotion"
|
import styled, { css } from "qpa-emotion"
|
||||||
import { Button, Spinner } from "qpa-components"
|
import { Button, Spinner } from "qpa-components"
|
||||||
import { useMessageCenter } from "qpa-message-center"
|
import { useMessageCenter } from "qpa-message-center"
|
||||||
|
@ -62,7 +63,7 @@ const EventDetails = (props: Props) => {
|
||||||
{
|
{
|
||||||
props.occurrence ? (
|
props.occurrence ? (
|
||||||
<OccurrenceTime>
|
<OccurrenceTime>
|
||||||
{ props.occurrence.start }
|
{ format(new Date(props.occurrence.start), 'yyyy-MM-dd HH:mm') }
|
||||||
</OccurrenceTime>
|
</OccurrenceTime>
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
|
@ -125,6 +126,6 @@ const StyledEventTags = styled(EventTags)`
|
||||||
`
|
`
|
||||||
|
|
||||||
const OccurrenceTime = styled.div`
|
const OccurrenceTime = styled.div`
|
||||||
|
grid-column: content;
|
||||||
`
|
`
|
||||||
export default hot(module)(withRouter(EventDetails))
|
export default hot(module)(withRouter(EventDetails))
|
||||||
|
|
|
@ -34,7 +34,7 @@ const OccurrenceDetails = (props: Props) => {
|
||||||
props.history.push("/")
|
props.history.push("/")
|
||||||
return <br />
|
return <br />
|
||||||
}
|
}
|
||||||
return <EventDetails event={data.occurrence.event} />
|
return <EventDetails event={data.occurrence.event} occurrence={data.occurrence}/>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withRouter(OccurrenceDetails)
|
export default withRouter(OccurrenceDetails)
|
||||||
|
|
|
@ -9,6 +9,7 @@ const query = gql`
|
||||||
${EventDetailsDataFragment}
|
${EventDetailsDataFragment}
|
||||||
query GetOccurrenceDetails($id: ID!) {
|
query GetOccurrenceDetails($id: ID!) {
|
||||||
occurrence(id: $id) {
|
occurrence(id: $id) {
|
||||||
|
id
|
||||||
start
|
start
|
||||||
end
|
end
|
||||||
event {
|
event {
|
||||||
|
@ -20,6 +21,7 @@ const query = gql`
|
||||||
|
|
||||||
interface Data {
|
interface Data {
|
||||||
occurrence: {
|
occurrence: {
|
||||||
|
id: string
|
||||||
start: string
|
start: string
|
||||||
end: string
|
end: string
|
||||||
event: EventDetailsData
|
event: EventDetailsData
|
||||||
|
|
Loading…
Reference in New Issue