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 { t } = await getI18n(Astro.locals.currentLocale);
const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
const discordLabel = `${t("footer.socials.discord.title")} - ${t(
"footer.socials.discord.subtitle"
@ -30,7 +30,7 @@ const contactLabel = `${t("footer.socials.contact.title")} - ${t(
{
withLinks && (
<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" />
<p class="font-s">{t("footer.socials.discord.title")}</p>
</a>

View File

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

View File

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

View File

@ -1,11 +1,14 @@
---
import { Icon } from "astro-icon/components";
import { getI18n } from "src/i18n/i18n";
interface Props {
title: string;
description?: string;
}
const { getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
const { title, description } = Astro.props;
---
@ -14,7 +17,15 @@ const { title, description } = Astro.props;
<div class="error-message">
<Icon name="material-symbols:error-outline" width={32} height={32} />
<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>
{/* ------------------------------------------- CSS -------------------------------------------- */}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
<div id="text-container">
<h1 class="font-serif font-5xl">500</h1>
<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("/")}>
<Button icon="material-symbols:home" title={t("home.title")} />
</a>

View File

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

View File

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