@paris-ias/list 1.0.101 → 1.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/events/DateTimePlace.vue +1 -1
- package/dist/runtime/components/list/atoms/SearchInput.vue +1 -2
- package/dist/runtime/components/list/atoms/SortMenu.vue +3 -2
- package/dist/runtime/components/list/atoms/ViewMenu.vue +3 -2
- package/dist/runtime/components/list/inputs/AutoComplete.vue +3 -2
- package/dist/runtime/components/list/inputs/BooleanSwitch.vue +3 -2
- package/dist/runtime/components/list/inputs/Checkbox.vue +3 -2
- package/dist/runtime/components/list/inputs/Select.vue +7 -2
- package/dist/runtime/components/list/molecules/Filters.vue +4 -3
- package/dist/runtime/components/list/molecules/Header.vue +15 -4
- package/dist/runtime/components/list/molecules/Pagination.vue +3 -2
- package/dist/runtime/components/list/organisms/List.vue +9 -4
- package/dist/runtime/components/list/organisms/Slider.vue +3 -11
- package/dist/runtime/plugins/pinia.js +2 -14
- package/dist/runtime/public/filters.json +72 -0
- package/dist/runtime/stores/root.d.ts +9 -9
- package/dist/runtime/stores/root.js +91 -64
- package/dist/runtime/translations/fr.json +5 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
<script setup>
|
|
59
59
|
import { ref } from "vue";
|
|
60
60
|
import { getDetailedFormatedDate } from "../../composables/useUtils";
|
|
61
|
-
import { useI18n } from "
|
|
61
|
+
import { useI18n } from "#imports";
|
|
62
62
|
const { locale } = useI18n();
|
|
63
63
|
const props = defineProps({
|
|
64
64
|
item: {
|
|
@@ -71,8 +71,7 @@
|
|
|
71
71
|
<script setup>
|
|
72
72
|
import { useDebounceFn } from "@vueuse/core";
|
|
73
73
|
import { useRootStore } from "../../../stores/root";
|
|
74
|
-
import { useNuxtApp, computed } from "#imports";
|
|
75
|
-
import { useI18n } from "vue-i18n";
|
|
74
|
+
import { useNuxtApp, computed, useI18n } from "#imports";
|
|
76
75
|
const { locale, t } = useI18n();
|
|
77
76
|
const rootStore = useRootStore();
|
|
78
77
|
const { $stores } = useNuxtApp();
|
|
@@ -46,9 +46,10 @@
|
|
|
46
46
|
import { mergeProps } from "vue";
|
|
47
47
|
import { useDisplay } from "vuetify";
|
|
48
48
|
import { useRootStore } from "../../../stores/root";
|
|
49
|
-
import { useNuxtApp, computed, ref } from "#imports";
|
|
49
|
+
import { useNuxtApp, computed, ref, useI18n } from "#imports";
|
|
50
50
|
const { $stores } = useNuxtApp();
|
|
51
51
|
const { xs: isXsDisplay } = useDisplay();
|
|
52
|
+
const { locale } = useI18n();
|
|
52
53
|
const rootStore = useRootStore();
|
|
53
54
|
const props = defineProps({
|
|
54
55
|
type: {
|
|
@@ -74,6 +75,6 @@ const current = computed(() => {
|
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
77
|
const updateSort = async (value) => {
|
|
77
|
-
await rootStore.updateSort({ value, type: props.type });
|
|
78
|
+
await rootStore.updateSort({ value, type: props.type, lang: locale.value });
|
|
78
79
|
};
|
|
79
80
|
</script>
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
import { mergeProps, ref } from "vue";
|
|
44
44
|
import { useDisplay } from "vuetify";
|
|
45
45
|
import { useRootStore } from "../../../stores/root";
|
|
46
|
-
import { useNuxtApp } from "#imports";
|
|
46
|
+
import { useNuxtApp, ref, useI18n } from "#imports";
|
|
47
|
+
const { locale } = useI18n();
|
|
47
48
|
const { $stores } = useNuxtApp();
|
|
48
49
|
const props = defineProps({
|
|
49
50
|
type: {
|
|
@@ -57,6 +58,6 @@ const rootStore = useRootStore();
|
|
|
57
58
|
const items = ref($stores[props.type].views);
|
|
58
59
|
const current = ref($stores[props.type].view);
|
|
59
60
|
const updateView = async (value) => {
|
|
60
|
-
await rootStore.updateView({ value, type: props.type });
|
|
61
|
+
await rootStore.updateView({ value, type: props.type, lang: locale.value });
|
|
61
62
|
};
|
|
62
63
|
</script>
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
<script setup>
|
|
10
10
|
import { useRootStore } from "../../../stores/root";
|
|
11
|
-
import { useNuxtApp, computed } from "#imports";
|
|
11
|
+
import { useNuxtApp, computed, useI18n } from "#imports";
|
|
12
|
+
const { locale } = useI18n();
|
|
12
13
|
const rootStore = useRootStore();
|
|
13
14
|
const { $stores } = useNuxtApp();
|
|
14
15
|
const props = defineProps(["type", "items", "name"]);
|
|
@@ -17,7 +18,7 @@ const val = computed({
|
|
|
17
18
|
return $stores[props.type].filters[props.name]?.value || [];
|
|
18
19
|
},
|
|
19
20
|
set(value) {
|
|
20
|
-
return rootStore.updateFilter(props.name, value, props.type);
|
|
21
|
+
return rootStore.updateFilter(props.name, value, props.type, locale.value);
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
</script>
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { useRootStore } from "../../../stores/root";
|
|
7
|
-
import { useNuxtApp, computed } from "#imports";
|
|
7
|
+
import { useNuxtApp, computed, useI18n } from "#imports";
|
|
8
|
+
const { locale } = useI18n();
|
|
8
9
|
const rootStore = useRootStore();
|
|
9
10
|
const props = defineProps(["type", "items", "name"]);
|
|
10
11
|
const { $stores } = useNuxtApp();
|
|
@@ -13,7 +14,7 @@ const val = computed({
|
|
|
13
14
|
return $stores[props.type].filters[props.name]?.value;
|
|
14
15
|
},
|
|
15
16
|
set(value) {
|
|
16
|
-
rootStore.updateFilter(props.name, value, props.type);
|
|
17
|
+
rootStore.updateFilter(props.name, value, props.type, locale.value);
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
</script>
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { useRootStore } from "../../../stores/root";
|
|
7
|
-
import { useNuxtApp, computed } from "#imports";
|
|
7
|
+
import { useNuxtApp, computed, useI18n } from "#imports";
|
|
8
|
+
const { locale } = useI18n();
|
|
8
9
|
const rootStore = useRootStore();
|
|
9
10
|
const props = defineProps(["type", "items", "name"]);
|
|
10
11
|
const { $stores } = useNuxtApp();
|
|
@@ -13,7 +14,7 @@ const val = computed({
|
|
|
13
14
|
return $stores[props.type].filters[props.name]?.value;
|
|
14
15
|
},
|
|
15
16
|
set(value) {
|
|
16
|
-
rootStore.updateFilter(props.name, value, props.type);
|
|
17
|
+
rootStore.updateFilter(props.name, value, props.type, locale.value);
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
</script>
|
|
@@ -8,16 +8,21 @@
|
|
|
8
8
|
|
|
9
9
|
<script setup>
|
|
10
10
|
import { useRootStore } from "../../../stores/root";
|
|
11
|
-
import { useNuxtApp, computed } from "#imports";
|
|
11
|
+
import { useNuxtApp, computed, useI18n } from "#imports";
|
|
12
|
+
const { locale } = useI18n();
|
|
12
13
|
const rootStore = useRootStore();
|
|
13
14
|
const { $stores } = useNuxtApp();
|
|
14
15
|
const props = defineProps(["type", "items", "name"]);
|
|
15
16
|
const val = computed({
|
|
16
17
|
get() {
|
|
18
|
+
console.log(
|
|
19
|
+
"$stores[props.type].filters[props.name]?.value: ",
|
|
20
|
+
$stores[props.type].filters[props.name]?.value
|
|
21
|
+
);
|
|
17
22
|
return $stores[props.type].filters[props.name]?.value || [];
|
|
18
23
|
},
|
|
19
24
|
set(value) {
|
|
20
|
-
rootStore.updateFilter(props.name, value, props.type);
|
|
25
|
+
rootStore.updateFilter(props.name, value, props.type, locale.value || "en");
|
|
21
26
|
}
|
|
22
27
|
});
|
|
23
28
|
</script>
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
import { useDisplay } from "vuetify";
|
|
44
44
|
import { useRootStore } from "../../../stores/root";
|
|
45
45
|
import { capitalize } from "../../../composables/useUtils";
|
|
46
|
-
import { useNuxtApp, onMounted, resolveComponent } from "#imports";
|
|
47
|
-
import { useI18n } from "vue-i18n";
|
|
46
|
+
import { useNuxtApp, onMounted, resolveComponent, useI18n } from "#imports";
|
|
48
47
|
const { smAndDown } = useDisplay();
|
|
49
48
|
const i18n = useI18n();
|
|
50
49
|
const { locale, messages } = useI18n();
|
|
@@ -63,7 +62,9 @@ const getItems = (name) => {
|
|
|
63
62
|
if ($filters?.[props.type]?.[name]) {
|
|
64
63
|
console.log("filters found for ", name, $filters[props.type][name]);
|
|
65
64
|
return $filters[props.type][name].filter((key) => key !== "label").map((item) => ({
|
|
66
|
-
title: i18n.t(
|
|
65
|
+
title: i18n.t(
|
|
66
|
+
props.type === "people" && name === "vintage" ? item : `list.filters.${props.type}.${name}.${item}`
|
|
67
|
+
),
|
|
67
68
|
value: item
|
|
68
69
|
}));
|
|
69
70
|
}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
<v-col cols="12">
|
|
4
4
|
<div class="d-flex">
|
|
5
5
|
<ListAtomsFiltersMenu
|
|
6
|
-
:open="filtersOpen
|
|
6
|
+
:open="filtersOpen ?? visible"
|
|
7
7
|
@open="filtersOpen = $event"
|
|
8
8
|
/>
|
|
9
9
|
<v-spacer />
|
|
10
|
-
<ListAtomsResetButton v-if="
|
|
10
|
+
<ListAtomsResetButton v-if="$stores[type].filtersCount" :type="type" />
|
|
11
11
|
<ListAtomsViewMenu :type="type" />
|
|
12
12
|
<ListAtomsSortMenu :type="type" />
|
|
13
13
|
</div>
|
|
14
14
|
<v-expand-transition>
|
|
15
|
-
<div v-
|
|
15
|
+
<div v-show="filtersOpen" class="mb-7">
|
|
16
16
|
<ListMoleculesFilters :type="type" />
|
|
17
17
|
</div>
|
|
18
18
|
</v-expand-transition>
|
|
@@ -28,7 +28,18 @@ import { useNuxtApp } from "#imports";
|
|
|
28
28
|
const { $stores } = useNuxtApp();
|
|
29
29
|
const filtersOpen = ref(false);
|
|
30
30
|
const visible = computed(() => {
|
|
31
|
-
|
|
31
|
+
console.log(
|
|
32
|
+
"$stores[props.type]?.filtersCount > 0: ",
|
|
33
|
+
$stores[props.type]?.filtersCount > 0
|
|
34
|
+
);
|
|
35
|
+
console.log(
|
|
36
|
+
"$stores[props.type]?.filtersCount: ",
|
|
37
|
+
$stores[props.type]?.filtersCount
|
|
38
|
+
);
|
|
39
|
+
console.log(
|
|
40
|
+
!!($stores[props.type]?.filtersCount && $stores[props.type]?.filtersCount > 0)
|
|
41
|
+
);
|
|
42
|
+
return !!($stores[props.type]?.filtersCount && $stores[props.type]?.filtersCount > 0);
|
|
32
43
|
});
|
|
33
44
|
const props = defineProps({
|
|
34
45
|
type: {
|
|
@@ -79,7 +79,8 @@
|
|
|
79
79
|
|
|
80
80
|
<script setup>
|
|
81
81
|
import { useRootStore } from "../../../stores/root";
|
|
82
|
-
import { useRoute, computed,
|
|
82
|
+
import { useRoute, computed, useI18n } from "#imports";
|
|
83
|
+
const { locale } = useI18n();
|
|
83
84
|
const route = useRoute();
|
|
84
85
|
const rootStore = useRootStore();
|
|
85
86
|
const props = defineProps({
|
|
@@ -177,7 +178,7 @@ const createGap = (pageIndex) => {
|
|
|
177
178
|
};
|
|
178
179
|
};
|
|
179
180
|
const updatePage = (page) => {
|
|
180
|
-
rootStore.updatePage({ page, type: props.type });
|
|
181
|
+
rootStore.updatePage({ page, type: props.type, lang: locale.value });
|
|
181
182
|
};
|
|
182
183
|
const getGapPage = (index) => {
|
|
183
184
|
return Math.floor(
|
|
@@ -31,9 +31,10 @@ import {
|
|
|
31
31
|
useNuxtApp,
|
|
32
32
|
resolveComponent,
|
|
33
33
|
computed,
|
|
34
|
-
onBeforeUnmount
|
|
34
|
+
onBeforeUnmount,
|
|
35
|
+
onMounted,
|
|
36
|
+
useI18n
|
|
35
37
|
} from "#imports";
|
|
36
|
-
import { useI18n } from "vue-i18n";
|
|
37
38
|
const { $stores } = useNuxtApp();
|
|
38
39
|
const { locale } = useI18n();
|
|
39
40
|
const rootStore = useRootStore();
|
|
@@ -83,13 +84,17 @@ const itemTemplate = computed(
|
|
|
83
84
|
const numberOfPages = computed(() => $stores[props.type].numberOfPages);
|
|
84
85
|
const page = computed(() => +$stores[props.type].page);
|
|
85
86
|
const items = computed(() => $stores[props.type].items);
|
|
86
|
-
|
|
87
|
+
console.log("setup list");
|
|
88
|
+
rootStore.loadRouteQuery(props.type);
|
|
89
|
+
onMounted(() => {
|
|
90
|
+
console.log("mounted list");
|
|
91
|
+
});
|
|
87
92
|
try {
|
|
88
93
|
await rootStore.update(props.type, locale.value);
|
|
89
94
|
} catch (error) {
|
|
90
95
|
console.log("error fetching update list: ", error);
|
|
91
96
|
}
|
|
92
97
|
onBeforeUnmount(() => {
|
|
93
|
-
rootStore.resetState(props.type);
|
|
98
|
+
rootStore.resetState(props.type, locale.value);
|
|
94
99
|
});
|
|
95
100
|
</script>
|
|
@@ -52,18 +52,10 @@
|
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
54
|
<script setup>
|
|
55
|
-
import {
|
|
56
|
-
ref,
|
|
57
|
-
computed,
|
|
58
|
-
onMounted,
|
|
59
|
-
onBeforeUnmount,
|
|
60
|
-
nextTick,
|
|
61
|
-
watch
|
|
62
|
-
} from "vue";
|
|
55
|
+
import { ref, computed, onMounted, onBeforeUnmount, nextTick, watch } from "vue";
|
|
63
56
|
import { useRootStore } from "../../../stores/root";
|
|
64
57
|
import { capitalize } from "../../../composables/useUtils";
|
|
65
|
-
import { useNuxtApp } from "#imports";
|
|
66
|
-
import { useI18n } from "vue-i18n";
|
|
58
|
+
import { useNuxtApp, useI18n } from "#imports";
|
|
67
59
|
defineOptions({ name: "ListOrganismsSlider" });
|
|
68
60
|
const { $stores } = useNuxtApp();
|
|
69
61
|
const { locale } = useI18n();
|
|
@@ -164,7 +156,7 @@ onMounted(async () => {
|
|
|
164
156
|
});
|
|
165
157
|
onBeforeUnmount(() => {
|
|
166
158
|
window.removeEventListener("resize", handleResize);
|
|
167
|
-
rootStore.resetState(props.type);
|
|
159
|
+
rootStore.resetState(props.type, locale.value);
|
|
168
160
|
});
|
|
169
161
|
watch(
|
|
170
162
|
() => items.value,
|
|
@@ -107,20 +107,8 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
107
107
|
const stores = {};
|
|
108
108
|
const queries = {};
|
|
109
109
|
const models = {};
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const filtersResponse = await fetch(
|
|
113
|
-
"https://cdn-yggdrasil-dev.s3.eu-west-2.amazonaws.com/iea/filters.json"
|
|
114
|
-
);
|
|
115
|
-
if (filtersResponse.ok) {
|
|
116
|
-
builtFilters = await filtersResponse.json();
|
|
117
|
-
console.log("Filters loaded successfully:", builtFilters);
|
|
118
|
-
} else {
|
|
119
|
-
console.warn("Failed to load filters, using empty object");
|
|
120
|
-
}
|
|
121
|
-
} catch (error) {
|
|
122
|
-
console.error("Error loading filters:", error);
|
|
123
|
-
}
|
|
110
|
+
const builtFilters = await import("../public/filters.json");
|
|
111
|
+
console.log("Filters loaded successfully:", builtFilters);
|
|
124
112
|
console.log("INITIALIZING STORES");
|
|
125
113
|
await Promise.all(
|
|
126
114
|
appConfig.list.modules.map(async (type) => {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"events": {
|
|
3
|
+
"disciplines": [
|
|
4
|
+
"archeology",
|
|
5
|
+
"architecture-and-spatial-planning",
|
|
6
|
+
"art-and-art-history",
|
|
7
|
+
"classical-studies",
|
|
8
|
+
"cultural-heritage-and-museology",
|
|
9
|
+
"digital-humanities",
|
|
10
|
+
"economics-and-finance",
|
|
11
|
+
"education",
|
|
12
|
+
"environment",
|
|
13
|
+
"gender-studies",
|
|
14
|
+
"geography",
|
|
15
|
+
"history",
|
|
16
|
+
"history-philosophy-and-sociology-of-science",
|
|
17
|
+
"information-and-communication-studies",
|
|
18
|
+
"law",
|
|
19
|
+
"linguistics",
|
|
20
|
+
"literature",
|
|
21
|
+
"medicine-pharmacy",
|
|
22
|
+
"music-musicology-and-performance-arts",
|
|
23
|
+
"neuroscience",
|
|
24
|
+
"others",
|
|
25
|
+
"philosophy",
|
|
26
|
+
"physics-and-mathematics",
|
|
27
|
+
"political-science",
|
|
28
|
+
"psychology",
|
|
29
|
+
"religious-studies",
|
|
30
|
+
"sciences-of-the-universe",
|
|
31
|
+
"social-anthropology-and-ethnology",
|
|
32
|
+
"sociology"
|
|
33
|
+
],
|
|
34
|
+
"fellowships": [],
|
|
35
|
+
"tags": [],
|
|
36
|
+
"category": [
|
|
37
|
+
"CALL",
|
|
38
|
+
"COLLOQUIUM",
|
|
39
|
+
"CONFERENCE",
|
|
40
|
+
"CONFERENCE_CYCLE",
|
|
41
|
+
"EXHIBITION",
|
|
42
|
+
"LECTURE",
|
|
43
|
+
"OTHER",
|
|
44
|
+
"SEMINAR"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"fellowships": { "disciplines": [], "tags": [], "affiliations": [] },
|
|
48
|
+
"news": { "tags": [], "category": ["LIFE_AT_THE_INSTITUTE", "VIDEO"] },
|
|
49
|
+
"projects": { "tags": [] },
|
|
50
|
+
"people": {
|
|
51
|
+
"disciplines": [],
|
|
52
|
+
"fellowships": [],
|
|
53
|
+
"vintage": [
|
|
54
|
+
2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,
|
|
55
|
+
2019, 2020, 2021, 2022, 2023, 2024, 2025
|
|
56
|
+
],
|
|
57
|
+
"members": []
|
|
58
|
+
},
|
|
59
|
+
"publications": {
|
|
60
|
+
"affiliations": [],
|
|
61
|
+
"disciplines": [],
|
|
62
|
+
"tags": [],
|
|
63
|
+
"type": ["ARTICLE", "VIDEO"],
|
|
64
|
+
"eventCategory": [
|
|
65
|
+
"COLLOQUIUM",
|
|
66
|
+
"CONFERENCE",
|
|
67
|
+
"CONFERENCE_CYCLE",
|
|
68
|
+
"LECTURE",
|
|
69
|
+
"OTHER"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -25,31 +25,31 @@ interface RootStoreState {
|
|
|
25
25
|
export declare const useRootStore: import("pinia").StoreDefinition<"rootStore", RootStoreState, {}, {
|
|
26
26
|
setLoading(value: boolean, type?: string): void;
|
|
27
27
|
setScrolled(): void;
|
|
28
|
-
saveFiltersToLocalStorage(type: string): void;
|
|
29
28
|
loadRouteQuery(type: string): void;
|
|
30
|
-
loadFiltersFromLocalStorage(type: string): void;
|
|
31
29
|
setFiltersCount(type: string): void;
|
|
32
30
|
updateRouteQuery(type: string): void;
|
|
33
31
|
resetState(type: string, lang: string): void;
|
|
34
|
-
updateSort({ value, type, }: {
|
|
32
|
+
updateSort({ value, type, lang, }: {
|
|
35
33
|
value: (number | string)[];
|
|
36
34
|
type: string;
|
|
35
|
+
lang?: string;
|
|
37
36
|
}): void;
|
|
38
|
-
updateView({ value, type }: {
|
|
37
|
+
updateView({ value, type, lang, }: {
|
|
39
38
|
value: string;
|
|
40
39
|
type: string;
|
|
40
|
+
lang?: string;
|
|
41
41
|
}): void;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
updateItemsPerPage({ value, type }: {
|
|
42
|
+
updateFilter(key: string, val: unknown, type: string, lang: string): void;
|
|
43
|
+
updateItemsPerPage({ value, type, lang, }: {
|
|
45
44
|
value: number;
|
|
46
45
|
type: string;
|
|
46
|
+
lang?: string;
|
|
47
47
|
}): void;
|
|
48
|
-
updatePage({ page, type, }: {
|
|
48
|
+
updatePage({ page, type, lang, }: {
|
|
49
49
|
page: number;
|
|
50
50
|
type: string;
|
|
51
|
+
lang?: string;
|
|
51
52
|
}): Promise<void>;
|
|
52
|
-
initializePageFromRoute(): void;
|
|
53
53
|
updateSearch({ type, search, lang, }: {
|
|
54
54
|
type: string;
|
|
55
55
|
search: string;
|
|
@@ -27,6 +27,7 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
27
27
|
}),
|
|
28
28
|
actions: {
|
|
29
29
|
setLoading(value, type = "") {
|
|
30
|
+
console.log("setLoading", { value, type });
|
|
30
31
|
const { $stores } = useNuxtApp();
|
|
31
32
|
this.loading = value;
|
|
32
33
|
if (type.length && type !== "all" && $stores[type]) {
|
|
@@ -38,53 +39,66 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
38
39
|
this.scrolled = window.scrollY > 0;
|
|
39
40
|
}
|
|
40
41
|
},
|
|
41
|
-
saveFiltersToLocalStorage(type) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
/* saveFiltersToLocalStorage(type: string): void {
|
|
43
|
+
const { $stores } = useNuxtApp() as {
|
|
44
|
+
$stores: Record<string, ModuleStore>;
|
|
45
|
+
};
|
|
46
|
+
const filters = $stores[type]?.filters ?? {};
|
|
47
|
+
const values = Object.fromEntries(
|
|
48
|
+
Object.entries(filters).map(([key, filter]) => [key, filter.value])
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const local = JSON.parse(localStorage.getItem("PARIS_IAS") || "{}");
|
|
52
|
+
local[`${type}_filters`] = values;
|
|
53
|
+
localStorage.setItem("PARIS_IAS", JSON.stringify(local));
|
|
54
|
+
}, */
|
|
51
55
|
loadRouteQuery(type) {
|
|
56
|
+
console.log("loadRouteQuery", type);
|
|
52
57
|
const { $stores } = useNuxtApp();
|
|
53
58
|
const { currentRoute } = useRouter();
|
|
54
59
|
const query = currentRoute.value.query;
|
|
55
60
|
const filters = $stores[type]?.filters ?? {};
|
|
61
|
+
console.log("filters: ", filters);
|
|
56
62
|
if (Object.keys(query)?.length) {
|
|
57
63
|
Object.keys(query).forEach((filter) => {
|
|
58
64
|
if (filter in filters) {
|
|
65
|
+
console.log("filter: ", filter, query[filter]);
|
|
59
66
|
const queryValue = query[filter];
|
|
60
67
|
if (typeof queryValue === "string") {
|
|
61
68
|
filters[filter].value = filters[filter].multiple ? JSON.parse(queryValue) : queryValue;
|
|
62
69
|
}
|
|
70
|
+
} else {
|
|
71
|
+
console.log("unknown filter: ", filter);
|
|
63
72
|
}
|
|
64
73
|
});
|
|
65
74
|
}
|
|
66
75
|
console.log("query loaded");
|
|
67
|
-
this.setFiltersCount(type);
|
|
68
|
-
},
|
|
69
|
-
loadFiltersFromLocalStorage(type) {
|
|
70
|
-
const { $stores } = useNuxtApp();
|
|
71
|
-
const local = JSON.parse(localStorage.getItem("PARIS_IAS") || "{}");
|
|
72
|
-
const saved = local[`${type}_filters`] ?? null;
|
|
73
|
-
if (!saved) {
|
|
74
|
-
console.log(`[${type}] No data to restore.`);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const filters = $stores[type]?.filters ?? {};
|
|
78
|
-
for (const [key, value] of Object.entries(saved)) {
|
|
79
|
-
if (filters[key]) {
|
|
80
|
-
filters[key].value = value;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
this.setFiltersCount(type);
|
|
84
|
-
this.updateRouteQuery(type);
|
|
85
|
-
console.log(`[${type}] Filters restored from localStorage`, saved);
|
|
86
76
|
},
|
|
77
|
+
/* loadFiltersFromLocalStorage(type: string): void {
|
|
78
|
+
const { $stores } = useNuxtApp() as {
|
|
79
|
+
$stores: Record<string, ModuleStore>
|
|
80
|
+
}
|
|
81
|
+
const local = JSON.parse(localStorage.getItem("PARIS_IAS") || "{}")
|
|
82
|
+
const saved = local[`${type}_filters`] ?? null
|
|
83
|
+
|
|
84
|
+
if (!saved) {
|
|
85
|
+
console.log(`[${type}] No data to restore.`)
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const filters = $stores[type]?.filters ?? {}
|
|
90
|
+
for (const [key, value] of Object.entries(saved)) {
|
|
91
|
+
if (filters[key]) {
|
|
92
|
+
filters[key].value = value
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.setFiltersCount(type)
|
|
97
|
+
this.updateRouteQuery(type)
|
|
98
|
+
console.log(`[${type}] Filters restored from localStorage`, saved)
|
|
99
|
+
}, */
|
|
87
100
|
setFiltersCount(type) {
|
|
101
|
+
console.log("setFiltersCount", type);
|
|
88
102
|
const { $stores } = useNuxtApp();
|
|
89
103
|
const filters = $stores[type]?.filters ?? {};
|
|
90
104
|
const count = Object.values(filters).reduce((acc, filter) => {
|
|
@@ -97,6 +111,7 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
97
111
|
}
|
|
98
112
|
},
|
|
99
113
|
updateRouteQuery(type) {
|
|
114
|
+
console.log("updateRouteQuery", type);
|
|
100
115
|
const router = useRouter();
|
|
101
116
|
const { $stores } = useNuxtApp();
|
|
102
117
|
const routeQuery = {
|
|
@@ -105,7 +120,6 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
105
120
|
...Object.entries($stores[type]?.filters ?? {}).reduce(
|
|
106
121
|
(acc, [key, filter]) => {
|
|
107
122
|
const value = filter?.value;
|
|
108
|
-
console.log("valueStore", value);
|
|
109
123
|
const isEmpty = value === void 0 || value === null || value === false || Array.isArray(value) && value.length === 0 || typeof value === "string" && value.trim() === "";
|
|
110
124
|
if (isEmpty) return acc;
|
|
111
125
|
return {
|
|
@@ -118,11 +132,13 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
118
132
|
};
|
|
119
133
|
router.replace({ query: routeQuery });
|
|
120
134
|
},
|
|
121
|
-
resetState(type, lang) {
|
|
135
|
+
async resetState(type, lang) {
|
|
136
|
+
console.log("resetState", { type, lang });
|
|
122
137
|
const { $stores, $models } = useNuxtApp();
|
|
123
138
|
console.log("$models[type]: ", $models[type]);
|
|
139
|
+
console.log("$stores[type]: ", $stores[type]);
|
|
124
140
|
if ($models[type] && $stores[type]) {
|
|
125
|
-
$stores[type] = $models[type];
|
|
141
|
+
$stores[type].filters = $models[type].filters;
|
|
126
142
|
}
|
|
127
143
|
console.log("resetState");
|
|
128
144
|
this.search = "";
|
|
@@ -132,24 +148,31 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
132
148
|
this.total = 0;
|
|
133
149
|
this.skip = 0;
|
|
134
150
|
this.numberOfPages = 0;
|
|
135
|
-
this.
|
|
136
|
-
this.updateRouteQuery(type);
|
|
137
|
-
this.update(type, lang);
|
|
151
|
+
await this.update(type, lang);
|
|
138
152
|
},
|
|
139
|
-
updateSort({
|
|
153
|
+
async updateSort({
|
|
140
154
|
value,
|
|
141
|
-
type
|
|
155
|
+
type,
|
|
156
|
+
lang = "en"
|
|
142
157
|
}) {
|
|
158
|
+
console.log("updateSort", {
|
|
159
|
+
value,
|
|
160
|
+
type
|
|
161
|
+
});
|
|
143
162
|
const { $stores } = useNuxtApp();
|
|
144
163
|
if ($stores[type]) {
|
|
145
164
|
$stores[type].sortBy = [String(value[0])];
|
|
146
165
|
$stores[type].sortDesc = [Number(value[1])];
|
|
147
166
|
}
|
|
148
167
|
this.page = 1;
|
|
149
|
-
this.
|
|
150
|
-
this.update(type);
|
|
168
|
+
await this.update(type, lang);
|
|
151
169
|
},
|
|
152
|
-
updateView({
|
|
170
|
+
async updateView({
|
|
171
|
+
value,
|
|
172
|
+
type,
|
|
173
|
+
lang
|
|
174
|
+
}) {
|
|
175
|
+
console.log("updateView", { value, type });
|
|
153
176
|
const { $stores } = useNuxtApp();
|
|
154
177
|
if ($stores[type]?.views?.[value]) {
|
|
155
178
|
$stores[type].view = {
|
|
@@ -157,38 +180,41 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
157
180
|
name: value
|
|
158
181
|
};
|
|
159
182
|
}
|
|
160
|
-
this.
|
|
161
|
-
this.update(type);
|
|
162
|
-
},
|
|
163
|
-
updateLocalStorage(key, value) {
|
|
164
|
-
const local = JSON.parse(localStorage.getItem("PARIS_IAS") || "{}");
|
|
165
|
-
local[key] = value;
|
|
166
|
-
localStorage.setItem("PARIS_IAS", JSON.stringify(local));
|
|
183
|
+
await this.update(type, lang);
|
|
167
184
|
},
|
|
168
|
-
|
|
185
|
+
/* updateLocalStorage(key: string, value: string): void {
|
|
186
|
+
const local = JSON.parse(localStorage.getItem("PARIS_IAS") || "{}")
|
|
187
|
+
local[key] = value
|
|
188
|
+
localStorage.setItem("PARIS_IAS", JSON.stringify(local))
|
|
189
|
+
}, */
|
|
190
|
+
async updateFilter(key, val, type, lang) {
|
|
169
191
|
const { $stores } = useNuxtApp();
|
|
170
192
|
console.log("update filter: ", { key, val, type });
|
|
171
193
|
if ($stores[type]?.filters?.[key]) {
|
|
172
194
|
$stores[type].filters[key].value = val;
|
|
173
195
|
}
|
|
174
|
-
this.setFiltersCount(type);
|
|
175
|
-
this.saveFiltersToLocalStorage(type);
|
|
176
|
-
this.updateRouteQuery(type);
|
|
177
196
|
this.page = 1;
|
|
178
|
-
this.update(type);
|
|
197
|
+
await this.update(type, lang);
|
|
179
198
|
},
|
|
180
|
-
updateItemsPerPage({
|
|
199
|
+
async updateItemsPerPage({
|
|
200
|
+
value,
|
|
201
|
+
type,
|
|
202
|
+
lang
|
|
203
|
+
}) {
|
|
204
|
+
console.log("updateItemsPerPage", { value, type });
|
|
181
205
|
const { $stores } = useNuxtApp();
|
|
182
206
|
this.page = 1;
|
|
183
207
|
if ($stores[type]) {
|
|
184
208
|
$stores[type].itemsPerPage = value;
|
|
185
209
|
}
|
|
186
|
-
this.update(type);
|
|
210
|
+
await this.update(type, lang);
|
|
187
211
|
},
|
|
188
212
|
async updatePage({
|
|
189
213
|
page,
|
|
190
|
-
type
|
|
214
|
+
type,
|
|
215
|
+
lang = "en"
|
|
191
216
|
}) {
|
|
217
|
+
console.log("updatePage", { page, type });
|
|
192
218
|
const router = useRouter();
|
|
193
219
|
const currentQuery = router.currentRoute.value.query;
|
|
194
220
|
const newQuery = { ...currentQuery };
|
|
@@ -198,25 +224,26 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
198
224
|
delete newQuery.page;
|
|
199
225
|
}
|
|
200
226
|
this.page = page;
|
|
201
|
-
await
|
|
202
|
-
await this.update(type);
|
|
203
|
-
},
|
|
204
|
-
initializePageFromRoute() {
|
|
205
|
-
const { query } = useRouter().currentRoute.value;
|
|
206
|
-
const page = Number.parseInt(query.page, 10);
|
|
207
|
-
this.page = isNaN(page) || page < 1 ? 1 : page;
|
|
227
|
+
await this.update(type, lang);
|
|
208
228
|
},
|
|
229
|
+
/*
|
|
230
|
+
initializePageFromRoute(): void {
|
|
231
|
+
const { query } = useRouter().currentRoute.value
|
|
232
|
+
const page = Number.parseInt(query.page as string, 10)
|
|
233
|
+
this.page = isNaN(page) || page < 1 ? 1 : page
|
|
234
|
+
}, */
|
|
209
235
|
async updateSearch({
|
|
210
236
|
type = "all",
|
|
211
237
|
search = "",
|
|
212
238
|
lang = "en"
|
|
213
239
|
}) {
|
|
240
|
+
console.log("updateSearch", { type, search, lang });
|
|
214
241
|
this.search = search;
|
|
215
|
-
this.setLoading(true);
|
|
216
242
|
await this.update(type, lang);
|
|
217
243
|
},
|
|
218
244
|
async update(type, lang = "en") {
|
|
219
245
|
const { $stores, $queries } = useNuxtApp();
|
|
246
|
+
console.log("update", { type, lang });
|
|
220
247
|
this.setLoading(true);
|
|
221
248
|
if (type !== "all" && $stores[type]) {
|
|
222
249
|
$stores[type].loading = true;
|
|
@@ -254,7 +281,6 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
254
281
|
);
|
|
255
282
|
args.options.filters = JSON.stringify(args.options.filters);
|
|
256
283
|
console.log("args: ", args);
|
|
257
|
-
console.log(`Fetching ${type}`);
|
|
258
284
|
const { data, error } = await useAsyncQuery(
|
|
259
285
|
type === "all" ? SEARCH : $queries[type]?.list,
|
|
260
286
|
args
|
|
@@ -281,6 +307,7 @@ export const useRootStore = defineStore("rootStore", {
|
|
|
281
307
|
$stores[type].numberOfPages = lastPage;
|
|
282
308
|
}
|
|
283
309
|
}
|
|
310
|
+
this.updateRouteQuery(type);
|
|
284
311
|
this.setLoading(false, type);
|
|
285
312
|
return true;
|
|
286
313
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"applications-closed-since-0": "Inscriptions fermées
|
|
2
|
+
"applications-closed-since-0": "Inscriptions fermées depuis le {0}",
|
|
3
3
|
"back": "Retour",
|
|
4
4
|
"biography": "Biographie",
|
|
5
5
|
"date-et-heure": "Date et heure",
|
|
@@ -338,5 +338,8 @@
|
|
|
338
338
|
"visit-this-project-website": "Visitez le site Web du projet",
|
|
339
339
|
"visit-this-publications-website": "Visitez la page Web de cette publication",
|
|
340
340
|
"no-biography": "Aucune biographie disponible",
|
|
341
|
-
"search": "Rechercher"
|
|
341
|
+
"search": "Rechercher",
|
|
342
|
+
"close-the-filter-panel": "Réduire les filtres",
|
|
343
|
+
"list.by-vintage-from-recent-to-old": "Par année, du plus récent au plus vieux",
|
|
344
|
+
"list.by-vintage-from-old-to-recent": "Par année, du plus vieux au plus récent"
|
|
342
345
|
}
|