Event images
This commit is contained in:
parent
832672aa12
commit
b89d402786
|
@ -4,7 +4,7 @@
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"endpoints": {
|
"endpoints": {
|
||||||
"Default GraphQL Endpoint": {
|
"Default GraphQL Endpoint": {
|
||||||
"url": "https://alpha.quepasaalpujarra.com/graphql",
|
"url": "http://localhost:4000/graphql",
|
||||||
"headers": {
|
"headers": {
|
||||||
"user-agent": "JS GraphQL"
|
"user-agent": "JS GraphQL"
|
||||||
},
|
},
|
||||||
|
|
|
@ -54,6 +54,7 @@ declare namespace GQL {
|
||||||
interface ICalendarEvent {
|
interface ICalendarEvent {
|
||||||
__typename: 'CalendarEvent';
|
__typename: 'CalendarEvent';
|
||||||
id: string;
|
id: string;
|
||||||
|
images: IEventImages | null;
|
||||||
info: IEventInformation | null;
|
info: IEventInformation | null;
|
||||||
infos: Array<IEventInformation | null>;
|
infos: Array<IEventInformation | null>;
|
||||||
location: ILocation;
|
location: ILocation;
|
||||||
|
@ -68,6 +69,19 @@ declare namespace GQL {
|
||||||
lang: string;
|
lang: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IEventImages {
|
||||||
|
__typename: 'EventImages';
|
||||||
|
cover: IImage | null;
|
||||||
|
gallery: Array<IImage> | null;
|
||||||
|
poster: IImage | null;
|
||||||
|
thumb: IImage | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IImage {
|
||||||
|
__typename: 'Image';
|
||||||
|
url: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface IEventInformation {
|
interface IEventInformation {
|
||||||
__typename: 'EventInformation';
|
__typename: 'EventInformation';
|
||||||
description: string | null;
|
description: string | null;
|
||||||
|
@ -151,19 +165,31 @@ declare namespace GQL {
|
||||||
|
|
||||||
interface IMutation {
|
interface IMutation {
|
||||||
__typename: 'Mutation';
|
__typename: 'Mutation';
|
||||||
|
addEventGalleryImages: ICalendarEvent | null;
|
||||||
createEvent: ICalendarEvent | null;
|
createEvent: ICalendarEvent | null;
|
||||||
createEventTag: IEventTag | null;
|
createEventTag: IEventTag | null;
|
||||||
deleteEvent: IUser;
|
deleteEvent: IUser;
|
||||||
deleteEventTag: Array<IEventTag | null> | null;
|
deleteEventTag: Array<IEventTag | null> | null;
|
||||||
grantRole: IUser;
|
grantRole: IUser;
|
||||||
|
removeEventGalleryImages: ICalendarEvent | null;
|
||||||
requestInvite: boolean;
|
requestInvite: boolean;
|
||||||
revokeRole: IUser;
|
revokeRole: IUser;
|
||||||
|
setEventCoverImage: ICalendarEvent | null;
|
||||||
|
setEventPosterImage: ICalendarEvent | null;
|
||||||
|
setEventThumbnailImage: ICalendarEvent | null;
|
||||||
signin: IUserSession;
|
signin: IUserSession;
|
||||||
signup: Array<IError | null> | null;
|
signup: Array<IError | null> | null;
|
||||||
|
unsetEventCoverImage: ICalendarEvent | null;
|
||||||
|
unsetEventPosterImage: ICalendarEvent | null;
|
||||||
|
unsetEventThumbnailImage: ICalendarEvent | null;
|
||||||
updateEvent: ICalendarEvent | null;
|
updateEvent: ICalendarEvent | null;
|
||||||
updateEventTag: IEventTag | null;
|
updateEventTag: IEventTag | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IAddEventGalleryImagesOnMutationArguments {
|
||||||
|
input: IEventImagesUploadInput;
|
||||||
|
}
|
||||||
|
|
||||||
interface ICreateEventOnMutationArguments {
|
interface ICreateEventOnMutationArguments {
|
||||||
input: ICreateEventInput;
|
input: ICreateEventInput;
|
||||||
}
|
}
|
||||||
|
@ -184,6 +210,10 @@ declare namespace GQL {
|
||||||
input: IGrantRoleInput;
|
input: IGrantRoleInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IRemoveEventGalleryImagesOnMutationArguments {
|
||||||
|
input: IEventGalleryImagesInput;
|
||||||
|
}
|
||||||
|
|
||||||
interface IRequestInviteOnMutationArguments {
|
interface IRequestInviteOnMutationArguments {
|
||||||
input: IRequestInviteInput;
|
input: IRequestInviteInput;
|
||||||
}
|
}
|
||||||
|
@ -192,6 +222,18 @@ declare namespace GQL {
|
||||||
input: IGrantRoleInput;
|
input: IGrantRoleInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface ISetEventCoverImageOnMutationArguments {
|
||||||
|
input: IEventImageUploadInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ISetEventPosterImageOnMutationArguments {
|
||||||
|
input: IEventImageUploadInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ISetEventThumbnailImageOnMutationArguments {
|
||||||
|
input: IEventImageUploadInput;
|
||||||
|
}
|
||||||
|
|
||||||
interface ISigninOnMutationArguments {
|
interface ISigninOnMutationArguments {
|
||||||
input: ISigninInput;
|
input: ISigninInput;
|
||||||
}
|
}
|
||||||
|
@ -200,6 +242,18 @@ declare namespace GQL {
|
||||||
input: ISignupInput;
|
input: ISignupInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IUnsetEventCoverImageOnMutationArguments {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUnsetEventPosterImageOnMutationArguments {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUnsetEventThumbnailImageOnMutationArguments {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface IUpdateEventOnMutationArguments {
|
interface IUpdateEventOnMutationArguments {
|
||||||
input: IUpdateEventInput;
|
input: IUpdateEventInput;
|
||||||
}
|
}
|
||||||
|
@ -208,6 +262,11 @@ declare namespace GQL {
|
||||||
input: IUpdateEventTagInput;
|
input: IUpdateEventTagInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IEventImagesUploadInput {
|
||||||
|
files: Array<any>;
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface ICreateEventInput {
|
interface ICreateEventInput {
|
||||||
infos: Array<IEventInformationInput | null>;
|
infos: Array<IEventInformationInput | null>;
|
||||||
location: IEventLocationInput;
|
location: IEventLocationInput;
|
||||||
|
@ -254,10 +313,20 @@ declare namespace GQL {
|
||||||
userId: string;
|
userId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IEventGalleryImagesInput {
|
||||||
|
eventId: string;
|
||||||
|
imageIds: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
interface IRequestInviteInput {
|
interface IRequestInviteInput {
|
||||||
email: string;
|
email: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IEventImageUploadInput {
|
||||||
|
file: any;
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface ISigninInput {
|
interface ISigninInput {
|
||||||
hash: string;
|
hash: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { hot } from "react-hot-loader"
|
||||||
import { RouteComponentProps, withRouter } from "react-router"
|
import { RouteComponentProps, withRouter } from "react-router"
|
||||||
import { useAppContext } from "../Context/AppContext"
|
import { useAppContext } from "../Context/AppContext"
|
||||||
import useEventDetailsQuery from "./useEventDetailsQuery"
|
import useEventDetailsQuery from "./useEventDetailsQuery"
|
||||||
|
import EventHeaderImage from './EventHeaderImage'
|
||||||
|
|
||||||
interface RouteParams {
|
interface RouteParams {
|
||||||
eventId: string
|
eventId: string
|
||||||
|
@ -16,6 +17,7 @@ interface Props extends RouteComponentProps<RouteParams> {}
|
||||||
|
|
||||||
const EventDetails = (props: Props) => {
|
const EventDetails = (props: Props) => {
|
||||||
const { me, language } = useAppContext()
|
const { me, language } = useAppContext()
|
||||||
|
|
||||||
const { data, loading, error } = useEventDetailsQuery({
|
const { data, loading, error } = useEventDetailsQuery({
|
||||||
variables: { eventId: props.match.params.eventId, language },
|
variables: { eventId: props.match.params.eventId, language },
|
||||||
})
|
})
|
||||||
|
@ -27,20 +29,26 @@ const EventDetails = (props: Props) => {
|
||||||
}
|
}
|
||||||
const event = data.event
|
const event = data.event
|
||||||
const meIsOwner = me && me.id === event.owner.id
|
const meIsOwner = me && me.id === event.owner.id
|
||||||
|
const canEdit =
|
||||||
|
meIsOwner ||
|
||||||
|
!!me.roles.find(role => ["admin", "embassador"].includes(role.type))
|
||||||
|
|
||||||
const info = event.infos[0]
|
const info = event.infos[0]
|
||||||
return (
|
return (
|
||||||
<Root>
|
<Root>
|
||||||
|
<EventHeaderImage event={event} canEdit={canEdit}/>
|
||||||
<Title>{info.title}</Title>
|
<Title>{info.title}</Title>
|
||||||
<Tags>
|
<Tags>
|
||||||
{event.tags.map(tag => (
|
{event.tags.map(tag => (
|
||||||
<Chip color="primary" label={tag.translation.text} key={tag.id} />
|
<Chip color="primary" label={tag.translation.text} key={tag.id} />
|
||||||
))}
|
))}
|
||||||
</Tags>
|
</Tags>
|
||||||
<Info>{
|
<Info>
|
||||||
info.description.split('\n').map((descLine, i) => <p key={i}>{descLine}</p>)
|
{info.description.split("\n").map((descLine, i) => (
|
||||||
}</Info>
|
<p key={i}>{descLine}</p>
|
||||||
{meIsOwner ? (
|
))}
|
||||||
|
</Info>
|
||||||
|
{canEdit ? (
|
||||||
<EditButton
|
<EditButton
|
||||||
onClick={() => props.history.push(`/event/${event.id}/edit`)}
|
onClick={() => props.history.push(`/event/${event.id}/edit`)}
|
||||||
css={{}}
|
css={{}}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import * as React from 'react'
|
||||||
|
import styled from '@emotion/styled'
|
||||||
|
import {EventDetailsData} from "./useEventDetailsQuery"
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
event: EventDetailsData
|
||||||
|
}
|
||||||
|
|
||||||
|
const EventHeaderImage = (props: Props) => {
|
||||||
|
return <Root>
|
||||||
|
|
||||||
|
</Root>
|
||||||
|
}
|
||||||
|
|
||||||
|
const Root = styled.div`
|
||||||
|
|
||||||
|
`
|
|
@ -7,6 +7,7 @@ schema {
|
||||||
|
|
||||||
type CalendarEvent {
|
type CalendarEvent {
|
||||||
id: ID!
|
id: ID!
|
||||||
|
images: EventImages
|
||||||
info(lang: String!): EventInformation
|
info(lang: String!): EventInformation
|
||||||
infos: [EventInformation]!
|
infos: [EventInformation]!
|
||||||
location: Location!
|
location: Location!
|
||||||
|
@ -22,6 +23,13 @@ type Error {
|
||||||
path: String!
|
path: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type EventImages {
|
||||||
|
cover: Image
|
||||||
|
gallery: [Image!]
|
||||||
|
poster: Image
|
||||||
|
thumb: Image
|
||||||
|
}
|
||||||
|
|
||||||
type EventInformation {
|
type EventInformation {
|
||||||
description: String
|
description: String
|
||||||
language: String!
|
language: String!
|
||||||
|
@ -56,21 +64,33 @@ type EventTime {
|
||||||
timeZone: TimeZone
|
timeZone: TimeZone
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Image {
|
||||||
|
url: String!
|
||||||
|
}
|
||||||
|
|
||||||
type Location {
|
type Location {
|
||||||
address: String
|
address: String
|
||||||
name: String
|
name: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
|
addEventGalleryImages(input: EventImagesUploadInput!): CalendarEvent
|
||||||
createEvent(input: CreateEventInput!): CalendarEvent
|
createEvent(input: CreateEventInput!): CalendarEvent
|
||||||
createEventTag(input: CreateEventTagInput!): EventTag
|
createEventTag(input: CreateEventTagInput!): EventTag
|
||||||
deleteEvent(id: ID!): User!
|
deleteEvent(id: ID!): User!
|
||||||
deleteEventTag(input: DeleteEventTagInput!): [EventTag]
|
deleteEventTag(input: DeleteEventTagInput!): [EventTag]
|
||||||
grantRole(input: GrantRoleInput!): User!
|
grantRole(input: GrantRoleInput!): User!
|
||||||
|
removeEventGalleryImages(input: EventGalleryImagesInput!): CalendarEvent
|
||||||
requestInvite(input: RequestInviteInput!): Boolean!
|
requestInvite(input: RequestInviteInput!): Boolean!
|
||||||
revokeRole(input: GrantRoleInput!): User!
|
revokeRole(input: GrantRoleInput!): User!
|
||||||
|
setEventCoverImage(input: EventImageUploadInput!): CalendarEvent
|
||||||
|
setEventPosterImage(input: EventImageUploadInput!): CalendarEvent
|
||||||
|
setEventThumbnailImage(input: EventImageUploadInput!): CalendarEvent
|
||||||
signin(input: SigninInput!): UserSession!
|
signin(input: SigninInput!): UserSession!
|
||||||
signup(input: SignupInput!): [Error]
|
signup(input: SignupInput!): [Error]
|
||||||
|
unsetEventCoverImage(id: ID!): CalendarEvent
|
||||||
|
unsetEventPosterImage(id: ID!): CalendarEvent
|
||||||
|
unsetEventThumbnailImage(id: ID!): CalendarEvent
|
||||||
updateEvent(input: UpdateEventInput!): CalendarEvent
|
updateEvent(input: UpdateEventInput!): CalendarEvent
|
||||||
updateEventTag(input: UpdateEventTagInput!): EventTag
|
updateEventTag(input: UpdateEventTagInput!): EventTag
|
||||||
}
|
}
|
||||||
|
@ -128,6 +148,21 @@ input DeleteEventTagInput {
|
||||||
id: ID!
|
id: ID!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input EventGalleryImagesInput {
|
||||||
|
eventId: ID!
|
||||||
|
imageIds: [ID!]!
|
||||||
|
}
|
||||||
|
|
||||||
|
input EventImageUploadInput {
|
||||||
|
file: Upload!
|
||||||
|
id: ID!
|
||||||
|
}
|
||||||
|
|
||||||
|
input EventImagesUploadInput {
|
||||||
|
files: [Upload!]!
|
||||||
|
id: ID!
|
||||||
|
}
|
||||||
|
|
||||||
input EventInformationInput {
|
input EventInformationInput {
|
||||||
description: String
|
description: String
|
||||||
language: String!
|
language: String!
|
||||||
|
@ -215,6 +250,8 @@ scalar Category
|
||||||
|
|
||||||
scalar Date
|
scalar Date
|
||||||
|
|
||||||
|
scalar Upload
|
||||||
|
|
||||||
scalar Translations
|
scalar Translations
|
||||||
|
|
||||||
scalar Language
|
scalar Language
|
||||||
|
|
Loading…
Reference in New Issue