diff --git a/dnscms/events/models.py b/dnscms/events/models.py
index 07ccc7e..9db4724 100644
--- a/dnscms/events/models.py
+++ b/dnscms/events/models.py
@@ -49,9 +49,9 @@ class EventCategory(models.Model):
panels = [FieldPanel("name"), FieldPanel("slug"), FieldPanel("show_in_filters")]
graphql_fields = [
- GraphQLString("name"),
- GraphQLString("slug"),
- GraphQLBoolean("show_in_filters"),
+ GraphQLString("name", required=True),
+ GraphQLString("slug", required=True),
+ GraphQLBoolean("show_in_filters", required=True),
]
class Meta:
@@ -171,8 +171,20 @@ class EventPage(Page):
GraphQLInt("price_regular"),
GraphQLInt("price_student"),
GraphQLInt("price_member"),
- GraphQLCollection(GraphQLForeignKey, "categories", "events.EventCategory"),
- GraphQLCollection(GraphQLForeignKey, "occurrences", "events.EventOccurrence"),
+ GraphQLCollection(
+ GraphQLForeignKey,
+ "categories",
+ "events.EventCategory",
+ required=True,
+ item_required=True,
+ ),
+ GraphQLCollection(
+ GraphQLForeignKey,
+ "occurrences",
+ "events.EventOccurrence",
+ required=True,
+ item_required=True,
+ ),
]
@@ -195,7 +207,7 @@ class EventOccurrence(Orderable):
]
graphql_fields = [
- GraphQLString("start"),
+ GraphQLString("start", required=True),
GraphQLString("end"),
GraphQLForeignKey("venue", "venues.VenuePage"),
]
diff --git a/web/src/app/client.ts b/web/src/app/client.ts
index 29ebbaa..b7d56ae 100644
--- a/web/src/app/client.ts
+++ b/web/src/app/client.ts
@@ -1,3 +1,5 @@
+import "server-only"
+
import { cacheExchange, createClient, fetchExchange } from "@urql/core";
import { registerUrql } from "@urql/next/rsc";
diff --git a/web/src/components/events/EventContainer.tsx b/web/src/components/events/EventContainer.tsx
index 286d7a8..7f57e71 100644
--- a/web/src/components/events/EventContainer.tsx
+++ b/web/src/components/events/EventContainer.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useQueryState, parseAsStringLiteral } from "nuqs";
+import { useQueryState, parseAsStringLiteral, parseAsString } from "nuqs";
import { EventItem } from "./EventItem";
import { EventFilter } from "./EventFilter";
import {
@@ -32,22 +32,12 @@ export const EventContainer = ({
);
const filterableCategories = eventCategories.filter((x) => x.showInFilters);
- const filterableCategorySlugs: string[] = filterableCategories
- .filter((x) => "slug" in x && typeof x.slug === "string")
- .map((x) => x.slug);
-
- const [category, setCategory] = useQueryState(
- "category",
- parseAsStringLiteral(filterableCategorySlugs).withDefault(null)
- );
+ const [category, setCategory] = useQueryState("category", parseAsString);
const filteredEvents = events.filter(
(x) =>
!category ||
- x.categories
- ?.filter((x) => x !== null)
- .map((eventCategory: EventCategory) => eventCategory.slug)
- .includes(category)
+ x.categories.map((eventCategory) => eventCategory.slug).includes(category)
);
return (
diff --git a/web/src/components/events/EventFilter.tsx b/web/src/components/events/EventFilter.tsx
index b5122f7..3b6133e 100644
--- a/web/src/components/events/EventFilter.tsx
+++ b/web/src/components/events/EventFilter.tsx
@@ -1,4 +1,4 @@
-import { EventCategoryFragment } from "@/lib/event";
+import { EventCategory } from "@/lib/event";
import styles from "./eventFilter.module.scss";
@@ -7,9 +7,9 @@ export const EventFilter = ({
setCategory,
activeCategory,
}: {
- eventCategories: EventCategoryFragment[];
- setCategory: (slug: string) => void;
- activeCategory?: string;
+ eventCategories: EventCategory[];
+ setCategory: (slug: string | null) => void;
+ activeCategory: string | null;
}) => {
return (
diff --git a/web/src/components/events/EventHeader.tsx b/web/src/components/events/EventHeader.tsx
index 1263a5c..d1ea306 100644
--- a/web/src/components/events/EventHeader.tsx
+++ b/web/src/components/events/EventHeader.tsx
@@ -16,11 +16,7 @@ export const EventHeader = ({ event }: { event: EventFragment }) => {
Medlemspris: {event.priceMember}
Kategorier:{" "}
- {event.categories &&
- event.categories
- .filter((x) => x != null)
- .map((x: EventCategoryFragment) => x.name)
- .join(", ")}
+ {event.categories && event.categories.map((x) => x.name).join(", ")}
diff --git a/web/src/gql/graphql.ts b/web/src/gql/graphql.ts
index 05bd40d..9597293 100644
--- a/web/src/gql/graphql.ts
+++ b/web/src/gql/graphql.ts
@@ -36,13 +36,12 @@ export type Scalars = {
UUID: { input: any; output: any; }
};
-export type AssociationIndex = PageInterface & {
- __typename?: 'AssociationIndex';
+export type Association = PageInterface & {
+ __typename?: 'Association';
aliasOf?: Maybe;
aliases: Array;
ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
+ association?: Maybe;
children: Array;
contentType: Scalars['String']['output'];
depth?: Maybe;
@@ -85,7 +84,7 @@ export type AssociationIndex = PageInterface & {
};
-export type AssociationIndexAncestorsArgs = {
+export type AssociationAncestorsArgs = {
id?: InputMaybe;
limit?: InputMaybe;
offset?: InputMaybe;
@@ -94,7 +93,7 @@ export type AssociationIndexAncestorsArgs = {
};
-export type AssociationIndexChildrenArgs = {
+export type AssociationChildrenArgs = {
id?: InputMaybe;
limit?: InputMaybe;
offset?: InputMaybe;
@@ -103,7 +102,7 @@ export type AssociationIndexChildrenArgs = {
};
-export type AssociationIndexDescendantsArgs = {
+export type AssociationDescendantsArgs = {
id?: InputMaybe;
limit?: InputMaybe;
offset?: InputMaybe;
@@ -112,7 +111,7 @@ export type AssociationIndexDescendantsArgs = {
};
-export type AssociationIndexNextSiblingsArgs = {
+export type AssociationNextSiblingsArgs = {
id?: InputMaybe;
limit?: InputMaybe;
offset?: InputMaybe;
@@ -121,7 +120,7 @@ export type AssociationIndexNextSiblingsArgs = {
};
-export type AssociationIndexPreviousSiblingsArgs = {
+export type AssociationPreviousSiblingsArgs = {
id?: InputMaybe;
limit?: InputMaybe;
offset?: InputMaybe;
@@ -130,109 +129,7 @@ export type AssociationIndexPreviousSiblingsArgs = {
};
-export type AssociationIndexSiblingsArgs = {
- id?: InputMaybe;
- limit?: InputMaybe;
- offset?: InputMaybe;
- order?: InputMaybe;
- searchQuery?: InputMaybe;
-};
-
-export type AssociationPage = PageInterface & {
- __typename?: 'AssociationPage';
- aliasOf?: Maybe;
- aliases: Array;
- ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
- children: Array;
- contentType: Scalars['String']['output'];
- depth?: Maybe;
- descendants: Array;
- draftTitle: Scalars['String']['output'];
- eventindex?: Maybe;
- eventpage?: Maybe;
- expireAt?: Maybe;
- expired: Scalars['Boolean']['output'];
- firstPublishedAt?: Maybe;
- genericpage?: Maybe;
- goLiveAt?: Maybe;
- hasUnpublishedChanges: Scalars['Boolean']['output'];
- homepage?: Maybe;
- id?: Maybe;
- lastPublishedAt?: Maybe;
- latestRevisionCreatedAt?: Maybe;
- live: Scalars['Boolean']['output'];
- locked?: Maybe;
- lockedAt?: Maybe;
- nextSiblings: Array;
- numchild: Scalars['Int']['output'];
- pageType?: Maybe;
- parent?: Maybe;
- path: Scalars['String']['output'];
- previousSiblings: Array;
- searchDescription?: Maybe;
- searchScore?: Maybe;
- seoTitle: Scalars['String']['output'];
- showInMenus: Scalars['Boolean']['output'];
- siblings: Array;
- sitesRootedHere: Array;
- slug: Scalars['String']['output'];
- title: Scalars['String']['output'];
- translationKey: Scalars['UUID']['output'];
- url?: Maybe;
- urlPath: Scalars['String']['output'];
- venueindex?: Maybe;
- venuepage?: Maybe;
-};
-
-
-export type AssociationPageAncestorsArgs = {
- id?: InputMaybe;
- limit?: InputMaybe;
- offset?: InputMaybe;
- order?: InputMaybe;
- searchQuery?: InputMaybe;
-};
-
-
-export type AssociationPageChildrenArgs = {
- id?: InputMaybe;
- limit?: InputMaybe;
- offset?: InputMaybe;
- order?: InputMaybe;
- searchQuery?: InputMaybe;
-};
-
-
-export type AssociationPageDescendantsArgs = {
- id?: InputMaybe;
- limit?: InputMaybe;
- offset?: InputMaybe;
- order?: InputMaybe;
- searchQuery?: InputMaybe;
-};
-
-
-export type AssociationPageNextSiblingsArgs = {
- id?: InputMaybe;
- limit?: InputMaybe;
- offset?: InputMaybe;
- order?: InputMaybe;
- searchQuery?: InputMaybe;
-};
-
-
-export type AssociationPagePreviousSiblingsArgs = {
- id?: InputMaybe;
- limit?: InputMaybe;
- offset?: InputMaybe;
- order?: InputMaybe;
- searchQuery?: InputMaybe;
-};
-
-
-export type AssociationPageSiblingsArgs = {
+export type AssociationSiblingsArgs = {
id?: InputMaybe;
limit?: InputMaybe;
offset?: InputMaybe;
@@ -382,9 +279,9 @@ export type EmbedBlock = StreamFieldInterface & {
export type EventCategory = {
__typename?: 'EventCategory';
id?: Maybe;
- name?: Maybe;
- showInFilters?: Maybe;
- slug?: Maybe;
+ name: Scalars['String']['output'];
+ showInFilters: Scalars['Boolean']['output'];
+ slug: Scalars['String']['output'];
};
export type EventIndex = PageInterface & {
@@ -392,8 +289,7 @@ export type EventIndex = PageInterface & {
aliasOf?: Maybe;
aliases: Array;
ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
+ association?: Maybe;
children: Array;
contentType: Scalars['String']['output'];
depth?: Maybe;
@@ -493,24 +389,18 @@ export type EventOccurrence = {
__typename?: 'EventOccurrence';
end?: Maybe;
id?: Maybe;
- start?: Maybe;
+ start: Scalars['String']['output'];
venue?: Maybe;
};
-export type EventOrganizer = {
- __typename?: 'EventOrganizer';
- id?: Maybe;
-};
-
export type EventPage = PageInterface & {
__typename?: 'EventPage';
aliasOf?: Maybe;
aliases: Array;
ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
+ association?: Maybe;
body?: Maybe>>;
- categories?: Maybe>>;
+ categories: Array;
children: Array;
contentType: Scalars['String']['output'];
depth?: Maybe;
@@ -535,8 +425,7 @@ export type EventPage = PageInterface & {
lockedAt?: Maybe;
nextSiblings: Array;
numchild: Scalars['Int']['output'];
- occurrences?: Maybe>>;
- organizers?: Maybe>>;
+ occurrences: Array;
pageType?: Maybe;
parent?: Maybe;
path: Scalars['String']['output'];
@@ -615,15 +504,6 @@ export type EventPageOccurrencesArgs = {
};
-export type EventPageOrganizersArgs = {
- id?: InputMaybe;
- limit?: InputMaybe;
- offset?: InputMaybe;
- order?: InputMaybe;
- searchQuery?: InputMaybe;
-};
-
-
export type EventPagePreviousSiblingsArgs = {
id?: InputMaybe;
limit?: InputMaybe;
@@ -655,8 +535,7 @@ export type GenericPage = PageInterface & {
aliasOf?: Maybe;
aliases: Array;
ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
+ association?: Maybe;
body?: Maybe>>;
children: Array;
contentType: Scalars['String']['output'];
@@ -758,8 +637,7 @@ export type HomePage = PageInterface & {
aliasOf?: Maybe;
aliases: Array;
ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
+ association?: Maybe;
children: Array;
contentType: Scalars['String']['output'];
depth?: Maybe;
@@ -954,8 +832,7 @@ export type Page = PageInterface & {
aliasOf?: Maybe;
aliases: Array;
ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
+ association?: Maybe;
children: Array;
contentType: Scalars['String']['output'];
depth?: Maybe;
@@ -1172,8 +1049,6 @@ export type Query = {
documents: Array;
eventCategories?: Maybe>>;
eventCategory?: Maybe;
- eventOrganizer?: Maybe;
- eventOrganizers?: Maybe>>;
image?: Maybe;
imageType: Scalars['String']['output'];
images: Array;
@@ -1225,20 +1100,6 @@ export type QueryEventCategoryArgs = {
};
-export type QueryEventOrganizerArgs = {
- id?: InputMaybe;
-};
-
-
-export type QueryEventOrganizersArgs = {
- id?: InputMaybe;
- limit?: InputMaybe;
- offset?: InputMaybe;
- order?: InputMaybe;
- searchQuery?: InputMaybe;
-};
-
-
export type QueryImageArgs = {
id?: InputMaybe;
};
@@ -1348,7 +1209,7 @@ export type RichTextBlock = StreamFieldInterface & {
value: Scalars['String']['output'];
};
-export type Search = AssociationIndex | AssociationPage | EventCategory | EventIndex | EventOccurrence | EventOrganizer | EventPage | GenericPage | HomePage | Page | VenueIndex | VenuePage;
+export type Search = Association | EventCategory | EventIndex | EventOccurrence | EventPage | GenericPage | HomePage | Page | VenueIndex | VenuePage;
export type SiteObjectType = {
__typename?: 'SiteObjectType';
@@ -1470,8 +1331,7 @@ export type VenueIndex = PageInterface & {
aliasOf?: Maybe;
aliases: Array;
ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
+ association?: Maybe;
children: Array;
contentType: Scalars['String']['output'];
depth?: Maybe;
@@ -1572,8 +1432,7 @@ export type VenuePage = PageInterface & {
aliasOf?: Maybe;
aliases: Array;
ancestors: Array;
- associationindex?: Maybe;
- associationpage?: Maybe;
+ association?: Maybe;
body?: Maybe>>;
capabilityAudio?: Maybe;
capabilityAudioVideo?: Maybe;
@@ -1686,14 +1545,14 @@ export type GenericFragment = { __typename: 'GenericPage', id?: string | null, u
export type AllGenericSlugsQueryVariables = Exact<{ [key: string]: never; }>;
-export type AllGenericSlugsQuery = { __typename?: 'Query', pages: Array<{ __typename?: 'AssociationIndex', id?: string | null, urlPath: string } | { __typename?: 'AssociationPage', id?: string | null, urlPath: string } | { __typename?: 'EventIndex', id?: string | null, urlPath: string } | { __typename?: 'EventPage', id?: string | null, urlPath: string } | { __typename?: 'GenericPage', id?: string | null, urlPath: string } | { __typename?: 'HomePage', id?: string | null, urlPath: string } | { __typename?: 'Page', id?: string | null, urlPath: string } | { __typename?: 'VenueIndex', id?: string | null, urlPath: string } | { __typename?: 'VenuePage', id?: string | null, urlPath: string }> };
+export type AllGenericSlugsQuery = { __typename?: 'Query', pages: Array<{ __typename?: 'Association', id?: string | null, urlPath: string } | { __typename?: 'EventIndex', id?: string | null, urlPath: string } | { __typename?: 'EventPage', id?: string | null, urlPath: string } | { __typename?: 'GenericPage', id?: string | null, urlPath: string } | { __typename?: 'HomePage', id?: string | null, urlPath: string } | { __typename?: 'Page', id?: string | null, urlPath: string } | { __typename?: 'VenueIndex', id?: string | null, urlPath: string } | { __typename?: 'VenuePage', id?: string | null, urlPath: string }> };
export type GenericPageByUrlQueryVariables = Exact<{
urlPath: Scalars['String']['input'];
}>;
-export type GenericPageByUrlQuery = { __typename?: 'Query', page?: { __typename?: 'AssociationIndex' } | { __typename?: 'AssociationPage' } | { __typename?: 'EventIndex' } | { __typename?: 'EventPage' } | (
+export type GenericPageByUrlQuery = { __typename?: 'Query', page?: { __typename?: 'Association' } | { __typename?: 'EventIndex' } | { __typename?: 'EventPage' } | (
{ __typename?: 'GenericPage' }
& { ' $fragmentRefs'?: { 'GenericFragment': GenericFragment } }
) | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | { __typename?: 'VenuePage' } | null };
@@ -1701,14 +1560,14 @@ export type GenericPageByUrlQuery = { __typename?: 'Query', page?: { __typename?
export type AllEventSlugsQueryVariables = Exact<{ [key: string]: never; }>;
-export type AllEventSlugsQuery = { __typename?: 'Query', pages: Array<{ __typename?: 'AssociationIndex', id?: string | null, slug: string } | { __typename?: 'AssociationPage', id?: string | null, slug: string } | { __typename?: 'EventIndex', id?: string | null, slug: string } | { __typename?: 'EventPage', id?: string | null, slug: string } | { __typename?: 'GenericPage', id?: string | null, slug: string } | { __typename?: 'HomePage', id?: string | null, slug: string } | { __typename?: 'Page', id?: string | null, slug: string } | { __typename?: 'VenueIndex', id?: string | null, slug: string } | { __typename?: 'VenuePage', id?: string | null, slug: string }> };
+export type AllEventSlugsQuery = { __typename?: 'Query', pages: Array<{ __typename?: 'Association', id?: string | null, slug: string } | { __typename?: 'EventIndex', id?: string | null, slug: string } | { __typename?: 'EventPage', id?: string | null, slug: string } | { __typename?: 'GenericPage', id?: string | null, slug: string } | { __typename?: 'HomePage', id?: string | null, slug: string } | { __typename?: 'Page', id?: string | null, slug: string } | { __typename?: 'VenueIndex', id?: string | null, slug: string } | { __typename?: 'VenuePage', id?: string | null, slug: string }> };
export type EventBySlugQueryVariables = Exact<{
slug: Scalars['String']['input'];
}>;
-export type EventBySlugQuery = { __typename?: 'Query', event?: { __typename?: 'AssociationIndex' } | { __typename?: 'AssociationPage' } | { __typename?: 'EventIndex' } | (
+export type EventBySlugQuery = { __typename?: 'Query', event?: { __typename?: 'Association' } | { __typename?: 'EventIndex' } | (
{ __typename?: 'EventPage' }
& { ' $fragmentRefs'?: { 'EventFragment': EventFragment } }
) | { __typename?: 'GenericPage' } | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | { __typename?: 'VenuePage' } | null };
@@ -1716,14 +1575,14 @@ export type EventBySlugQuery = { __typename?: 'Query', event?: { __typename?: 'A
export type AllVenueSlugsQueryVariables = Exact<{ [key: string]: never; }>;
-export type AllVenueSlugsQuery = { __typename?: 'Query', pages: Array<{ __typename?: 'AssociationIndex', id?: string | null, slug: string } | { __typename?: 'AssociationPage', id?: string | null, slug: string } | { __typename?: 'EventIndex', id?: string | null, slug: string } | { __typename?: 'EventPage', id?: string | null, slug: string } | { __typename?: 'GenericPage', id?: string | null, slug: string } | { __typename?: 'HomePage', id?: string | null, slug: string } | { __typename?: 'Page', id?: string | null, slug: string } | { __typename?: 'VenueIndex', id?: string | null, slug: string } | { __typename?: 'VenuePage', id?: string | null, slug: string }> };
+export type AllVenueSlugsQuery = { __typename?: 'Query', pages: Array<{ __typename?: 'Association', id?: string | null, slug: string } | { __typename?: 'EventIndex', id?: string | null, slug: string } | { __typename?: 'EventPage', id?: string | null, slug: string } | { __typename?: 'GenericPage', id?: string | null, slug: string } | { __typename?: 'HomePage', id?: string | null, slug: string } | { __typename?: 'Page', id?: string | null, slug: string } | { __typename?: 'VenueIndex', id?: string | null, slug: string } | { __typename?: 'VenuePage', id?: string | null, slug: string }> };
export type VenueBySlugQueryVariables = Exact<{
slug: Scalars['String']['input'];
}>;
-export type VenueBySlugQuery = { __typename?: 'Query', venue?: { __typename?: 'AssociationIndex' } | { __typename?: 'AssociationPage' } | { __typename?: 'EventIndex' } | { __typename?: 'EventPage' } | { __typename?: 'GenericPage' } | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | (
+export type VenueBySlugQuery = { __typename?: 'Query', venue?: { __typename?: 'Association' } | { __typename?: 'EventIndex' } | { __typename?: 'EventPage' } | { __typename?: 'GenericPage' } | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | (
{ __typename?: 'VenuePage' }
& { ' $fragmentRefs'?: { 'VenueFragment': VenueFragment } }
) | null };
@@ -1733,7 +1592,7 @@ export type VenueFragment = { __typename: 'VenuePage', id?: string | null, slug:
export type AllVenuesQueryVariables = Exact<{ [key: string]: never; }>;
-export type AllVenuesQuery = { __typename?: 'Query', venues: Array<{ __typename?: 'AssociationIndex' } | { __typename?: 'AssociationPage' } | { __typename?: 'EventIndex' } | { __typename?: 'EventPage' } | { __typename?: 'GenericPage' } | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | (
+export type AllVenuesQuery = { __typename?: 'Query', venues: Array<{ __typename?: 'Association' } | { __typename?: 'EventIndex' } | { __typename?: 'EventPage' } | { __typename?: 'GenericPage' } | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | (
{ __typename?: 'VenuePage' }
& { ' $fragmentRefs'?: { 'VenueFragment': VenueFragment } }
)> };
@@ -1741,20 +1600,20 @@ export type AllVenuesQuery = { __typename?: 'Query', venues: Array<{ __typename?
export type HomeQueryVariables = Exact<{ [key: string]: never; }>;
-export type HomeQuery = { __typename?: 'Query', events: Array<{ __typename?: 'AssociationIndex' } | { __typename?: 'AssociationPage' } | { __typename?: 'EventIndex' } | (
+export type HomeQuery = { __typename?: 'Query', events: Array<{ __typename?: 'Association' } | { __typename?: 'EventIndex' } | (
{ __typename?: 'EventPage' }
& { ' $fragmentRefs'?: { 'EventFragment': EventFragment } }
) | { __typename?: 'GenericPage' } | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | { __typename?: 'VenuePage' }> };
-export type EventFragment = { __typename: 'EventPage', id?: string | null, slug: string, title: string, facebookUrl?: string | null, ticketUrl?: string | null, priceRegular?: number | null, priceMember?: number | null, priceStudent?: number | null, body?: Array<{ __typename?: 'BlockQuoteBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'BooleanBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'CharBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'ChoiceBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'DateBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'DateTimeBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'DecimalBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'DocumentChooserBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'EmailBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'EmbedBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'FloatBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'ImageChooserBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'IntegerBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'ListBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'PageChooserBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'RawHTMLBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'RegexBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'RichTextBlock', rawValue: string, value: string, id?: string | null, blockType: string, field: string } | { __typename?: 'StaticBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'StreamBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'StreamFieldBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'StructBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'TextBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'TimeBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'URLBlock', id?: string | null, blockType: string, field: string } | null> | null, featuredImage?: { __typename?: 'ImageObjectType', url: string, width: number, height: number } | null, categories?: Array<{ __typename?: 'EventCategory', name?: string | null, slug?: string | null } | null> | null, occurrences?: Array<{ __typename: 'EventOccurrence', id?: string | null, start?: string | null, end?: string | null, venue?: { __typename: 'VenuePage', id?: string | null, slug: string, title: string } | null } | null> | null } & { ' $fragmentName'?: 'EventFragment' };
+export type EventFragment = { __typename: 'EventPage', id?: string | null, slug: string, title: string, facebookUrl?: string | null, ticketUrl?: string | null, priceRegular?: number | null, priceMember?: number | null, priceStudent?: number | null, body?: Array<{ __typename?: 'BlockQuoteBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'BooleanBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'CharBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'ChoiceBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'DateBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'DateTimeBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'DecimalBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'DocumentChooserBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'EmailBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'EmbedBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'FloatBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'ImageChooserBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'IntegerBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'ListBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'PageChooserBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'RawHTMLBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'RegexBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'RichTextBlock', rawValue: string, value: string, id?: string | null, blockType: string, field: string } | { __typename?: 'StaticBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'StreamBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'StreamFieldBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'StructBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'TextBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'TimeBlock', id?: string | null, blockType: string, field: string } | { __typename?: 'URLBlock', id?: string | null, blockType: string, field: string } | null> | null, featuredImage?: { __typename?: 'ImageObjectType', url: string, width: number, height: number } | null, categories: Array<{ __typename?: 'EventCategory', name: string, slug: string }>, occurrences: Array<{ __typename: 'EventOccurrence', id?: string | null, start: string, end?: string | null, venue?: { __typename: 'VenuePage', id?: string | null, slug: string, title: string } | null }> } & { ' $fragmentName'?: 'EventFragment' };
export type AllEventsQueryVariables = Exact<{ [key: string]: never; }>;
-export type AllEventsQuery = { __typename?: 'Query', events: Array<{ __typename?: 'AssociationIndex' } | { __typename?: 'AssociationPage' } | { __typename?: 'EventIndex' } | (
+export type AllEventsQuery = { __typename?: 'Query', events: Array<{ __typename?: 'Association' } | { __typename?: 'EventIndex' } | (
{ __typename?: 'EventPage' }
& { ' $fragmentRefs'?: { 'EventFragment': EventFragment } }
- ) | { __typename?: 'GenericPage' } | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | { __typename?: 'VenuePage' }>, eventCategories?: Array<{ __typename?: 'EventCategory', name?: string | null, slug?: string | null, showInFilters?: boolean | null } | null> | null };
+ ) | { __typename?: 'GenericPage' } | { __typename?: 'HomePage' } | { __typename?: 'Page' } | { __typename?: 'VenueIndex' } | { __typename?: 'VenuePage' }>, eventCategories?: Array<{ __typename?: 'EventCategory', name: string, slug: string, showInFilters: boolean } | null> | null };
export const GenericFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Generic"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GenericPage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"urlPath"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"body"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"blockType"}},{"kind":"Field","name":{"kind":"Name","value":"field"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RichTextBlock"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rawValue"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode;
export const VenueFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Venue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"VenuePage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"body"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"blockType"}},{"kind":"Field","name":{"kind":"Name","value":"field"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"RichTextBlock"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"rawValue"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"height"}}]}},{"kind":"Field","name":{"kind":"Name","value":"showAsBookable"}},{"kind":"Field","name":{"kind":"Name","value":"floor"}},{"kind":"Field","name":{"kind":"Name","value":"preposition"}},{"kind":"Field","name":{"kind":"Name","value":"capabilityAudio"}},{"kind":"Field","name":{"kind":"Name","value":"capabilityAudioVideo"}},{"kind":"Field","name":{"kind":"Name","value":"capabilityBar"}},{"kind":"Field","name":{"kind":"Name","value":"capabilityLighting"}},{"kind":"Field","name":{"kind":"Name","value":"capacityLegal"}},{"kind":"Field","name":{"kind":"Name","value":"capacityStanding"}},{"kind":"Field","name":{"kind":"Name","value":"capacitySitting"}}]}}]} as unknown as DocumentNode;
diff --git a/web/src/lib/event.ts b/web/src/lib/event.ts
index 0211e89..789707e 100644
--- a/web/src/lib/event.ts
+++ b/web/src/lib/event.ts
@@ -10,11 +10,7 @@ import {
} from "date-fns";
import { toLocalTime, formatDate } from "./date";
import { graphql } from "@/gql";
-import {
- EventFragment,
- EventCategory,
- EventOccurrence,
-} from "@/gql/graphql";
+import { EventFragment, EventCategory, EventOccurrence } from "@/gql/graphql";
export type {
EventFragment,
@@ -94,22 +90,14 @@ export const allEventsQuery = graphql(`
export function getSingularEvents(events: EventFragment[]) {
return events
.map((event) => {
- return event.occurrences
- ?.filter((x): x is EventOccurrence => isDefined(x))
- .map((occurrence) => {
- const eventOccurrence = structuredClone(event);
- eventOccurrence.occurrence = occurrence;
- return eventOccurrence;
- });
+ return event.occurrences.map((occurrence) => {
+ const eventOccurrence: any = structuredClone(event);
+ eventOccurrence.occurrence = occurrence;
+ return eventOccurrence;
+ });
})
- .flat()
- .filter((x): x is SingularEvent => isDefined(x));
+ .flat();
}
-
-function isDefined(val: T | undefined | null): val is T {
- return val !== undefined && val !== null;
-}
-
interface EventsByDate {
[yearMonth: string]: {
[week: string]: {