Tested deployment

This commit is contained in:
DrMint 2022-02-24 13:25:43 +01:00
parent d1ca0c1d7e
commit 0bc2a5ab0f
5 changed files with 21 additions and 10 deletions

1
run_accords_build.sh Executable file
View File

@ -0,0 +1 @@
npx next build

1
run_accords_prod.sh Executable file
View File

@ -0,0 +1 @@
npx next start -p 12500

View File

@ -70,7 +70,11 @@ export default function ContentIndex(props: ContentIndexProps): JSX.Element {
navTitle="Contents" navTitle="Contents"
title={ title={
content.titles.length > 0 content.titles.length > 0
? prettyinlineTitle(content.titles[0].pre_title, content.titles[0].title, content.titles[0].subtitle) ? prettyinlineTitle(
content.titles[0].pre_title,
content.titles[0].title,
content.titles[0].subtitle
)
: prettySlug(content.slug) : prettySlug(content.slug)
} }
thumbnail={content.thumbnail.data.attributes} thumbnail={content.thumbnail.data.attributes}

View File

@ -30,12 +30,15 @@ export function prettyPrice(
); );
} }
export function prettySlug(slug: string, parentSlug?: string): string { export function prettySlug(slug?: string, parentSlug?: string): string {
if (parentSlug && slug.startsWith(parentSlug)) if (slug) {
slug = slug.substring(parentSlug.length + 1); if (parentSlug && slug.startsWith(parentSlug))
slug = slug.replace(new RegExp("-", "g"), " "); slug = slug.substring(parentSlug.length + 1);
slug = slug.replace(new RegExp("_", "g"), " "); slug = slug.replace(new RegExp("-", "g"), " ");
return capitalizeString(slug); slug = slug.replace(new RegExp("_", "g"), " ");
return capitalizeString(slug);
}
return "";
} }
export function prettyinlineTitle( export function prettyinlineTitle(
@ -73,9 +76,11 @@ export function prettyItemType(
} }
} }
export function prettyItemSubType( export function prettyItemSubType(metadata: {
metadata: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["metadata"][number] __typename: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["metadata"][number]["__typename"];
): string { subtype?: any;
platform?: any;
}): string {
switch (metadata.__typename) { switch (metadata.__typename) {
case "ComponentMetadataAudio": case "ComponentMetadataAudio":
case "ComponentMetadataBooks": case "ComponentMetadataBooks":