feat(legal): add legal notice error handling

The legal notice view now shows an error box if the legal notice could
not be loaded.
This commit is contained in:
2026-08-05 20:47:02 +02:00
committed by Gitea
parent 21704a439b
commit 05e17d949b
5 changed files with 26 additions and 5 deletions
+10 -2
View File
@@ -21,9 +21,14 @@ import { useI18n } from 'vue-i18n';
const { t } = useI18n(); const { t } = useI18n();
const legalNoticeError = ref(null);
const legalNoticeHtml = ref(null); const legalNoticeHtml = ref(null);
onMounted(async () => { onMounted(async () => {
legalNoticeHtml.value = await getLegalNotice(); try {
legalNoticeHtml.value = await getLegalNotice();
} catch {
legalNoticeError.value = 'legal.notice.loadError';
}
}); });
</script> </script>
@@ -35,7 +40,10 @@ onMounted(async () => {
</h1> </h1>
</header> </header>
<main> <main>
<div class="legal-notice" v-html="legalNoticeHtml"></div> <div class="error" v-if="legalNoticeError">
{{ t(legalNoticeError) }}
</div>
<div class="legal-notice" v-html="legalNoticeHtml" v-else></div>
</main> </main>
</div> </div>
</template> </template>
+2 -1
View File
@@ -64,7 +64,8 @@
}, },
"legal": { "legal": {
"notice": { "notice": {
"title": "Impressum" "title": "Impressum",
"loadError": "Das Impressum konnte nicht geladen werden."
} }
} }
} }
+2 -1
View File
@@ -64,7 +64,8 @@
}, },
"legal": { "legal": {
"notice": { "notice": {
"title": "Legal Notice" "title": "Legal Notice",
"loadError": "The legal notice could not be loaded."
} }
} }
} }
+9 -1
View File
@@ -92,4 +92,12 @@ input {
/* Temporary until a custom tap highlight is implemented. */ /* Temporary until a custom tap highlight is implemented. */
* { * {
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
} }
.error {
background-color: var(--color-negative-bg);
border: 1px solid var(--color-negative-border);
padding: 1em 2em;
border-radius: 1.2em;
color: var(--white);
}
+3
View File
@@ -84,6 +84,9 @@ body {
--light-hover: var(--light-d-2); --light-hover: var(--light-d-2);
--invert: invert(0); --invert: invert(0);
--color-negative-bg: oklch(59% 0.22706 29.244);
--color-negative-border: oklch(51% 0.22706 29.244);
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {