diff --git a/frontend/src/store/moduleStore.ts b/frontend/src/store/moduleStore.ts
index 0324000..70a037d 100644
--- a/frontend/src/store/moduleStore.ts
+++ b/frontend/src/store/moduleStore.ts
@@ -25,6 +25,9 @@ const moduleStore = defineStore("moduleStore", {
this.modules.set(module.uuid, module);
});
},
+ countModules(): number {
+ return this.modules.size;
+ },
getAllModules(): Module[] {
return Array.from(this.modules.values());
},
From ab25df81c187823401f321ba331582bbd03796a8 Mon Sep 17 00:00:00 2001
From: masterelmar <18119527+masterElmar@users.noreply.github.com>
Date: Mon, 20 Nov 2023 11:50:46 +0100
Subject: [PATCH 03/10] fix:#15 linted format and typ fix
---
frontend/src/components/CalendarPreview.vue | 20 +-
frontend/src/components/FaqPage.vue | 211 ++++++++++++------
frontend/src/components/ModuleInformation.vue | 37 ++-
frontend/src/components/ModuleSelection.vue | 2 +-
.../src/components/ModuleTemplateDialog.vue | 4 +-
frontend/src/components/RenameModules.vue | 3 +-
.../components/editCalendar/EditModules.vue | 3 +-
frontend/src/i18n/translations/de.json | 14 +-
frontend/src/store/moduleStore.ts | 6 +-
frontend/src/view/AdditionalModules.vue | 36 +--
frontend/src/view/EditCalendarView.vue | 16 +-
frontend/src/view/ImprintPage.vue | 2 +-
frontend/src/view/PrivacyPolicy.vue | 2 +-
13 files changed, 219 insertions(+), 137 deletions(-)
diff --git a/frontend/src/components/CalendarPreview.vue b/frontend/src/components/CalendarPreview.vue
index b940042..a01afe7 100644
--- a/frontend/src/components/CalendarPreview.vue
+++ b/frontend/src/components/CalendarPreview.vue
@@ -1,4 +1,3 @@
-
+
-
{{$t('faqView.headline')}}
+ {{ $t("faqView.headline") }}
- {{$t('faqView.firstQuestion')}}
+ {{ $t("faqView.firstQuestion") }}
- {{$t('faqView.firstAnswer')}}
+ {{ $t("faqView.firstAnswer") }}
-
{{$t('faqView.secondQuestion')}}
+
{{ $t("faqView.secondQuestion") }}
- {{$t('faqView.secondAnswer')}}
+ {{ $t("faqView.secondAnswer") }}
-
{{$t('faqView.thirdQuestion')}}
+
{{ $t("faqView.thirdQuestion") }}
- - {{$t('faqView.thirdAnswer.google.first')}}
+ - {{ $t("faqView.thirdAnswer.google.first") }}
-
- {{$t('faqView.thirdAnswer.google.second')}}
+ {{ $t("faqView.thirdAnswer.google.second") }}
-
- {{$t('faqView.thirdAnswer.google.third')}}
+ {{ $t("faqView.thirdAnswer.google.third") }}
-
- {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2010.title')}}
+
+
+ {{
+ $t("faqView.thirdAnswer.microsoft_outlook.outlook_2010.title")
+ }}
+
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2010.first')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2010.second')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2010.third')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2010.fourth')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2010.fifth')}}
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2010.first",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2010.second",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2010.third",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2010.fourth",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2010.fifth",
+ )
+ }}
+
- {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2007.title')}}
+
+ {{
+ $t("faqView.thirdAnswer.microsoft_outlook.outlook_2007.title")
+ }}
+
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2007.first')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2007.second')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2007.third')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2007.fourth')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2007.fifth')}}
- - {{$t('faqView.thirdAnswer.microsoft_outlook.outlook_2007.sixth')}}
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2007.first",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2007.second",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2007.third",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2007.fourth",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2007.fifth",
+ )
+ }}
+
+ -
+ {{
+ $t(
+ "faqView.thirdAnswer.microsoft_outlook.outlook_2007.sixth",
+ )
+ }}
+
- - {{$t('faqView.thirdAnswer.apple_osx.first')}}
- - {{$t('faqView.thirdAnswer.apple_osx.second')}}
- - {{$t('faqView.thirdAnswer.apple_osx.third')}}
- - {{$t('faqView.thirdAnswer.apple_osx.fourth')}}
+ - {{ $t("faqView.thirdAnswer.apple_osx.first") }}
+ - {{ $t("faqView.thirdAnswer.apple_osx.second") }}
+ - {{ $t("faqView.thirdAnswer.apple_osx.third") }}
+ - {{ $t("faqView.thirdAnswer.apple_osx.fourth") }}
- - {{ $t('faqView.thirdAnswer.thunderbird.one') }}
- - {{ $t('faqView.thirdAnswer.thunderbird.two') }}
- - {{ $t('faqView.thirdAnswer.thunderbird.three') }}
- - {{ $t('faqView.thirdAnswer.thunderbird.four') }}
- - {{ $t('faqView.thirdAnswer.thunderbird.five') }}
- - {{ $t('faqView.thirdAnswer.thunderbird.six') }}
- - {{ $t('faqView.thirdAnswer.thunderbird.seven') }}
+ - {{ $t("faqView.thirdAnswer.thunderbird.one") }}
+ - {{ $t("faqView.thirdAnswer.thunderbird.two") }}
+ - {{ $t("faqView.thirdAnswer.thunderbird.three") }}
+ - {{ $t("faqView.thirdAnswer.thunderbird.four") }}
+ - {{ $t("faqView.thirdAnswer.thunderbird.five") }}
+ - {{ $t("faqView.thirdAnswer.thunderbird.six") }}
+ - {{ $t("faqView.thirdAnswer.thunderbird.seven") }}
- {{$t('faqView.thirdAnswer.iphone.description')}}
+ {{ $t("faqView.thirdAnswer.iphone.description") }}
- - {{$t('faqView.thirdAnswer.iphone.one')}}
- - {{$t('faqView.thirdAnswer.iphone.two')}}
- - {{$t('faqView.thirdAnswer.iphone.three')}}
- - {{$t('faqView.thirdAnswer.iphone.four')}}
- - {{$t('faqView.thirdAnswer.iphone.five')}}
- - {{$t('faqView.thirdAnswer.iphone.six')}}
- - {{$t('faqView.thirdAnswer.iphone.seven')}}
- - {{$t('faqView.thirdAnswer.iphone.eight')}}
- - {{$t('faqView.thirdAnswer.iphone.nine')}}
+ - {{ $t("faqView.thirdAnswer.iphone.one") }}
+ - {{ $t("faqView.thirdAnswer.iphone.two") }}
+ - {{ $t("faqView.thirdAnswer.iphone.three") }}
+ - {{ $t("faqView.thirdAnswer.iphone.four") }}
+ - {{ $t("faqView.thirdAnswer.iphone.five") }}
+ - {{ $t("faqView.thirdAnswer.iphone.six") }}
+ - {{ $t("faqView.thirdAnswer.iphone.seven") }}
+ - {{ $t("faqView.thirdAnswer.iphone.eight") }}
+ - {{ $t("faqView.thirdAnswer.iphone.nine") }}
- {{$t('faqView.thirdAnswer.android.description')}}
+ {{ $t("faqView.thirdAnswer.android.description") }}
- {{$t('faqView.thirdAnswer.windows_phone.description')}}
+ {{ $t("faqView.thirdAnswer.windows_phone.description") }}
- - {{$t('faqView.thirdAnswer.windows_phone.one')}}
- - {{$t('faqView.thirdAnswer.windows_phone.two')}}
- - {{$t('faqView.thirdAnswer.windows_phone.three')}}
- - {{$t('faqView.thirdAnswer.windows_phone.four')}}
- - {{$t('faqView.thirdAnswer.windows_phone.five')}}
- - {{$t('faqView.thirdAnswer.windows_phone.six')}}
- - {{$t('faqView.thirdAnswer.windows_phone.seven')}}
- - {{$t('faqView.thirdAnswer.windows_phone.eight')}}
+ - {{ $t("faqView.thirdAnswer.windows_phone.one") }}
+ - {{ $t("faqView.thirdAnswer.windows_phone.two") }}
+ - {{ $t("faqView.thirdAnswer.windows_phone.three") }}
+ - {{ $t("faqView.thirdAnswer.windows_phone.four") }}
+ - {{ $t("faqView.thirdAnswer.windows_phone.five") }}
+ - {{ $t("faqView.thirdAnswer.windows_phone.six") }}
+ - {{ $t("faqView.thirdAnswer.windows_phone.seven") }}
+ - {{ $t("faqView.thirdAnswer.windows_phone.eight") }}
-
{{$t('faqView.fourthQuestion')}}
-
{{$t('faqView.fourthAnswer')}}
+
{{ $t("faqView.fourthQuestion") }}
+
{{ $t("faqView.fourthAnswer") }}
-
{{$t('faqView.fifthQuestion')}}
-
{{$t('faqView.fifthAnswer')}}
+
{{ $t("faqView.fifthQuestion") }}
+
{{ $t("faqView.fifthAnswer") }}
-
{{$t('faqView.sixthQuestion')}}
-
{{$t('faqView.sixthAnswer')}}
+
{{ $t("faqView.sixthQuestion") }}
+
{{ $t("faqView.sixthAnswer") }}
-
{{$t('faqView.seventhQuestion')}}
-
{{$t('faqView.seventhAnswer')}}
+
{{ $t("faqView.seventhQuestion") }}
+
{{ $t("faqView.seventhAnswer") }}
-
{{$t('faqView.eighthQuestion')}}
-
{{$t('faqView.eighthAnswer')}}
+
{{ $t("faqView.eighthQuestion") }}
+
{{ $t("faqView.eighthAnswer") }}
- {{$t('faqView.notFound')}}
- {{$t('faqView.contact')}}
+ {{ $t("faqView.notFound") }}
+ {{ $t("faqView.contact") }}
diff --git a/frontend/src/components/ModuleInformation.vue b/frontend/src/components/ModuleInformation.vue
index 893a917..902e6ec 100644
--- a/frontend/src/components/ModuleInformation.vue
+++ b/frontend/src/components/ModuleInformation.vue
@@ -1,7 +1,7 @@
-
+
+
diff --git a/frontend/src/components/CalendarPreview.vue b/frontend/src/components/CalendarPreview.vue
index a01afe7..eb0a671 100644
--- a/frontend/src/components/CalendarPreview.vue
+++ b/frontend/src/components/CalendarPreview.vue
@@ -45,8 +45,6 @@ window.addEventListener("resize", updateMobile);
position="bottomright"
@update:visible="dialogVisible = $event"
>
- Hier könnte Ihre Werbung stehen!
-
-import { defineAsyncComponent, ref, Ref } from "vue";
+import { defineAsyncComponent, ref, Ref, watch} from "vue";
import { Module } from "../model/module.ts";
import { fetchAllModules } from "../api/fetchCourse.ts";
import moduleStore from "../store/moduleStore.ts";
@@ -17,6 +17,11 @@ const fetchedModules = async () => {
};
const store = moduleStore();
+
+const selectedModules: Ref = ref(
+ store.getAllModules()
+);
+
const modules: Ref = ref([]);
const filters = ref({
course: {
@@ -41,13 +46,29 @@ fetchedModules().then(
(modules.value = data.map((module: Module) => {
return module;
})),
-);
+).finally(() => {
+ // init selected modules from store with fetched modules and set selected modules
+ selectedModules.value = store.getAllModules().filter((module: Module) => {
+ return modules.value.some((m: Module) => m.uuid === module.uuid);
+ });
+});
+
+watch(selectedModules, () => {
+ //add missing modules to store
+ selectedModules.value.forEach((module: Module) => {
+ if (!store.getAllModules().some((m: Module) => m.uuid === module.uuid)) {
+ store.addModule(module);
+ }
+ });
+ //remove modules from store that are not selected anymore
+ store.getAllModules().forEach((module: Module) => {
+ if (!selectedModules.value.some((m: Module) => m.uuid === module.uuid)) {
+ store.removeModule(module);
+ }
+ });
+});
async function nextStep() {
- //selectedModules.value.forEach((module: Module) => {
- // moduleStore().addModule(module);
- //});
-
await router.push("/rename-modules");
}
@@ -75,59 +96,6 @@ async function showInfo(module: Module) {
},
});
}
-
-/*
-const display = (module: Module) => module.name + " (" + module.course + ")";
-
-const selectAll = ref(false);
-
-const onSelectAllChange = (event: MultiSelectAllChangeEvent) => {
- if (event.checked) {
- additionalModules.value = new Map(
- modules.value
- .filter((module: Module) => !store.hasModule(module))
- .map((module: Module) => [module.uuid, module]),
- );
- store.overwriteModules(modules.value);
- } else {
- store.overwriteModules(
- store.getAllModules().filter(
- (module: Module) => !additionalModules.value.has(module.uuid)
- )
- );
- additionalModules.value.clear();
- }
-
- selectAll.value = event.checked;
-};
-
-function selectChange(event : MultiSelectChangeEvent) {
- let wasSelected: boolean = additionalModules.value.has(event.value.uuid);
-
- if (event.originalEvent.target.) {
- additionalModules.value.set(event.value.uuid, event.value);
- } else {
- additionalModules.value.delete(event.value.uuid);
- }
- selectAll.value = store.countModules() === modules.value.length;
-}
-
-function itemsLabel(selectedModules: Module[]): string {
- return (selectedModules ? selectedModules.length : 0) != 1
- ? t("additionalModules.modules")
- : t("additionalModules.module");
-}
-
-function itemsLabelWithNumber(selectedModules: Module[]): string {
- return (
- selectedModules.length.toString() +
- " " +
- itemsLabel(selectedModules) +
- " " +
- t("additionalModules.dropDownFooterSelected")
- );
-}
-*/
@@ -141,6 +109,7 @@ function itemsLabelWithNumber(selectedModules: Module[]): string {
-
+
+
-
-
+