From dd8fdf36d772fcd6c6ffaed74ed68bda7257739d Mon Sep 17 00:00:00 2001 From: felipe torres Date: Sun, 7 Jul 2024 12:19:41 -0700 Subject: [PATCH 1/7] v0 for mytickets --- app/api/gql/graphql.ts | 423 +++++++++++------- .../graphql/FetchExampleEvents.generated.tsx | 126 ++++++ .../graphql/FetchExampleEvents.gql | 17 + app/components/MyTickets/MyTicketsList.tsx | 56 +++ .../MyTickets/MyTicketsLoadingSkeleton.tsx | 3 + .../MyTickets/graphql/myTickets.generated.tsx | 62 ++- .../MyTickets/graphql/myTickets.gql | 28 +- app/root.tsx | 4 + app/routes/_authenticated/tickets/index.tsx | 23 +- codegen.ts | 5 +- package-lock.json | 10 + package.json | 1 + 12 files changed, 579 insertions(+), 179 deletions(-) create mode 100644 app/components/LandingPageEvents/graphql/FetchExampleEvents.generated.tsx create mode 100644 app/components/LandingPageEvents/graphql/FetchExampleEvents.gql create mode 100644 app/components/MyTickets/MyTicketsList.tsx create mode 100644 app/components/MyTickets/MyTicketsLoadingSkeleton.tsx diff --git a/app/api/gql/graphql.ts b/app/api/gql/graphql.ts index 7471031..d17f1cd 100644 --- a/app/api/gql/graphql.ts +++ b/app/api/gql/graphql.ts @@ -55,28 +55,28 @@ export enum CommnunityStatus { /** Representation of a Community */ export type Community = { - banner: Maybe; - description: Maybe; + banner?: Maybe; + description?: Maybe; events: Array; id: Scalars["String"]["output"]; - logo: Maybe; - name: Maybe; + logo?: Maybe; + name?: Maybe; status: CommnunityStatus; users: Array; }; /** Representation of a workEmail */ export type Company = { - description: Maybe; + description?: Maybe; domain: Scalars["String"]["output"]; hasBeenUpdated: Scalars["Boolean"]["output"]; id: Scalars["String"]["output"]; - logo: Maybe; - name: Maybe; + logo?: Maybe; + name?: Maybe; salarySubmissions: Scalars["Int"]["output"]; /** Not available to users */ - status: Maybe; - website: Maybe; + status?: Maybe; + website?: Maybe; }; export enum CompanyStatus { @@ -100,13 +100,13 @@ export type CreateCommunityInput = { }; export type CreateCompanyInput = { - description: InputMaybe; + description?: InputMaybe; /** The email domain of the company (What we'll use to match the company to the user on account-creation) */ domain: Scalars["String"]["input"]; - logo: InputMaybe; - name: InputMaybe; - status: InputMaybe; - website: InputMaybe; + logo?: InputMaybe; + name?: InputMaybe; + status?: InputMaybe; + website?: InputMaybe; }; export type CreateSalaryInput = { @@ -137,16 +137,16 @@ export type EnqueueGoogleAlbumImportInput = { /** Representation of an Event (Events and Users, is what tickets are linked to) */ export type Event = { - address: Maybe; - community: Maybe; - description: Maybe; - endDateTime: Maybe; + address?: Maybe; + community?: Maybe; + description?: Maybe; + endDateTime?: Maybe; id: Scalars["String"]["output"]; images: Array; - latitude: Maybe; - longitude: Maybe; - maxAttendees: Maybe; - meetingURL: Maybe; + latitude?: Maybe; + longitude?: Maybe; + maxAttendees?: Maybe; + meetingURL?: Maybe; name: Scalars["String"]["output"]; startDateTime: Scalars["DateTime"]["output"]; status: EventStatus; @@ -161,39 +161,39 @@ export type Event = { /** Representation of an Event (Events and Users, is what tickets are linked to) */ export type EventUsersTicketsArgs = { - input: InputMaybe; + input?: InputMaybe; }; export type EventCreateInput = { - address: InputMaybe; + address?: InputMaybe; communityId: Scalars["String"]["input"]; description: Scalars["String"]["input"]; - endDateTime: InputMaybe; - latitude: InputMaybe; - longitude: InputMaybe; + endDateTime?: InputMaybe; + latitude?: InputMaybe; + longitude?: InputMaybe; maxAttendees: Scalars["Int"]["input"]; - meetingURL: InputMaybe; + meetingURL?: InputMaybe; name: Scalars["String"]["input"]; startDateTime: Scalars["DateTime"]["input"]; - status: InputMaybe; - timeZone: InputMaybe; - visibility: InputMaybe; + status?: InputMaybe; + timeZone?: InputMaybe; + visibility?: InputMaybe; }; export type EventEditInput = { - address: InputMaybe; - description: InputMaybe; - endDateTime: InputMaybe; + address?: InputMaybe; + description?: InputMaybe; + endDateTime?: InputMaybe; eventId: Scalars["String"]["input"]; - latitude: InputMaybe; - longitude: InputMaybe; - maxAttendees: InputMaybe; - meetingURL: InputMaybe; - name: InputMaybe; - startDateTime: InputMaybe; - status: InputMaybe; - timeZone: InputMaybe; - visibility: InputMaybe; + latitude?: InputMaybe; + longitude?: InputMaybe; + maxAttendees?: InputMaybe; + meetingURL?: InputMaybe; + name?: InputMaybe; + startDateTime?: InputMaybe; + status?: InputMaybe; + timeZone?: InputMaybe; + visibility?: InputMaybe; }; /** Search for tags */ @@ -223,10 +223,10 @@ export type EventsSearchInput = { }; export type EventsTicketsSearchInput = { - approvalStatus: InputMaybe; - id: InputMaybe; - paymentStatus: InputMaybe; - redemptionStatus: InputMaybe; + approvalStatus?: InputMaybe; + id?: InputMaybe; + paymentStatus?: InputMaybe; + redemptionStatus?: InputMaybe; }; export enum Gender { @@ -377,10 +377,21 @@ export type MutationValidateWorkEmailArgs = { }; export type MyTicketsSearchValues = { - approvalStatus: InputMaybe; - eventId: InputMaybe; - paymentStatus: InputMaybe; - redemptionStatus: InputMaybe; + approvalStatus?: InputMaybe; + eventId?: InputMaybe; + paymentStatus?: InputMaybe; + redemptionStatus?: InputMaybe; +}; + +/** Type used for querying the paginated leaves and it's paginated meta data */ +export type PaginatedEvent = { + data: Array; + pagination: Pagination; +}; + +export type PaginatedInputEventsSearchInput = { + pagination?: PaginationSearchInputParams; + search?: InputMaybe; }; /** Type used for querying the paginated leaves and it's paginated meta data */ @@ -395,8 +406,8 @@ export type PaginatedInputEventsSearchInput = { }; export type PaginatedInputMyTicketsSearchValues = { - pagination: PaginationSearchInputParams; - search: InputMaybe; + pagination?: PaginationSearchInputParams; + search?: InputMaybe; }; /** Type used for querying the paginated leaves and it's paginated meta data */ @@ -444,16 +455,16 @@ export type PublicFinanceEntryRef = { id: Scalars["String"]["output"]; platform: Scalars["String"]["output"]; transactionAmount: Scalars["Float"]["output"]; - transactionDate: Maybe; + transactionDate?: Maybe; }; /** Representation of a Purchase Order */ export type PurchaseOrder = { - currency: Maybe; - finalPrice: Maybe; + currency?: Maybe; + finalPrice?: Maybe; id: Scalars["ID"]["output"]; - paymentLink: Maybe; - status: Maybe; + paymentLink?: Maybe; + status?: Maybe; tickets: Array; }; @@ -472,13 +483,13 @@ export type Query = { /** Get a list of communities. Filter by name, id, or status */ communities: Array; /** Get a community by id */ - community: Maybe; + community?: Maybe; /** Get all available companies */ companies: Array; /** Get all available companies */ company: Company; /** Get an event by id */ - event: Maybe; + event?: Maybe; /** Get a list of images, that are attached to an event */ eventImages: Array; /** Get the current user */ @@ -511,9 +522,9 @@ export type Query = { }; export type QueryCommunitiesArgs = { - id: InputMaybe; - name: InputMaybe; - status: InputMaybe; + id?: InputMaybe; + name?: InputMaybe; + status?: InputMaybe; }; export type QueryCommunityArgs = { @@ -521,7 +532,7 @@ export type QueryCommunityArgs = { }; export type QueryCompaniesArgs = { - input: InputMaybe; + input?: InputMaybe; }; export type QueryCompanyArgs = { @@ -553,11 +564,11 @@ export type QuerySearchPaymentLogsArgs = { }; export type QueryStatusArgs = { - name: InputMaybe; + name?: InputMaybe; }; export type QueryTagsArgs = { - input: InputMaybe; + input?: InputMaybe; }; export type QueryUserSearchArgs = { @@ -585,8 +596,8 @@ export type Salary = { company: Company; countryCode: Scalars["String"]["output"]; currencyCode: Scalars["String"]["output"]; - gender: Maybe; - genderOtherText: Maybe; + gender?: Maybe; + genderOtherText?: Maybe; id: Scalars["String"]["output"]; typeOfEmployment: TypeOfEmployment; workMetodology: WorkMetodology; @@ -606,14 +617,14 @@ export type SanityAssetRef = { }; export type SearchCompaniesInput = { - companyName: InputMaybe; - description: InputMaybe; - domain: InputMaybe; - website: InputMaybe; + companyName?: InputMaybe; + description?: InputMaybe; + domain?: InputMaybe; + website?: InputMaybe; }; export type SearchPaymentLogsInput = { - endDate: InputMaybe; + endDate?: InputMaybe; startDate: Scalars["DateTime"]["input"]; }; @@ -629,22 +640,22 @@ export enum ServiceErrors { /** Representation of a tag. Tags can be associated to many things. An event, a community, etc. */ export type Tag = { - description: Maybe; + description?: Maybe; id: Scalars["String"]["output"]; - name: Maybe; + name?: Maybe; slug: Scalars["String"]["output"]; }; export type TagSearchInput = { - description: InputMaybe; - id: InputMaybe; - name: InputMaybe; + description?: InputMaybe; + id?: InputMaybe; + name?: InputMaybe; }; /** Representation of a ticket */ export type Ticket = { - description: Maybe; - endDateTime: Maybe; + description?: Maybe; + endDateTime?: Maybe; event: Event; id: Scalars["ID"]["output"]; /** Whether or not the ticket is free */ @@ -652,9 +663,9 @@ export type Ticket = { /** Whether or not the ticket has an unlimited quantity. This is reserved for things loike online events. */ isUnlimited: Scalars["Boolean"]["output"]; name: Scalars["String"]["output"]; - prices: Maybe>; + prices?: Maybe>; /** The number of tickets available for this ticket type */ - quantity: Maybe; + quantity?: Maybe; requiresApproval: Scalars["Boolean"]["output"]; startDateTime: Scalars["DateTime"]["output"]; status: TicketTemplateStatus; @@ -671,43 +682,43 @@ export enum TicketApprovalStatus { export type TicketClaimInput = { /** If this field is passed, a purchase order payment link will be generated right away */ - generatePaymentLink: InputMaybe; + generatePaymentLink?: InputMaybe; /** A unique key to prevent duplicate requests, it's optional to send, but it's recommended to send it to prevent duplicate requests. If not sent, it will be created by the server. */ - idempotencyUUIDKey: InputMaybe; + idempotencyUUIDKey?: InputMaybe; purchaseOrder: Array; }; export type TicketCreateInput = { - description: InputMaybe; - endDateTime: InputMaybe; + description?: InputMaybe; + endDateTime?: InputMaybe; eventId: Scalars["String"]["input"]; /** If the ticket is free, the price submitted will be ignored. */ isFree: Scalars["Boolean"]["input"]; name: Scalars["String"]["input"]; - prices: InputMaybe>; - quantity: InputMaybe; - requiresApproval: InputMaybe; + prices?: InputMaybe>; + quantity?: InputMaybe; + requiresApproval?: InputMaybe; startDateTime: Scalars["DateTime"]["input"]; - status: InputMaybe; + status?: InputMaybe; /** If provided, quantity must not be passed. This is for things like online events where there is no limit to the amount of tickets that can be sold. */ unlimitedTickets: Scalars["Boolean"]["input"]; - visibility: InputMaybe; + visibility?: InputMaybe; }; export type TicketEditInput = { - description: InputMaybe; - endDateTime: InputMaybe; - eventId: InputMaybe; - name: InputMaybe; - prices: InputMaybe; - quantity: InputMaybe; - requiresApproval: InputMaybe; - startDateTime: InputMaybe; - status: InputMaybe; + description?: InputMaybe; + endDateTime?: InputMaybe; + eventId?: InputMaybe; + name?: InputMaybe; + prices?: InputMaybe; + quantity?: InputMaybe; + requiresApproval?: InputMaybe; + startDateTime?: InputMaybe; + status?: InputMaybe; ticketId: Scalars["String"]["input"]; /** If provided, quantity must not be passed. This is for things like online events where there is no limit to the amount of tickets that can be sold. */ - unlimitedTickets: InputMaybe; - visibility: InputMaybe; + unlimitedTickets?: InputMaybe; + visibility?: InputMaybe; }; export enum TicketPaymentStatus { @@ -740,38 +751,38 @@ export enum TypeOfEmployment { export type UpdateCommunityInput = { communityId: Scalars["String"]["input"]; - description: InputMaybe; - name: InputMaybe; - slug: InputMaybe; - status: InputMaybe; + description?: InputMaybe; + name?: InputMaybe; + slug?: InputMaybe; + status?: InputMaybe; }; export type UpdateCompanyInput = { companyId: Scalars["String"]["input"]; - description: InputMaybe; - domain: InputMaybe; - logo: InputMaybe; - name: InputMaybe; - website: InputMaybe; + description?: InputMaybe; + domain?: InputMaybe; + logo?: InputMaybe; + name?: InputMaybe; + website?: InputMaybe; }; export type UpdateSalaryInput = { - amount: InputMaybe; + amount?: InputMaybe; confirmationToken: Scalars["String"]["input"]; - countryCode: InputMaybe; - currencyCode: InputMaybe; - gender: InputMaybe; - genderOtherText: InputMaybe; + countryCode?: InputMaybe; + currencyCode?: InputMaybe; + gender?: InputMaybe; + genderOtherText?: InputMaybe; salaryId: Scalars["String"]["input"]; - typeOfEmployment: InputMaybe; - workMetodology: InputMaybe; - workSeniorityAndRoleId: InputMaybe; - yearsOfExperience: InputMaybe; + typeOfEmployment?: InputMaybe; + workMetodology?: InputMaybe; + workSeniorityAndRoleId?: InputMaybe; + yearsOfExperience?: InputMaybe; }; /** Representation of a user */ export type User = { - bio: Maybe; + bio?: Maybe; communities: Array; email: Maybe; id: Scalars["String"]["output"]; @@ -787,7 +798,7 @@ export type UserTicket = { approvalStatus: TicketApprovalStatus; id: Scalars["ID"]["output"]; paymentStatus: TicketPaymentStatus; - purchaseOrder: Maybe; + purchaseOrder?: Maybe; redemptionStatus: TicketRedemptionStatus; ticketTemplate: Ticket; }; @@ -799,8 +810,8 @@ export enum ValidPaymentMethods { /** Representation of a work email associated to the current user */ export type ValidatedWorkEmail = { - company: Maybe; - confirmationDate: Maybe; + company?: Maybe; + confirmationDate?: Maybe; id: Scalars["String"]["output"]; isValidated: Scalars["Boolean"]["output"]; status: EmailStatus; @@ -821,7 +832,7 @@ export enum WorkMetodology { /** Representation of a work role */ export type WorkRole = { - description: Maybe; + description?: Maybe; id: Scalars["String"]["output"]; name: Scalars["String"]["output"]; seniorities: Array; @@ -833,7 +844,7 @@ export type WorkRoleSenioritiesInput = { /** Representation of a work seniority */ export type WorkSeniority = { - description: Maybe; + description?: Maybe; id: Scalars["String"]["output"]; name: Scalars["String"]["output"]; }; @@ -845,28 +856,38 @@ export type UpdateUserRoleInCommunityInput = { }; export type UserEditInput = { - bio: InputMaybe; + bio?: InputMaybe; id: Scalars["String"]["input"]; - lastName: InputMaybe; - name: InputMaybe; - username: InputMaybe; + lastName?: InputMaybe; + name?: InputMaybe; + username?: InputMaybe; }; export type UserSearchInput = { - tags: InputMaybe>; + tags?: InputMaybe>; }; export type MyTicketsQueryVariables = Exact<{ - input: PaginatedInputMyTicketsSearchValues; + input: PaginatedInputEventsSearchInput; + userTicketSearchInput?: InputMaybe; }>; export type MyTicketsQuery = { - myTickets: { + searchEvents: { data: Array<{ - approvalStatus: TicketApprovalStatus; id: string; - paymentStatus: TicketPaymentStatus; - redemptionStatus: TicketRedemptionStatus; + name: string; + description?: string | null; + startDateTime: string; + status: EventStatus; + community?: { id: string; name?: string | null } | null; + usersTickets: Array<{ + id: string; + approvalStatus: TicketApprovalStatus; + paymentStatus: TicketPaymentStatus; + redemptionStatus: TicketRedemptionStatus; + ticketTemplate: { description?: string | null; id: string }; + }>; }>; pagination: { currentPage: number; @@ -901,10 +922,10 @@ export type CreatePurchaseOrderMutation = { | { __typename: "PurchaseOrder"; id: string; - finalPrice: number | null; - paymentLink: string | null; - status: PurchaseOrderStatusEnum | null; - currency: { id: string } | null; + finalPrice?: number | null; + paymentLink?: string | null; + status?: PurchaseOrderStatusEnum | null; + currency?: { id: string } | null; tickets: Array<{ id: string; approvalStatus: TicketApprovalStatus; @@ -922,13 +943,13 @@ export type CreatePurchaseOrderMutation = { export type EventTicketFragmentFragment = { id: string; name: string; - description: string | null; - quantity: number | null; + description?: string | null; + quantity?: number | null; isFree: boolean; startDateTime: string; status: TicketTemplateStatus; isUnlimited: boolean; - prices: Array<{ + prices?: Array<{ id: string; amount: number; currency: { currency: string; id: string }; @@ -940,17 +961,17 @@ export type GetEventAndTicketsQueryVariables = Exact<{ }>; export type GetEventAndTicketsQuery = { - event: { + event?: { id: string; name: string; - address: string | null; - description: string | null; - maxAttendees: number | null; + address?: string | null; + description?: string | null; + maxAttendees?: number | null; startDateTime: string; - endDateTime: string | null; + endDateTime?: string | null; status: EventStatus; - community: { name: string | null } | null; - users: Array<{ id: string; name: string | null }>; + community?: { name?: string | null } | null; + users: Array<{ id: string; name?: string | null }>; tickets: Array<{ " $fragmentRefs"?: { EventTicketFragmentFragment: EventTicketFragmentFragment; @@ -1028,20 +1049,28 @@ export const MyTicketsDocument = { kind: "NonNullType", type: { kind: "NamedType", - name: { - kind: "Name", - value: "PaginatedInputMyTicketsSearchValues", - }, + name: { kind: "Name", value: "PaginatedInputEventsSearchInput" }, }, }, }, + { + kind: "VariableDefinition", + variable: { + kind: "Variable", + name: { kind: "Name", value: "userTicketSearchInput" }, + }, + type: { + kind: "NamedType", + name: { kind: "Name", value: "EventsTicketsSearchInput" }, + }, + }, ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", - name: { kind: "Name", value: "myTickets" }, + name: { kind: "Name", value: "searchEvents" }, arguments: [ { kind: "Argument", @@ -1061,18 +1090,94 @@ export const MyTicketsDocument = { selectionSet: { kind: "SelectionSet", selections: [ + { kind: "Field", name: { kind: "Name", value: "id" } }, + { kind: "Field", name: { kind: "Name", value: "name" } }, { kind: "Field", - name: { kind: "Name", value: "approvalStatus" }, + name: { kind: "Name", value: "description" }, }, - { kind: "Field", name: { kind: "Name", value: "id" } }, { kind: "Field", - name: { kind: "Name", value: "paymentStatus" }, + name: { kind: "Name", value: "startDateTime" }, }, { kind: "Field", - name: { kind: "Name", value: "redemptionStatus" }, + name: { kind: "Name", value: "community" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "id" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "name" }, + }, + ], + }, + }, + { + kind: "Field", + name: { kind: "Name", value: "status" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "usersTickets" }, + arguments: [ + { + kind: "Argument", + name: { kind: "Name", value: "input" }, + value: { + kind: "Variable", + name: { + kind: "Name", + value: "userTicketSearchInput", + }, + }, + }, + ], + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "id" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "approvalStatus" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "paymentStatus" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "redemptionStatus" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "ticketTemplate" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { + kind: "Name", + value: "description", + }, + }, + { + kind: "Field", + name: { kind: "Name", value: "id" }, + }, + ], + }, + }, + ], + }, }, ], }, diff --git a/app/components/LandingPageEvents/graphql/FetchExampleEvents.generated.tsx b/app/components/LandingPageEvents/graphql/FetchExampleEvents.generated.tsx new file mode 100644 index 0000000..af707df --- /dev/null +++ b/app/components/LandingPageEvents/graphql/FetchExampleEvents.generated.tsx @@ -0,0 +1,126 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +// @ts-nocheck +/* eslint-disable */ +/* prettier-ignore */ +/* This file is automatically generated. Please do not modify it manually. */ +import * as Types from '../../../api/gql/graphql'; + +import { gql } from "graphql-tag"; +import * as Apollo from "@apollo/client"; +const defaultOptions = {} as const; +export type FetchExampleEventsQueryVariables = Types.Exact<{ + input: Types.PaginatedInputEventsSearchInput; +}>; + +export type FetchExampleEventsQuery = { + __typename?: "Query"; + searchEvents: { + __typename?: "PaginatedEvent"; + data: Array<{ + __typename?: "Event"; + id: string; + description?: string | null; + community?: { + __typename?: "Community"; + id: string; + name?: string | null; + } | null; + tags: Array<{ + __typename?: "Tag"; + id: string; + name?: string | null; + description?: string | null; + }>; + }>; + }; +}; + +export const FetchExampleEventsDocument = gql` + query FetchExampleEvents($input: PaginatedInputEventsSearchInput!) { + searchEvents(input: $input) { + data { + id + description + community { + id + name + } + tags { + id + name + description + } + } + } + } +`; + +/** + * __useFetchExampleEventsQuery__ + * + * To run a query within a React component, call `useFetchExampleEventsQuery` and pass it any options that fit your needs. + * When your component renders, `useFetchExampleEventsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useFetchExampleEventsQuery({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useFetchExampleEventsQuery( + baseOptions: Apollo.QueryHookOptions< + FetchExampleEventsQuery, + FetchExampleEventsQueryVariables + > & + ( + | { variables: FetchExampleEventsQueryVariables; skip?: boolean } + | { skip: boolean } + ), +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + FetchExampleEventsQuery, + FetchExampleEventsQueryVariables + >(FetchExampleEventsDocument, options); +} +export function useFetchExampleEventsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + FetchExampleEventsQuery, + FetchExampleEventsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + FetchExampleEventsQuery, + FetchExampleEventsQueryVariables + >(FetchExampleEventsDocument, options); +} +export function useFetchExampleEventsSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + FetchExampleEventsQuery, + FetchExampleEventsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + FetchExampleEventsQuery, + FetchExampleEventsQueryVariables + >(FetchExampleEventsDocument, options); +} +export type FetchExampleEventsQueryHookResult = ReturnType< + typeof useFetchExampleEventsQuery +>; +export type FetchExampleEventsLazyQueryHookResult = ReturnType< + typeof useFetchExampleEventsLazyQuery +>; +export type FetchExampleEventsSuspenseQueryHookResult = ReturnType< + typeof useFetchExampleEventsSuspenseQuery +>; +export type FetchExampleEventsQueryResult = Apollo.QueryResult< + FetchExampleEventsQuery, + FetchExampleEventsQueryVariables +>; diff --git a/app/components/LandingPageEvents/graphql/FetchExampleEvents.gql b/app/components/LandingPageEvents/graphql/FetchExampleEvents.gql new file mode 100644 index 0000000..7c486ef --- /dev/null +++ b/app/components/LandingPageEvents/graphql/FetchExampleEvents.gql @@ -0,0 +1,17 @@ +query FetchExampleEvents($input: PaginatedInputEventsSearchInput!) { + searchEvents(input: $input) { + data { + id + description + community { + id + name + } + tags { + id + name + description + } + } + } +} diff --git a/app/components/MyTickets/MyTicketsList.tsx b/app/components/MyTickets/MyTicketsList.tsx new file mode 100644 index 0000000..5c10e60 --- /dev/null +++ b/app/components/MyTickets/MyTicketsList.tsx @@ -0,0 +1,56 @@ +import { formatDistanceToNow, subDays, format } from "date-fns"; + +import { useMyTicketsSuspenseQuery } from "~/components/MyTickets/graphql/myTickets.generated"; +import { Card, CardTitle } from "~/components/ui/card"; + +export const MyTicketsList = () => { + const { data } = useMyTicketsSuspenseQuery({ + variables: { + input: { + search: { + userHasTickets: true, + id: null, + name: null, + startDateTimeFrom: null, + startDateTimeTo: null, + status: null, + visibility: null, + }, + pagination: { + page: 0, + pageSize: 10, + }, + }, + }, + }); + + return ( +
+ {data.searchEvents.data.map((event) => { + const parsedDate = new Date(event.startDateTime as string); + const isOverAWeekFromNow = parsedDate > subDays(new Date(), 7); + const relativeDate = formatDistanceToNow(parsedDate, { + addSuffix: true, + }); + const formattedDate = format(parsedDate, "cccc - d 'de' MMMM, yyyy"); + const date = isOverAWeekFromNow ? formattedDate : relativeDate; + + const formattedTime = format(parsedDate, "hh:mm aaa"); + + return ( + +
+ {date} + {formattedTime} +
+ {event.name} +
{event.usersTickets.length} tickets
+
+ ); + })} +
+ ); +}; diff --git a/app/components/MyTickets/MyTicketsLoadingSkeleton.tsx b/app/components/MyTickets/MyTicketsLoadingSkeleton.tsx new file mode 100644 index 0000000..1b2d0dc --- /dev/null +++ b/app/components/MyTickets/MyTicketsLoadingSkeleton.tsx @@ -0,0 +1,3 @@ +export const MyTicketsLoadingSkeleton = () => { + return
...loading
; +}; diff --git a/app/components/MyTickets/graphql/myTickets.generated.tsx b/app/components/MyTickets/graphql/myTickets.generated.tsx index 8db11bf..30af105 100644 --- a/app/components/MyTickets/graphql/myTickets.generated.tsx +++ b/app/components/MyTickets/graphql/myTickets.generated.tsx @@ -9,19 +9,38 @@ import { gql } from "graphql-tag"; import * as Apollo from "@apollo/client"; const defaultOptions = {} as const; export type MyTicketsQueryVariables = Types.Exact<{ - input: Types.PaginatedInputMyTicketsSearchValues; + input: Types.PaginatedInputEventsSearchInput; + userTicketSearchInput?: Types.InputMaybe; }>; export type MyTicketsQuery = { __typename?: "Query"; - myTickets: { - __typename?: "PaginatedUserTicket"; + searchEvents: { + __typename?: "PaginatedEvent"; data: Array<{ - __typename?: "UserTicket"; - approvalStatus: Types.TicketApprovalStatus; + __typename?: "Event"; id: string; - paymentStatus: Types.TicketPaymentStatus; - redemptionStatus: Types.TicketRedemptionStatus; + name: string; + description?: string | null; + startDateTime: any; + status: Types.EventStatus; + community?: { + __typename?: "Community"; + id: string; + name?: string | null; + } | null; + usersTickets: Array<{ + __typename?: "UserTicket"; + id: string; + approvalStatus: Types.TicketApprovalStatus; + paymentStatus: Types.TicketPaymentStatus; + redemptionStatus: Types.TicketRedemptionStatus; + ticketTemplate: { + __typename?: "Ticket"; + description?: string | null; + id: string; + }; + }>; }>; pagination: { __typename?: "Pagination"; @@ -34,13 +53,31 @@ export type MyTicketsQuery = { }; export const MyTicketsDocument = gql` - query myTickets($input: PaginatedInputMyTicketsSearchValues!) { - myTickets(input: $input) { + query myTickets( + $input: PaginatedInputEventsSearchInput! + $userTicketSearchInput: EventsTicketsSearchInput + ) { + searchEvents(input: $input) { data { - approvalStatus id - paymentStatus - redemptionStatus + name + description + startDateTime + community { + id + name + } + status + usersTickets(input: $userTicketSearchInput) { + id + approvalStatus + paymentStatus + redemptionStatus + ticketTemplate { + description + id + } + } } pagination { currentPage @@ -65,6 +102,7 @@ export const MyTicketsDocument = gql` * const { data, loading, error } = useMyTicketsQuery({ * variables: { * input: // value for 'input' + * userTicketSearchInput: // value for 'userTicketSearchInput' * }, * }); */ diff --git a/app/components/MyTickets/graphql/myTickets.gql b/app/components/MyTickets/graphql/myTickets.gql index f7b178c..e9f8b2e 100644 --- a/app/components/MyTickets/graphql/myTickets.gql +++ b/app/components/MyTickets/graphql/myTickets.gql @@ -1,10 +1,28 @@ -query myTickets($input: PaginatedInputMyTicketsSearchValues!) { - myTickets(input: $input) { +query myTickets( + $input: PaginatedInputEventsSearchInput! + $userTicketSearchInput: EventsTicketsSearchInput +) { + searchEvents(input: $input) { data { - approvalStatus id - paymentStatus - redemptionStatus + name + description + startDateTime + community { + id + name + } + status + usersTickets(input: $userTicketSearchInput) { + id + approvalStatus + paymentStatus + redemptionStatus + ticketTemplate { + description + id + } + } } pagination { currentPage diff --git a/app/root.tsx b/app/root.tsx index b6ede27..4dc20e5 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -5,6 +5,8 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import { setDefaultOptions } from "date-fns"; +import { es } from "date-fns/locale"; import "./tailwind.css"; import { ApolloWrapper } from "~/api/ApolloWrapper"; @@ -12,6 +14,8 @@ import { Navbar } from "~/components/Navbar"; import { Toaster } from "~/components/ui/sonner"; import { AuthProvider } from "~/utils/supabase/AuthProvider"; +setDefaultOptions({ locale: es }); + export function Layout({ children }: { children: React.ReactNode }) { return ( diff --git a/app/routes/_authenticated/tickets/index.tsx b/app/routes/_authenticated/tickets/index.tsx index 5a1dd5a..7f34812 100644 --- a/app/routes/_authenticated/tickets/index.tsx +++ b/app/routes/_authenticated/tickets/index.tsx @@ -1,9 +1,28 @@ +import { cx } from "class-variance-authority"; +import { Suspense } from "react"; + +import { MyTicketsList } from "~/components/MyTickets/MyTicketsList"; +import { MyTicketsLoadingSkeleton } from "~/components/MyTickets/MyTicketsLoadingSkeleton"; import { sharedLayoutStyle } from "~/components/sharedLayouts"; +import { Tabs, TabsList, TabsTrigger } from "~/components/ui/tabs"; export default function Layout() { return ( -
-

Mis Tickets

+
+
+

Mis Tickets

+
+ + + Pasados + Futuros + + +
+
+ }> + +
); } diff --git a/codegen.ts b/codegen.ts index 08788b0..90fd97d 100644 --- a/codegen.ts +++ b/codegen.ts @@ -15,6 +15,9 @@ const noTypeCheckingPlugin = { }; const config = { ...defaultConfig, + hooks: { + afterOneFileWrite: ["prettier --write"], + }, ignoreNoDocuments: true, generates: { "app/api/gql/": { @@ -23,7 +26,7 @@ const config = { config: { useTypeImports: true, skipTypename: true, - avoidOptionals: true, + avoidOptionals: false, nonOptionalTypename: false, // Lamentablemente, code-gen establece "any" como predeterminado, cuando no tiene un // tipo para un "scalar". Esta opción nos obliga a definir un tipo cada vez que diff --git a/package-lock.json b/package-lock.json index c700e37..8add5e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "@supabase/supabase-js": "^2.44.2", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "date-fns": "^3.6.0", "framer-motion": "^11.2.12", "graphiql": "^3.0.6", "graphql": "^16.8.1", @@ -8210,6 +8211,15 @@ "integrity": "sha512-8YnDaaf7N3k/q5HnTJVuzSyLETjoZjVmHc4AeKAzOvKHEFQKcn64OKBfzHYtE9zGjctNM7V9I0MfnUVLpi7M5g==", "dev": true }, + "node_modules/date-fns": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", + "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/debounce": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", diff --git a/package.json b/package.json index 0208ed7..b559510 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@supabase/supabase-js": "^2.44.2", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", + "date-fns": "^3.6.0", "framer-motion": "^11.2.12", "graphiql": "^3.0.6", "graphql": "^16.8.1", From 216e2e90f50ad8a521073a4068ebf91dd81ce330 Mon Sep 17 00:00:00 2001 From: felipe torres Date: Mon, 8 Jul 2024 21:59:28 -0700 Subject: [PATCH 2/7] my tickets ui --- app/components/MyTickets/MyTicketsList.tsx | 19 +++++++-- .../MyTickets/MyTicketsLoadingSkeleton.tsx | 42 ++++++++++++++++++- app/components/Navbar/index.tsx | 6 +-- app/components/Register/Register.tsx | 2 +- app/routes/_authenticated/tickets/index.tsx | 2 +- app/utils/urls.ts | 3 +- components.json | 2 +- 7 files changed, 65 insertions(+), 11 deletions(-) diff --git a/app/components/MyTickets/MyTicketsList.tsx b/app/components/MyTickets/MyTicketsList.tsx index 5c10e60..5df07bc 100644 --- a/app/components/MyTickets/MyTicketsList.tsx +++ b/app/components/MyTickets/MyTicketsList.tsx @@ -1,7 +1,10 @@ import { formatDistanceToNow, subDays, format } from "date-fns"; +import { ArrowRight } from "lucide-react"; import { useMyTicketsSuspenseQuery } from "~/components/MyTickets/graphql/myTickets.generated"; +import { Button } from "~/components/ui/button"; import { Card, CardTitle } from "~/components/ui/card"; +import { urls } from "~/utils/urls"; export const MyTicketsList = () => { const { data } = useMyTicketsSuspenseQuery({ @@ -40,14 +43,24 @@ export const MyTicketsList = () => { return ( -
+
{date} {formattedTime}
{event.name} -
{event.usersTickets.length} tickets
+ ); })} diff --git a/app/components/MyTickets/MyTicketsLoadingSkeleton.tsx b/app/components/MyTickets/MyTicketsLoadingSkeleton.tsx index 1b2d0dc..1322e1c 100644 --- a/app/components/MyTickets/MyTicketsLoadingSkeleton.tsx +++ b/app/components/MyTickets/MyTicketsLoadingSkeleton.tsx @@ -1,3 +1,43 @@ +import { Button } from "~/components/ui/button"; +import { Card } from "~/components/ui/card"; +import { Skeleton } from "~/components/ui/skeleton"; + +const LoadingCard = () => { + return ( + +
+ + + {/* - + + + + */} + + + + {/* - + + + + */} + +
+ +
+ +
+
+ ); +}; export const MyTicketsLoadingSkeleton = () => { - return
...loading
; + return ( +
+ + + +
+ ); }; diff --git a/app/components/Navbar/index.tsx b/app/components/Navbar/index.tsx index ad70719..7a0e837 100644 --- a/app/components/Navbar/index.tsx +++ b/app/components/Navbar/index.tsx @@ -14,7 +14,7 @@ const guestItems = [ { content: "Eventos", show: true, - link: urls.eventos.root, + link: urls.events.root, }, { content: "Comunidades", @@ -33,7 +33,7 @@ export const Navbar = () => { { content: "Eventos", show: true, - link: urls.eventos.root, + link: urls.events.root, }, { content: "Comunidades", @@ -41,7 +41,7 @@ export const Navbar = () => { link: urls.comunidades, }, { - content: "Mis Tickets", + content: "Mis Eventos", show: true, link: urls.tickets.root, }, diff --git a/app/components/Register/Register.tsx b/app/components/Register/Register.tsx index ceac122..8d38e83 100644 --- a/app/components/Register/Register.tsx +++ b/app/components/Register/Register.tsx @@ -25,7 +25,7 @@ export const Register = (props: { eventId: string }) => { Para registrarte, por favor haz click en el botón.

); diff --git a/app/routes/_authenticated/tickets/index.tsx b/app/routes/_authenticated/tickets/index.tsx index 7f34812..e1d26ef 100644 --- a/app/routes/_authenticated/tickets/index.tsx +++ b/app/routes/_authenticated/tickets/index.tsx @@ -10,7 +10,7 @@ export default function Layout() { return (
-

Mis Tickets

+

Eventos

diff --git a/app/utils/urls.ts b/app/utils/urls.ts index 4dab974..9f5df46 100644 --- a/app/utils/urls.ts +++ b/app/utils/urls.ts @@ -1,9 +1,10 @@ export const urls = { home: "/", - eventos: { + events: { root: "/eventos", evento: (id: string) => `/eventos/${id}`, tickets: (id: string) => `/eventos/${id}/tickets`, + myTickets: (id: string) => `/eventos/${id}/my-tickets`, }, ordenes: { root: "/ordenes", diff --git a/components.json b/components.json index 27135ec..1ff84e3 100644 --- a/components.json +++ b/components.json @@ -12,6 +12,6 @@ }, "aliases": { "components": "~/components", - "utils": "~/lib/utils" + "utils": "~/utils/utils" } } From 9fcdf3d44bf1c4af558ff86bf527c3c5ed29785e Mon Sep 17 00:00:00 2001 From: felipe torres Date: Tue, 9 Jul 2024 06:56:24 -0700 Subject: [PATCH 3/7] transition and url name change --- app/api/gql/graphql.ts | 8 +-- .../{MyTickets => MyEvents}/MyTicketsList.tsx | 6 +- .../MyTicketsLoadingSkeleton.tsx | 0 .../graphql/myEvents.generated.tsx} | 68 +++++++++---------- .../graphql/myEvents.gql} | 2 +- app/components/Navbar/index.tsx | 2 +- app/root.tsx | 22 +++++- .../{tickets => my-events}/index.tsx | 4 +- app/utils/urls.ts | 6 +- 9 files changed, 65 insertions(+), 53 deletions(-) rename app/components/{MyTickets => MyEvents}/MyTicketsList.tsx (90%) rename app/components/{MyTickets => MyEvents}/MyTicketsLoadingSkeleton.tsx (100%) rename app/components/{MyTickets/graphql/myTickets.generated.tsx => MyEvents/graphql/myEvents.generated.tsx} (64%) rename app/components/{MyTickets/graphql/myTickets.gql => MyEvents/graphql/myEvents.gql} (97%) rename app/routes/_authenticated/{tickets => my-events}/index.tsx (83%) diff --git a/app/api/gql/graphql.ts b/app/api/gql/graphql.ts index d17f1cd..f62f0a7 100644 --- a/app/api/gql/graphql.ts +++ b/app/api/gql/graphql.ts @@ -872,7 +872,7 @@ export type MyTicketsQueryVariables = Exact<{ userTicketSearchInput?: InputMaybe; }>; -export type MyTicketsQuery = { +export type MyEventsQuery = { searchEvents: { data: Array<{ id: string; @@ -1037,7 +1037,7 @@ export const MyTicketsDocument = { { kind: "OperationDefinition", operation: "query", - name: { kind: "Name", value: "myTickets" }, + name: { kind: "Name", value: "myEvents" }, variableDefinitions: [ { kind: "VariableDefinition", @@ -1319,7 +1319,6 @@ export const CreatePurchaseOrderDocument = { { kind: "Field", name: { kind: "Name", value: "claimUserTicket" }, - arguments: [ { kind: "Argument", name: { kind: "Name", value: "input" }, @@ -1396,9 +1395,6 @@ export const CreatePurchaseOrderDocument = { }, ], }, - }, - ], - }, }, { kind: "InlineFragment", diff --git a/app/components/MyTickets/MyTicketsList.tsx b/app/components/MyEvents/MyTicketsList.tsx similarity index 90% rename from app/components/MyTickets/MyTicketsList.tsx rename to app/components/MyEvents/MyTicketsList.tsx index 5df07bc..d792c40 100644 --- a/app/components/MyTickets/MyTicketsList.tsx +++ b/app/components/MyEvents/MyTicketsList.tsx @@ -1,13 +1,13 @@ import { formatDistanceToNow, subDays, format } from "date-fns"; import { ArrowRight } from "lucide-react"; -import { useMyTicketsSuspenseQuery } from "~/components/MyTickets/graphql/myTickets.generated"; +import { useMyEventsSuspenseQuery } from "~/components/MyEvents/graphql/myEvents.generated"; import { Button } from "~/components/ui/button"; import { Card, CardTitle } from "~/components/ui/card"; import { urls } from "~/utils/urls"; export const MyTicketsList = () => { - const { data } = useMyTicketsSuspenseQuery({ + const { data } = useMyEventsSuspenseQuery({ variables: { input: { search: { @@ -53,7 +53,7 @@ export const MyTicketsList = () => {
+ + {format(event, "d 'de' MMMM, yyyy")} +
- + {groupedByDate[event].map((event) => { + const parsedDate = new Date(event.startDateTime as string); + const isOverAWeekFromNow = parsedDate > subDays(new Date(), 7); + const relativeDate = formatDistanceToNow(parsedDate, { + addSuffix: true, + }); + const formattedDate = format( + parsedDate, + "cccc - d 'de' MMMM, yyyy", + ); + const date = isOverAWeekFromNow ? formattedDate : relativeDate; + + const formattedTime = format(parsedDate, "hh:mm aaa"); + + return ( + +
+ {date} + {formattedTime} +
+ {event.name} +
+ +
+ + {event.community?.name} + +
+
+
+ ); + })} +
); })}
diff --git a/app/components/ui/badge.tsx b/app/components/ui/badge.tsx index 07e5ee8..ceeba6f 100644 --- a/app/components/ui/badge.tsx +++ b/app/components/ui/badge.tsx @@ -1,5 +1,5 @@ -import * as React from "react"; import { cva, type VariantProps } from "class-variance-authority"; +import * as React from "react"; import { cn } from "~/utils/utils"; From da6d0204cebb9e51aa54d97070cab6bffcd05209 Mon Sep 17 00:00:00 2001 From: felipe torres Date: Tue, 9 Jul 2024 20:16:36 -0700 Subject: [PATCH 6/7] prettier --- app/api/gql/gql.ts | 16 +++- app/api/gql/graphql.ts | 171 ++++++++++++++++++++++++++++++++++------- 2 files changed, 156 insertions(+), 31 deletions(-) diff --git a/app/api/gql/gql.ts b/app/api/gql/gql.ts index 243aea0..8e5819d 100644 --- a/app/api/gql/gql.ts +++ b/app/api/gql/gql.ts @@ -13,8 +13,10 @@ import type { TypedDocumentNode as DocumentNode } from "@graphql-typed-document- * Therefore it is highly recommended to use the babel or swc plugin for production. */ const documents = { - "query myTickets($input: PaginatedInputMyTicketsSearchValues!) {\n myTickets(input: $input) {\n data {\n approvalStatus\n id\n paymentStatus\n redemptionStatus\n }\n pagination {\n currentPage\n pageSize\n totalPages\n totalRecords\n }\n }\n}": - types.MyTicketsDocument, + "query FetchExampleEvents($input: PaginatedInputEventsSearchInput!) {\n searchEvents(input: $input) {\n data {\n id\n description\n community {\n id\n name\n }\n tags {\n id\n name\n description\n }\n }\n }\n}": + types.FetchExampleEventsDocument, + "query myEvents($input: PaginatedInputEventsSearchInput!, $userTicketSearchInput: EventsTicketsSearchInput) {\n searchEvents(input: $input) {\n data {\n id\n name\n description\n startDateTime\n community {\n id\n name\n }\n status\n usersTickets(input: $userTicketSearchInput) {\n id\n approvalStatus\n paymentStatus\n redemptionStatus\n ticketTemplate {\n description\n id\n }\n }\n }\n pagination {\n currentPage\n pageSize\n totalPages\n totalRecords\n }\n }\n}": + types.MyEventsDocument, "mutation CheckPurchaseOrderStatus($input: CheckForPurchaseOrderInput!) {\n checkPurchaseOrderStatus(input: $input) {\n status\n tickets {\n approvalStatus\n paymentStatus\n redemptionStatus\n }\n }\n}": types.CheckPurchaseOrderStatusDocument, "mutation createPurchaseOrder($input: TicketClaimInput!) {\n claimUserTicket(input: $input) {\n __typename\n ... on PurchaseOrder {\n __typename\n id\n currency {\n id\n }\n finalPrice\n paymentLink\n status\n tickets {\n id\n approvalStatus\n redemptionStatus\n paymentStatus\n }\n }\n ... on RedeemUserTicketError {\n __typename\n error\n errorMessage\n }\n }\n}": @@ -43,8 +45,14 @@ export function graphql(source: string): unknown; * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: "query myTickets($input: PaginatedInputMyTicketsSearchValues!) {\n myTickets(input: $input) {\n data {\n approvalStatus\n id\n paymentStatus\n redemptionStatus\n }\n pagination {\n currentPage\n pageSize\n totalPages\n totalRecords\n }\n }\n}", -): (typeof documents)["query myTickets($input: PaginatedInputMyTicketsSearchValues!) {\n myTickets(input: $input) {\n data {\n approvalStatus\n id\n paymentStatus\n redemptionStatus\n }\n pagination {\n currentPage\n pageSize\n totalPages\n totalRecords\n }\n }\n}"]; + source: "query FetchExampleEvents($input: PaginatedInputEventsSearchInput!) {\n searchEvents(input: $input) {\n data {\n id\n description\n community {\n id\n name\n }\n tags {\n id\n name\n description\n }\n }\n }\n}", +): (typeof documents)["query FetchExampleEvents($input: PaginatedInputEventsSearchInput!) {\n searchEvents(input: $input) {\n data {\n id\n description\n community {\n id\n name\n }\n tags {\n id\n name\n description\n }\n }\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql( + source: "query myEvents($input: PaginatedInputEventsSearchInput!, $userTicketSearchInput: EventsTicketsSearchInput) {\n searchEvents(input: $input) {\n data {\n id\n name\n description\n startDateTime\n community {\n id\n name\n }\n status\n usersTickets(input: $userTicketSearchInput) {\n id\n approvalStatus\n paymentStatus\n redemptionStatus\n ticketTemplate {\n description\n id\n }\n }\n }\n pagination {\n currentPage\n pageSize\n totalPages\n totalRecords\n }\n }\n}", +): (typeof documents)["query myEvents($input: PaginatedInputEventsSearchInput!, $userTicketSearchInput: EventsTicketsSearchInput) {\n searchEvents(input: $input) {\n data {\n id\n name\n description\n startDateTime\n community {\n id\n name\n }\n status\n usersTickets(input: $userTicketSearchInput) {\n id\n approvalStatus\n paymentStatus\n redemptionStatus\n ticketTemplate {\n description\n id\n }\n }\n }\n pagination {\n currentPage\n pageSize\n totalPages\n totalRecords\n }\n }\n}"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/app/api/gql/graphql.ts b/app/api/gql/graphql.ts index f62f0a7..7afa503 100644 --- a/app/api/gql/graphql.ts +++ b/app/api/gql/graphql.ts @@ -213,13 +213,13 @@ export enum EventVisibility { } export type EventsSearchInput = { - id: InputMaybe; - name: InputMaybe; - startDateTimeFrom: InputMaybe; - startDateTimeTo: InputMaybe; - status: InputMaybe; - userHasTickets: InputMaybe; - visibility: InputMaybe; + id?: InputMaybe; + name?: InputMaybe; + startDateTimeFrom?: InputMaybe; + startDateTimeTo?: InputMaybe; + status?: InputMaybe; + userHasTickets?: InputMaybe; + visibility?: InputMaybe; }; export type EventsTicketsSearchInput = { @@ -394,17 +394,6 @@ export type PaginatedInputEventsSearchInput = { search?: InputMaybe; }; -/** Type used for querying the paginated leaves and it's paginated meta data */ -export type PaginatedEvent = { - data: Array; - pagination: Pagination; -}; - -export type PaginatedInputEventsSearchInput = { - pagination: PaginationSearchInputParams; - search: InputMaybe; -}; - export type PaginatedInputMyTicketsSearchValues = { pagination?: PaginationSearchInputParams; search?: InputMaybe; @@ -784,12 +773,12 @@ export type UpdateSalaryInput = { export type User = { bio?: Maybe; communities: Array; - email: Maybe; + email?: Maybe; id: Scalars["String"]["output"]; - imageUrl: Maybe; - isSuperAdmin: Maybe; - lastName: Maybe; - name: Maybe; + imageUrl?: Maybe; + isSuperAdmin?: Maybe; + lastName?: Maybe; + name?: Maybe; username: Scalars["String"]["output"]; }; @@ -867,7 +856,26 @@ export type UserSearchInput = { tags?: InputMaybe>; }; -export type MyTicketsQueryVariables = Exact<{ +export type FetchExampleEventsQueryVariables = Exact<{ + input: PaginatedInputEventsSearchInput; +}>; + +export type FetchExampleEventsQuery = { + searchEvents: { + data: Array<{ + id: string; + description?: string | null; + community?: { id: string; name?: string | null } | null; + tags: Array<{ + id: string; + name?: string | null; + description?: string | null; + }>; + }>; + }; +}; + +export type MyEventsQueryVariables = Exact<{ input: PaginatedInputEventsSearchInput; userTicketSearchInput?: InputMaybe; }>; @@ -904,7 +912,7 @@ export type CheckPurchaseOrderStatusMutationVariables = Exact<{ export type CheckPurchaseOrderStatusMutation = { checkPurchaseOrderStatus: { - status: PurchaseOrderStatusEnum | null; + status?: PurchaseOrderStatusEnum | null; tickets: Array<{ approvalStatus: TicketApprovalStatus; paymentStatus: TicketPaymentStatus; @@ -1031,7 +1039,112 @@ export const EventTicketFragmentFragmentDoc = { }, ], } as unknown as DocumentNode; -export const MyTicketsDocument = { +export const FetchExampleEventsDocument = { + kind: "Document", + definitions: [ + { + kind: "OperationDefinition", + operation: "query", + name: { kind: "Name", value: "FetchExampleEvents" }, + variableDefinitions: [ + { + kind: "VariableDefinition", + variable: { + kind: "Variable", + name: { kind: "Name", value: "input" }, + }, + type: { + kind: "NonNullType", + type: { + kind: "NamedType", + name: { kind: "Name", value: "PaginatedInputEventsSearchInput" }, + }, + }, + }, + ], + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "searchEvents" }, + arguments: [ + { + kind: "Argument", + name: { kind: "Name", value: "input" }, + value: { + kind: "Variable", + name: { kind: "Name", value: "input" }, + }, + }, + ], + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "data" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { kind: "Field", name: { kind: "Name", value: "id" } }, + { + kind: "Field", + name: { kind: "Name", value: "description" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "community" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "id" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "name" }, + }, + ], + }, + }, + { + kind: "Field", + name: { kind: "Name", value: "tags" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "id" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "name" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "description" }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode< + FetchExampleEventsQuery, + FetchExampleEventsQueryVariables +>; +export const MyEventsDocument = { kind: "Document", definitions: [ { @@ -1214,7 +1327,7 @@ export const MyTicketsDocument = { }, }, ], -} as unknown as DocumentNode; +} as unknown as DocumentNode; export const CheckPurchaseOrderStatusDocument = { kind: "Document", definitions: [ @@ -1319,6 +1432,7 @@ export const CreatePurchaseOrderDocument = { { kind: "Field", name: { kind: "Name", value: "claimUserTicket" }, + arguments: [ { kind: "Argument", name: { kind: "Name", value: "input" }, @@ -1395,6 +1509,9 @@ export const CreatePurchaseOrderDocument = { }, ], }, + }, + ], + }, }, { kind: "InlineFragment", From fd9c86caca51143bfce8fa98443e794258d3a8dc Mon Sep 17 00:00:00 2001 From: felipe torres Date: Tue, 9 Jul 2024 20:27:42 -0700 Subject: [PATCH 7/7] update --- app/root.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/root.tsx b/app/root.tsx index 13f6de4..b84df9d 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -8,7 +8,6 @@ import { } from "@remix-run/react"; import { setDefaultOptions } from "date-fns"; import { es } from "date-fns/locale"; - import "./tailwind.css"; import { AnimatePresence, motion } from "framer-motion";