Added discord url to error messages and 500 page

This commit is contained in:
DrMint 2024-07-11 20:36:39 +02:00
parent 585ce20cd1
commit 804cd4cbb2
15 changed files with 28 additions and 68 deletions

View File

@ -7,7 +7,7 @@ interface Props {
} }
const { withLinks } = Astro.props; const { withLinks } = Astro.props;
const { t } = await getI18n(Astro.locals.currentLocale); const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
const discordLabel = `${t("footer.socials.discord.title")} - ${t( const discordLabel = `${t("footer.socials.discord.title")} - ${t(
"footer.socials.discord.subtitle" "footer.socials.discord.subtitle"
@ -30,7 +30,7 @@ const contactLabel = `${t("footer.socials.contact.title")} - ${t(
{ {
withLinks && ( withLinks && (
<div id="socials" class="when-no-print"> <div id="socials" class="when-no-print">
<a href="/discord" class="pressable-label" aria-label={discordLabel} title={discordLabel}> <a href={getLocalizedUrl("/discord")} class="pressable-label" aria-label={discordLabel} title={discordLabel}>
<Icon name="discord-brands" /> <Icon name="discord-brands" />
<p class="font-s">{t("footer.socials.discord.title")}</p> <p class="font-s">{t("footer.socials.discord.title")}</p>
</a> </a>

View File

@ -67,12 +67,7 @@ const { getLocalizedMatch, getLocalizedUrl, formatNumber } = await getI18n(
); );
default: default:
return ( return <ErrorMessage title={`Unknown attribute type: ${type}`} />;
<ErrorMessage
title={`Unknown attribute type: ${type}`}
description="Please contact website technical administrator."
/>
);
} }
}) })
} }

View File

@ -25,9 +25,6 @@ const { block, lang } = Astro.props;
) : isBlockCueBlock(block) ? ( ) : isBlockCueBlock(block) ? (
<CueBlock block={block} lang={lang} /> <CueBlock block={block} lang={lang} />
) : ( ) : (
<ErrorMessage <ErrorMessage title={`Unknown block type: ${block.blockType}`} />
title={`Unknown block type: ${block.blockType}`}
description="Please contact website technical administrator."
/>
) )
} }

View File

@ -1,11 +1,14 @@
--- ---
import { Icon } from "astro-icon/components"; import { Icon } from "astro-icon/components";
import { getI18n } from "src/i18n/i18n";
interface Props { interface Props {
title: string; title: string;
description?: string; description?: string;
} }
const { getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
const { title, description } = Astro.props; const { title, description } = Astro.props;
--- ---
@ -14,7 +17,15 @@ const { title, description } = Astro.props;
<div class="error-message"> <div class="error-message">
<Icon name="material-symbols:error-outline" width={32} height={32} /> <Icon name="material-symbols:error-outline" width={32} height={32} />
<p class="font-xl">{title}</p> <p class="font-xl">{title}</p>
{description && <p>{description}</p>} {
description ? (
<p>{description}</p>
) : (
<p>
Please contact <a href={getLocalizedUrl("/discord")} target="_blank">website technical administrator</a>.
</p>
)
}
</div> </div>
{/* ------------------------------------------- CSS -------------------------------------------- */} {/* ------------------------------------------- CSS -------------------------------------------- */}

View File

@ -67,12 +67,7 @@ const { getLocalizedMatch, getLocalizedUrl, formatNumber } = await getI18n(
); );
default: default:
return ( return <ErrorMessage title={`Unknown attribute type: ${type}`} />;
<ErrorMessage
title={`Unknown attribute type: ${type}`}
description="Please contact website technical administrator."
/>
);
} }
}) })
} }

View File

@ -29,9 +29,6 @@ const { node, context } = Astro.props;
) : isBlockNodeBreakBlock(node) ? ( ) : isBlockNodeBreakBlock(node) ? (
<RTBreak node={node} context={context} /> <RTBreak node={node} context={context} />
) : ( ) : (
<ErrorMessage <ErrorMessage title={`Unknown block type: ${node.fields.blockType}`} />
title={`Unknown block type: ${node.fields.blockType}`}
description="Please contact website technical administrator."
/>
) )
} }

View File

@ -29,10 +29,7 @@ const { node } = Astro.props;
) : node.fields.type === BreakBlockType.solidLine ? ( ) : node.fields.type === BreakBlockType.solidLine ? (
<hr id={node.anchorHash} class="solid" /> <hr id={node.anchorHash} class="solid" />
) : ( ) : (
<ErrorMessage <ErrorMessage title={`Unknown break block type: ${node.fields.type}`} />
title={`Unknown break block type: ${node.fields.type}`}
description="Please contact website technical administrator."
/>
) )
} }

View File

@ -34,9 +34,6 @@ const { node, context } = Astro.props;
))} ))}
</RTInternalLink> </RTInternalLink>
) : ( ) : (
<ErrorMessage <ErrorMessage title={`Unknown link type: ${node.fields.linkType}`} />
title={`Unknown link type: ${node.fields.linkType}`}
description="Please contact website technical administrator."
/>
) )
} }

View File

@ -30,9 +30,6 @@ const { getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
<slot /> <slot />
</a> </a>
) : ( ) : (
<ErrorMessage <ErrorMessage title={`Unknown internal link: ${doc.relationTo}`} />
title={`Unknown internal link: ${doc.relationTo}`}
description="Please contact website technical administrator."
/>
) )
} }

View File

@ -40,9 +40,6 @@ const { node, context } = Astro.props;
))} ))}
</ul> </ul>
) : ( ) : (
<ErrorMessage <ErrorMessage title={`Unknown list link: ${node.listType}`} />
title={`Unknown list link: ${node.listType}`}
description="Please contact website technical administrator."
/>
) )
} }

View File

@ -49,9 +49,6 @@ const { node, context } = Astro.props;
) : isNodeUploadNode(node) ? ( ) : isNodeUploadNode(node) ? (
<RTUpload node={node} context={context} /> <RTUpload node={node} context={context} />
) : ( ) : (
<ErrorMessage <ErrorMessage title={`Unknown node type: ${node.type}`} />
title={`Unknown node type: ${node.type}`}
description="Please contact website technical administrator."
/>
) )
} }

View File

@ -29,9 +29,6 @@ const { node, context } = Astro.props;
) : isUploadNodeVideoNode(node) ? ( ) : isUploadNodeVideoNode(node) ? (
<RTVideo node={node} context={context} /> <RTVideo node={node} context={context} />
) : ( ) : (
<ErrorMessage <ErrorMessage title={`Unknown upload collection: ${node.relationTo}`} />
title={`Unknown upload collection: ${node.relationTo}`}
description="Please contact website technical administrator."
/>
) )
} }

View File

@ -19,7 +19,7 @@ const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
<div id="text-container"> <div id="text-container">
<h1 class="font-serif font-5xl">500</h1> <h1 class="font-serif font-5xl">500</h1>
<h2 class="font-3xl">Server Error</h2> <h2 class="font-3xl">Server Error</h2>
<p>Please contact website technical administrator.</p> <p>Please contact <a href={getLocalizedUrl("/discord")} target="_blank">website technical administrator</a>.</p>
<a href={getLocalizedUrl("/")}> <a href={getLocalizedUrl("/")}>
<Button icon="material-symbols:home" title={t("home.title")} /> <Button icon="material-symbols:home" title={t("home.title")} />
</a> </a>

View File

@ -67,16 +67,7 @@ const { title, language } = (() => {
<Card href={href} class="content_row-card"> <Card href={href} class="content_row-card">
<div id="title"> <div id="title">
{ {title ? <p lang={language}>{title}</p> : <ErrorMessage title="Unknown content type" />}
title ? (
<p lang={language}>{title}</p>
) : (
<ErrorMessage
title="Unknown content type"
description="Please contact website technical administrator."
/>
)
}
</div> </div>
<div id="dots"></div> <div id="dots"></div>
@ -94,10 +85,7 @@ const { title, language } = (() => {
content={getLocalizedMatch(range.translations).note} content={getLocalizedMatch(range.translations).note}
/> /* TODO: Provide lang */ /> /* TODO: Provide lang */
) : ( ) : (
<ErrorMessage <ErrorMessage title="Unknown range type" />
title="Unknown range type"
description="Please contact website technical administrator."
/>
)} )}
</> </>
) )

View File

@ -81,12 +81,7 @@ const { language, title, description } = getLocalizedMatch(translations);
return <FilePreview file={value} />; return <FilePreview file={value} />;
default: default:
return ( return <ErrorMessage title={`Unknown file type: ${relationTo}`} />;
<ErrorMessage
title={`Unknown file type: ${relationTo}`}
description="Please contact website technical administrator."
/>
);
} }
}) })
} }