add wordpress migration

This commit is contained in:
2024-08-09 01:56:00 +02:00
parent d1be264bc5
commit 1bb0fd252f
36 changed files with 1234 additions and 63 deletions

View File

@ -46,7 +46,7 @@ export default async function Page() {
...AssociationIndex
}
}
associations: pages(contentType: "associations.AssociationPage") {
associations: pages(contentType: "associations.AssociationPage", limit: 1000) {
... on AssociationPage {
...Association
}

View File

@ -32,6 +32,8 @@ const VenueFragmentDefinition = graphql(`
showAsBookable
floor
preposition
usedFor
techSpecsUrl
capabilityAudio
capabilityAudioVideo
capabilityBar
@ -50,7 +52,7 @@ export default async function Page() {
...VenueIndex
}
}
venues: pages(contentType: "venues.VenuePage") {
venues: pages(contentType: "venues.VenuePage", limit: 100) {
... on VenuePage {
...Venue
}

View File

@ -4,15 +4,19 @@ import { OrganizerList } from "./OrganizerList";
import Icon from "../general/Icon";
import { DateList } from "./DateList";
function formatPrice(price: number): string {
function formatPrice(price: number | string): string {
if (price === null) {
// should not happen
return "?";
}
if (price === 0) {
const asNumber = Number(price);
if (isNaN(asNumber)) {
return price;
}
if (asNumber === 0) {
return "Gratis";
}
return `${price} kr`;
return `${asNumber} kr`;
}
export const EventDetails = ({ event }: { event: EventFragment }) => {
@ -29,19 +33,19 @@ export const EventDetails = ({ event }: { event: EventFragment }) => {
<span>Gratis</span>
</li>
)}
{typeof event.priceRegular === "number" && (
{event.priceRegular && (
<li className={styles.priceItem}>
<span className={styles.priceLabel}>Ordinær</span>{" "}
{formatPrice(event.priceRegular)}
</li>
)}
{typeof event.priceStudent === "number" && (
{event.priceStudent && (
<li className={styles.priceItem}>
<span className={styles.priceLabel}>Student</span>{" "}
{formatPrice(event.priceStudent)}
</li>
)}
{typeof event.priceMember === "number" && (
{event.priceMember && (
<li className={styles.priceItem}>
<span className={styles.priceLabel}>Medlem</span>{" "}
{formatPrice(event.priceMember)}
@ -49,7 +53,7 @@ export const EventDetails = ({ event }: { event: EventFragment }) => {
)}
</ul>
</div>
{event.organizers && (
{event.organizers.length !== 0 && (
<div>
<div className="suphead">Arrangeres av</div>{" "}
<OrganizerList event={event} />

View File

@ -27,7 +27,7 @@ export const VenueInfo = ({ venue }: { venue: VenueFragment }) => {
</tr>
<tr>
<th>Bruk</th>
<td>TODO</td>
<td>{venue.usedFor}</td>
</tr>
<tr>
<th>Bar</th>
@ -47,10 +47,16 @@ export const VenueInfo = ({ venue }: { venue: VenueFragment }) => {
</tr>
</tbody>
</table>
<a href="#" target="_blank" className="button secondary">
<span>Tekniske spesifikasjoner</span>
<Icon type="doc" />
</a>
{venue.techSpecsUrl && (
<a
href={venue.techSpecsUrl}
target="_blank"
className="button secondary"
>
<span>Tekniske spesifikasjoner</span>
<Icon type="doc" />
</a>
)}
</div>
);
};

View File

@ -6,6 +6,17 @@ import { Image } from "@/components/general/Image";
export const VenueItem = ({ venue }: { venue: VenueFragment }) => {
const featuredImage: any = venue.featuredImage;
const { capacitySitting, capacityStanding, usedFor } = venue;
let capacity = null;
if (
!isNaN(capacitySitting) &&
capacitySitting &&
!isNaN(capacityStanding) &&
capacityStanding
) {
capacity = `${capacitySitting}${capacityStanding}`;
}
return (
<li className={`${styles.venueItem} linkItem`}>
<div className={styles.image}>
@ -21,13 +32,15 @@ export const VenueItem = ({ venue }: { venue: VenueFragment }) => {
</div>
<div className={styles.text}>
<h1 className={styles.title}>{venue.title}</h1>
<div className={styles.details}>
<strong>Passer for:</strong>
<ul>
<li>50115 personer</li>
<li>Konsert, foredrag, fest, debatt, teater, filmvisning</li>
</ul>
</div>
{(capacity || usedFor) && (
<div className={styles.details}>
<strong>Passer for:</strong>
<ul>
{capacity && <li>{capacity} personer</li>}
{usedFor && <li>{usedFor}</li>}
</ul>
</div>
)}
</div>
<Link href={`/lokaler/${venue.slug}`} className="hiddenLink">
Mer om lokalet {venue.title}

View File

@ -24,14 +24,14 @@ const documents = {
"\n query associationBySlug($slug: String!) {\n association: page(\n contentType: \"associations.AssociationPage\"\n slug: $slug\n ) {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n ": types.AssociationBySlugDocument,
"\n fragment AssociationIndex on AssociationIndex {\n ... on AssociationIndex {\n title\n lead\n body {\n ...Blocks\n }\n }\n }\n": types.AssociationIndexFragmentDoc,
"\n fragment Association on AssociationPage {\n __typename\n id\n slug\n title\n excerpt\n body {\n ...Blocks\n }\n logo {\n url\n width\n height\n }\n associationType\n websiteUrl\n }\n": types.AssociationFragmentDoc,
"\n query allAssociations {\n index: associationIndex {\n ... on AssociationIndex {\n ...AssociationIndex\n }\n }\n associations: pages(contentType: \"associations.AssociationPage\") {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n ": types.AllAssociationsDocument,
"\n query allAssociations {\n index: associationIndex {\n ... on AssociationIndex {\n ...AssociationIndex\n }\n }\n associations: pages(contentType: \"associations.AssociationPage\", limit: 1000) {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n ": types.AllAssociationsDocument,
"\n fragment ContactIndex on ContactIndex {\n ... on ContactIndex {\n title\n lead\n body {\n ...Blocks\n }\n }\n }\n": types.ContactIndexFragmentDoc,
"\n query contacts {\n contactIndex {\n ... on ContactIndex {\n ...ContactIndex\n }\n }\n }\n ": types.ContactsDocument,
"\n query allVenueSlugs {\n pages(contentType: \"venues.VenuePage\") {\n id\n slug\n }\n }\n ": types.AllVenueSlugsDocument,
"\n query venueBySlug($slug: String!) {\n venue: page(contentType: \"venues.VenuePage\", slug: $slug) {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n ": types.VenueBySlugDocument,
"\n fragment VenueIndex on VenueIndex {\n ... on VenueIndex {\n title\n lead\n body {\n ...Blocks\n }\n }\n }\n": types.VenueIndexFragmentDoc,
"\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n": types.VenueFragmentDoc,
"\n query venueIndex {\n index: venueIndex {\n ... on VenueIndex {\n ...VenueIndex\n }\n }\n venues: pages(contentType: \"venues.VenuePage\") {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n ": types.VenueIndexDocument,
"\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n": types.VenueFragmentDoc,
"\n query venueIndex {\n index: venueIndex {\n ... on VenueIndex {\n ...VenueIndex\n }\n }\n venues: pages(contentType: \"venues.VenuePage\", limit: 100) {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n ": types.VenueIndexDocument,
"\n fragment Home on HomePage {\n ... on HomePage {\n featuredEvents {\n id\n }\n }\n }\n": types.HomeFragmentDoc,
"\n query home {\n events: eventIndex {\n ... on EventIndex {\n futureEvents {\n ... on EventPage {\n ...Event\n }\n }\n }\n }\n home: page(contentType: \"home.HomePage\", urlPath: \"/home/\") {\n ... on HomePage {\n ...Home\n }\n }\n news: pages(contentType: \"news.newsPage\", order: \"-first_published_at\", limit: 4) {\n ... on NewsPage {\n ...News\n }\n }\n }\n ": types.HomeDocument,
"\n query search($query: String) {\n results: search(query: $query) {\n __typename\n ... on NewsPage {\n id\n title\n }\n ... on EventPage {\n id\n title\n }\n ... on GenericPage {\n id\n title\n }\n ... on VenuePage {\n id\n title\n }\n ... on AssociationPage {\n id\n title\n associationType\n }\n }\n }\n ": types.SearchDocument,
@ -45,7 +45,7 @@ const documents = {
"\n query futureEvents {\n events: eventIndex {\n ... on EventIndex {\n futureEvents {\n ... on EventPage {\n ...Event\n }\n }\n }\n }\n eventCategories: eventCategories {\n ... on EventCategory {\n name\n slug\n showInFilters\n }\n }\n eventOrganizers: eventOrganizers {\n ... on EventOrganizer {\n id\n name\n slug\n externalUrl\n association {\n ... on AssociationPage {\n url\n }\n }\n }\n }\n venues: pages(contentType: \"venues.VenuePage\") {\n ... on VenuePage {\n id\n title\n slug\n preposition\n }\n }\n }\n": types.FutureEventsDocument,
"\n fragment News on NewsPage {\n __typename\n id\n slug\n title\n firstPublishedAt\n excerpt\n lead\n featuredImage {\n ...Image\n }\n body {\n ...Blocks\n }\n }\n": types.NewsFragmentDoc,
"\n fragment NewsIndex on NewsIndex {\n __typename\n id\n slug\n title\n lead\n }\n": types.NewsIndexFragmentDoc,
"\n query news {\n index: newsIndex {\n ... on NewsIndex {\n ...NewsIndex\n }\n }\n news: pages(contentType: \"news.NewsPage\", order: \"-first_published_at\") {\n ... on NewsPage {\n ...News\n }\n }\n }\n": types.NewsDocument,
"\n query news {\n index: newsIndex {\n ... on NewsIndex {\n ...NewsIndex\n }\n }\n news: pages(contentType: \"news.NewsPage\", order: \"-first_published_at\", limit: 1000) {\n ... on NewsPage {\n ...News\n }\n }\n }\n": types.NewsDocument,
"\n query openingHoursSets {\n openingHoursSets {\n ...OpeningHoursSetFragment\n }\n }\n": types.OpeningHoursSetsDocument,
"\n fragment OpeningHoursSetFragment on OpeningHoursSet {\n name\n effectiveFrom\n effectiveTo\n announcement\n items {\n id\n function\n week {\n id\n blockType\n ... on OpeningHoursWeekBlock {\n ...OpeningHoursWeekBlock\n }\n }\n }\n }\n": types.OpeningHoursSetFragmentFragmentDoc,
"\n fragment OpeningHoursRangeBlock on OpeningHoursRangeBlock {\n timeFrom\n timeTo\n custom\n }\n": types.OpeningHoursRangeBlockFragmentDoc,
@ -113,7 +113,7 @@ export function graphql(source: "\n fragment Association on AssociationPage {\n
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query allAssociations {\n index: associationIndex {\n ... on AssociationIndex {\n ...AssociationIndex\n }\n }\n associations: pages(contentType: \"associations.AssociationPage\") {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n "): (typeof documents)["\n query allAssociations {\n index: associationIndex {\n ... on AssociationIndex {\n ...AssociationIndex\n }\n }\n associations: pages(contentType: \"associations.AssociationPage\") {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n "];
export function graphql(source: "\n query allAssociations {\n index: associationIndex {\n ... on AssociationIndex {\n ...AssociationIndex\n }\n }\n associations: pages(contentType: \"associations.AssociationPage\", limit: 1000) {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n "): (typeof documents)["\n query allAssociations {\n index: associationIndex {\n ... on AssociationIndex {\n ...AssociationIndex\n }\n }\n associations: pages(contentType: \"associations.AssociationPage\", limit: 1000) {\n ... on AssociationPage {\n ...Association\n }\n }\n }\n "];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@ -137,11 +137,11 @@ export function graphql(source: "\n fragment VenueIndex on VenueIndex {\n ..
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n"): (typeof documents)["\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n"];
export function graphql(source: "\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\n }\n"): (typeof documents)["\n fragment Venue on VenuePage {\n __typename\n id\n slug\n title\n body {\n ...Blocks\n }\n featuredImage {\n ...Image\n }\n showAsBookable\n floor\n preposition\n usedFor\n techSpecsUrl\n capabilityAudio\n capabilityAudioVideo\n capabilityBar\n capabilityLighting\n capacityLegal\n capacityStanding\n capacitySitting\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: "\n query venueIndex {\n index: venueIndex {\n ... on VenueIndex {\n ...VenueIndex\n }\n }\n venues: pages(contentType: \"venues.VenuePage\") {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n "): (typeof documents)["\n query venueIndex {\n index: venueIndex {\n ... on VenueIndex {\n ...VenueIndex\n }\n }\n venues: pages(contentType: \"venues.VenuePage\") {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n "];
export function graphql(source: "\n query venueIndex {\n index: venueIndex {\n ... on VenueIndex {\n ...VenueIndex\n }\n }\n venues: pages(contentType: \"venues.VenuePage\", limit: 100) {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n "): (typeof documents)["\n query venueIndex {\n index: venueIndex {\n ... on VenueIndex {\n ...VenueIndex\n }\n }\n venues: pages(contentType: \"venues.VenuePage\", limit: 100) {\n ... on VenuePage {\n ...Venue\n }\n }\n }\n "];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@ -197,7 +197,7 @@ export function graphql(source: "\n fragment NewsIndex on NewsIndex {\n __ty
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query news {\n index: newsIndex {\n ... on NewsIndex {\n ...NewsIndex\n }\n }\n news: pages(contentType: \"news.NewsPage\", order: \"-first_published_at\") {\n ... on NewsPage {\n ...News\n }\n }\n }\n"): (typeof documents)["\n query news {\n index: newsIndex {\n ... on NewsIndex {\n ...NewsIndex\n }\n }\n news: pages(contentType: \"news.NewsPage\", order: \"-first_published_at\") {\n ... on NewsPage {\n ...News\n }\n }\n }\n"];
export function graphql(source: "\n query news {\n index: newsIndex {\n ... on NewsIndex {\n ...NewsIndex\n }\n }\n news: pages(contentType: \"news.NewsPage\", order: \"-first_published_at\", limit: 1000) {\n ... on NewsPage {\n ...News\n }\n }\n }\n"): (typeof documents)["\n query news {\n index: newsIndex {\n ... on NewsIndex {\n ...NewsIndex\n }\n }\n news: pages(contentType: \"news.NewsPage\", order: \"-first_published_at\", limit: 1000) {\n ... on NewsPage {\n ...News\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,7 @@ export const newsQuery = graphql(`
...NewsIndex
}
}
news: pages(contentType: "news.NewsPage", order: "-first_published_at") {
news: pages(contentType: "news.NewsPage", order: "-first_published_at", limit: 1000) {
... on NewsPage {
...News
}