Skip to content

Commit e6a76be

Browse files
committed
fix: detect empty import
1 parent 30c1af3 commit e6a76be

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

app/components/UIChanges.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ const remoteTranslations = computed(() => {
4646
4747
const translations = computed(() => {
4848
return JSON.stringify(
49-
props.type === "NWS" ? uiStore.translations : uiStore.nwpTranslations,
49+
props.type === "NWS"
50+
? uiStore.translations
51+
: (uiStore.nwpTranslations ?? {}),
5052
null,
5153
2,
5254
);

app/pages/translate/index.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
<UPageHeader :title="title" :description="description" />
44

55
<UPageBody>
6+
<UAlert
7+
v-if="cards.every((card) => card.description === '0 records.')"
8+
color="warning"
9+
variant="subtle"
10+
title="Geen teksten gevonden"
11+
:actions="[
12+
{ label: 'Ga naar Importeren', variant: 'link', to: '/import' },
13+
]"
14+
description="Importeer eerst teksten vanuit Google Docs of een .json-bestand om te kunnen vertalen."
15+
/>
616
<UPageGrid>
717
<UPageCard v-for="(card, index) in cards" :key="index" v-bind="card" />
818
</UPageGrid>
@@ -29,25 +39,25 @@ const cards = computed((): PageCardProps[] => {
2939
to: "/translate/nwp",
3040
},
3141
{
32-
description: `${translationStore.originals.literature?.length} records.`,
42+
description: `${translationStore.originals.literature?.length ?? 0} records.`,
3343
icon: "i-lucide:book-open",
3444
title: "Lectuur",
3545
to: "/translate/literature",
3646
},
3747
{
38-
description: `${translationStore.originals.outlines?.length} records.`,
48+
description: `${translationStore.originals.outlines?.length ?? 0} records.`,
3949
icon: "i-lucide:file-text",
4050
title: "Lezingen",
4151
to: "/translate/outlines",
4252
},
4353
{
44-
description: `${translationStore.originals.songs?.length} records.`,
54+
description: `${translationStore.originals.songs?.length ?? 0} records.`,
4555
icon: "i-lucide:music",
4656
title: "Liederen",
4757
to: "/translate/songs",
4858
},
4959
{
50-
description: `${translationStore.originals.tips?.length} records.`,
60+
description: `${translationStore.originals.tips?.length ?? 0} records.`,
5161
icon: "i-lucide:lightbulb",
5262
title: "Tips",
5363
to: "/translate/tips",

0 commit comments

Comments
 (0)