Skip to content

Commit 37e3203

Browse files
committed
feat: fill outlines from s34
1 parent b2eff91 commit 37e3203

File tree

14 files changed

+727
-10
lines changed

14 files changed

+727
-10
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cSpell.words": ["xored"]
3+
}

app/components/OutlineForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<UInput v-model="state.updated" class="w-full" />
2424
</UFormField>
2525
<UFormField
26-
v-if="outline.notes"
26+
v-if="outline.notes || state.notes"
2727
name="notes"
2828
label="Opmerking"
2929
:description="outline.notes"

app/pages/import.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
accept="application/json"
2121
:disabled="originalFiles.length > 0"
2222
label="Importeer vanuit lokale bestanden"
23+
@change="loadFiles(originalFiles, 'original')"
2324
/>
2425
<ImportForm v-model="originals" no-nwp />
2526
</UPageCard>
@@ -34,6 +35,7 @@
3435
accept="application/json"
3536
:disabled="translationFiles.length > 0"
3637
label="Importeer vanuit lokale bestanden"
38+
@change="loadFiles(translationFiles, 'translation')"
3739
/>
3840
<ImportForm v-model="translations" />
3941
</UPageCard>
@@ -105,14 +107,6 @@ const { showError } = useFlash();
105107
const originalFiles = ref<File[]>([]);
106108
const translationFiles = ref<File[]>([]);
107109
108-
watch(originalFiles, (val) => {
109-
loadFiles(val, "original");
110-
});
111-
112-
watch(translationFiles, (val) => {
113-
loadFiles(val, "translation");
114-
});
115-
116110
const supportedFiles = [
117111
"Literature.json",
118112
"Outlines.json",

app/pages/translate/outlines/index.vue

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
/>
88

99
<UPageBody>
10+
<UFileUpload
11+
v-model="jwpubFile"
12+
:file-delete="false"
13+
accept=".jwpub,.JWPUB"
14+
class="w-full min-h-48"
15+
:disabled="!!jwpubFile"
16+
label="Importeer vanuit S-34 formulier."
17+
@change="importOutlines"
18+
/>
1019
<template v-if="loading">
1120
<UPageGrid>
1221
<div v-for="i in 12" :key="i" class="grid gap-2">
@@ -33,6 +42,39 @@
3342
const translationStore = useTranslationStore();
3443
3544
const loading = ref(false);
45+
const jwpubFile = ref<File | null>(null);
46+
47+
const { showError } = useFlash();
48+
49+
const importOutlines = async () => {
50+
if (!jwpubFile.value) return;
51+
52+
loading.value = true;
53+
try {
54+
const body = new FormData();
55+
body.append("file", jwpubFile.value);
56+
const parsedOutlines = await $fetch<Outline[]>("/api/outlines", {
57+
body,
58+
method: "POST",
59+
});
60+
61+
const outlines =
62+
translationStore.outlines.translations?.map((outline) => ({
63+
...outline,
64+
...(parsedOutlines.find((o) => o.number === outline.number) ?? {}),
65+
})) ?? [];
66+
67+
translationStore.setTranslations({ outlines }, "outlines");
68+
} catch {
69+
showError({
70+
description:
71+
"Er is een fout opgetreden bij het importeren van de lezingen.",
72+
id: "import-outlines-error",
73+
});
74+
}
75+
loading.value = false;
76+
jwpubFile.value = null;
77+
};
3678
3779
const title = "Lezingen";
3880
const description = "Vertaal op deze pagina de lezingen.";

nuxt.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export default defineNuxtConfig({
1111
"@nuxt/test-utils",
1212
],
1313
css: ["~/assets/css/main.css"],
14+
runtimeConfig: {
15+
jwpubKey: process.env.JWPUB_KEY,
16+
},
1417
compatibilityDate: "2026-01-15",
1518
piniaPluginPersistedstate: {
1619
storage: "localStorage",

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"prepare:husky": "node .husky/install.mjs",
88
"prepare:nuxt": "nuxt prepare",
99
"dev": "nuxt dev",
10-
"build": "nuxt generate",
10+
"build": "nuxt build",
1111
"preview": "nuxt preview",
1212
"lint": "eslint .",
1313
"lint:fix": "eslint --fix .",
@@ -29,9 +29,13 @@
2929
"@pinia/nuxt": "^0.11.3",
3030
"@vueuse/nuxt": "^14.2.0",
3131
"@vueuse/router": "^14.2.0",
32+
"jszip": "^3.10.1",
33+
"node-html-parser": "^7.0.2",
3234
"nuxt": "^4.3.0",
35+
"pako": "^2.1.0",
3336
"pinia": "^3.0.4",
3437
"pinia-plugin-persistedstate": "^4.7.1",
38+
"sql.js": "^1.13.0",
3539
"tailwindcss": "^4.1.18",
3640
"v-code-diff": "^1.13.1",
3741
"zod": "^4.3.6"
@@ -42,6 +46,8 @@
4246
"@playwright/test": "^1.58.1",
4347
"@types/eslint-plugin-security": "^3.0.1",
4448
"@types/node": "^22.19.7",
49+
"@types/pako": "^2.0.4",
50+
"@types/sql.js": "^1.4.9",
4551
"@vitest/coverage-v8": "^3.2.4",
4652
"@vitest/eslint-plugin": "^1.6.6",
4753
"@vue/test-utils": "^2.4.6",

0 commit comments

Comments
 (0)