@paris-ias/list 1.0.100 → 1.0.102

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@paris-ias/list",
3
3
  "configKey": "list",
4
- "version": "1.0.100",
4
+ "version": "1.0.102",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.0",
7
7
  "unbuild": "3.5.0"
@@ -1,16 +1,5 @@
1
1
  <template>
2
- <v-sheet
3
- v-motion
4
- class="d-flex sliding-item flex-md-row flex-column px-6"
5
- :initial="{
6
- opacity: 0,
7
- x: 100,
8
- }"
9
- :enter="{
10
- opacity: 1,
11
- x: 0,
12
- }"
13
- >
2
+ <v-sheet v-motion class="d-flex sliding-item flex-md-row flex-column px-6">
14
3
  <MiscAtomsDateStamp
15
4
  :date-start="item.start"
16
5
  :date-stop="item.stop"
@@ -49,6 +49,7 @@ import { useRootStore } from "../../../stores/root";
49
49
  import { useNuxtApp, computed, ref } 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>
@@ -44,6 +44,7 @@ import { mergeProps, ref } from "vue";
44
44
  import { useDisplay } from "vuetify";
45
45
  import { useRootStore } from "../../../stores/root";
46
46
  import { useNuxtApp } 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>
@@ -9,6 +9,8 @@
9
9
  <script setup>
10
10
  import { useRootStore } from "../../../stores/root";
11
11
  import { useNuxtApp, computed } from "#imports";
12
+ import { useI18n } from "vue-i18n";
13
+ const { locale } = useI18n();
12
14
  const rootStore = useRootStore();
13
15
  const { $stores } = useNuxtApp();
14
16
  const props = defineProps(["type", "items", "name"]);
@@ -17,7 +19,7 @@ const val = computed({
17
19
  return $stores[props.type].filters[props.name]?.value || [];
18
20
  },
19
21
  set(value) {
20
- return rootStore.updateFilter(props.name, value, props.type);
22
+ return rootStore.updateFilter(props.name, value, props.type, locale.value);
21
23
  }
22
24
  });
23
25
  </script>
@@ -5,6 +5,7 @@
5
5
  <script setup>
6
6
  import { useRootStore } from "../../../stores/root";
7
7
  import { useNuxtApp, computed } from "#imports";
8
+ const { locale } = useI18n();
8
9
  const rootStore = useRootStore();
9
10
  const props = defineProps(["type", "items", "name"]);
10
11
  const { $stores } = useNuxtApp();
@@ -5,6 +5,8 @@
5
5
  <script setup>
6
6
  import { useRootStore } from "../../../stores/root";
7
7
  import { useNuxtApp, computed } from "#imports";
8
+ import { useI18n } from "vue-i18n";
9
+ const { locale } = useI18n();
8
10
  const rootStore = useRootStore();
9
11
  const props = defineProps(["type", "items", "name"]);
10
12
  const { $stores } = useNuxtApp();
@@ -13,7 +15,7 @@ const val = computed({
13
15
  return $stores[props.type].filters[props.name]?.value;
14
16
  },
15
17
  set(value) {
16
- rootStore.updateFilter(props.name, value, props.type);
18
+ rootStore.updateFilter(props.name, value, props.type, locale.value);
17
19
  }
18
20
  });
19
21
  </script>
@@ -9,15 +9,21 @@
9
9
  <script setup>
10
10
  import { useRootStore } from "../../../stores/root";
11
11
  import { useNuxtApp, computed } from "#imports";
12
+ import { useI18n } from "vue-i18n";
13
+ const { locale } = useI18n();
12
14
  const rootStore = useRootStore();
13
15
  const { $stores } = useNuxtApp();
14
16
  const props = defineProps(["type", "items", "name"]);
15
17
  const val = computed({
16
18
  get() {
19
+ console.log(
20
+ "$stores[props.type].filters[props.name]?.value: ",
21
+ $stores[props.type].filters[props.name]?.value
22
+ );
17
23
  return $stores[props.type].filters[props.name]?.value || [];
18
24
  },
19
25
  set(value) {
20
- rootStore.updateFilter(props.name, value, props.type);
26
+ rootStore.updateFilter(props.name, value, props.type, locale.value || "en");
21
27
  }
22
28
  });
23
29
  </script>
@@ -48,7 +48,7 @@ import { useI18n } from "vue-i18n";
48
48
  const { smAndDown } = useDisplay();
49
49
  const i18n = useI18n();
50
50
  const { locale, messages } = useI18n();
51
- const { $stores } = useNuxtApp();
51
+ const { $stores, $filters } = useNuxtApp();
52
52
  const rootStore = useRootStore();
53
53
  const props = defineProps(["type", "expanded"]);
54
54
  const ComponentName = (name) => {
@@ -60,6 +60,15 @@ const getItems = (name) => {
60
60
  if ($stores[props.type].filters[name].type === "Checkbox") {
61
61
  return [];
62
62
  }
63
+ if ($filters?.[props.type]?.[name]) {
64
+ console.log("filters found for ", name, $filters[props.type][name]);
65
+ return $filters[props.type][name].filter((key) => key !== "label").map((item) => ({
66
+ title: i18n.t(
67
+ props.type === "people" && name === "vintage" ? item : `list.filters.${props.type}.${name}.${item}`
68
+ ),
69
+ value: item
70
+ }));
71
+ }
63
72
  if (messages.value[locale.value].list.filters[props.type][name] === void 0) {
64
73
  console.log("name not found, no item for this filmter: ", name);
65
74
  return [];
@@ -3,16 +3,16 @@
3
3
  <v-col cols="12">
4
4
  <div class="d-flex">
5
5
  <ListAtomsFiltersMenu
6
- :open="filtersOpen || visible"
6
+ :open="filtersOpen ?? visible"
7
7
  @open="filtersOpen = $event"
8
8
  />
9
9
  <v-spacer />
10
- <ListAtomsResetButton v-if="visible" :type="type" />
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-if="filtersOpen" class="mb-7">
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
- return $stores[props.type]?.filtersCount && $stores[props.type]?.filtersCount > 0;
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: {
@@ -80,6 +80,8 @@
80
80
  <script setup>
81
81
  import { useRootStore } from "../../../stores/root";
82
82
  import { useRoute, computed, watch } from "#imports";
83
+ import { useI18n } from "vue-i18n";
84
+ const { locale } = useI18n();
83
85
  const route = useRoute();
84
86
  const rootStore = useRootStore();
85
87
  const props = defineProps({
@@ -177,7 +179,7 @@ const createGap = (pageIndex) => {
177
179
  };
178
180
  };
179
181
  const updatePage = (page) => {
180
- rootStore.updatePage({ page, type: props.type });
182
+ rootStore.updatePage({ page, type: props.type, lang: locale.value });
181
183
  };
182
184
  const getGapPage = (index) => {
183
185
  return Math.floor(
@@ -31,7 +31,8 @@ import {
31
31
  useNuxtApp,
32
32
  resolveComponent,
33
33
  computed,
34
- onBeforeUnmount
34
+ onBeforeUnmount,
35
+ onMounted
35
36
  } from "#imports";
36
37
  import { useI18n } from "vue-i18n";
37
38
  const { $stores } = useNuxtApp();
@@ -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
- rootStore.initializePageFromRoute();
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,14 +52,7 @@
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
58
  import { useNuxtApp } from "#imports";
@@ -164,7 +157,7 @@ onMounted(async () => {
164
157
  });
165
158
  onBeforeUnmount(() => {
166
159
  window.removeEventListener("resize", handleResize);
167
- rootStore.resetState(props.type);
160
+ rootStore.resetState(props.type, locale.value);
168
161
  });
169
162
  watch(
170
163
  () => items.value,
@@ -107,6 +107,8 @@ export default defineNuxtPlugin(async (nuxtApp) => {
107
107
  const stores = {};
108
108
  const queries = {};
109
109
  const models = {};
110
+ const builtFilters = await import("../public/filters.json");
111
+ console.log("Filters loaded successfully:", builtFilters);
110
112
  console.log("INITIALIZING STORES");
111
113
  await Promise.all(
112
114
  appConfig.list.modules.map(async (type) => {
@@ -129,4 +131,5 @@ export default defineNuxtPlugin(async (nuxtApp) => {
129
131
  nuxtApp.provide("rootStore", rootStore);
130
132
  nuxtApp.provide("stores", stores);
131
133
  nuxtApp.provide("queries", queries);
134
+ nuxtApp.provide("filters", builtFilters);
132
135
  });
@@ -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
- updateLocalStorage(key: string, value: string): void;
43
- updateFilter(key: string, val: unknown, type: string): void;
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
- }): void;
52
- initializePageFromRoute(): void;
51
+ lang?: string;
52
+ }): Promise<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
- const { $stores } = useNuxtApp();
43
- const filters = $stores[type]?.filters ?? {};
44
- const values = Object.fromEntries(
45
- Object.entries(filters).map(([key, filter]) => [key, filter.value])
46
- );
47
- const local = JSON.parse(localStorage.getItem("PARIS_IAS") || "{}");
48
- local[`${type}_filters`] = values;
49
- localStorage.setItem("PARIS_IAS", JSON.stringify(local));
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.setFiltersCount(type);
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.updateLocalStorage(type + "_sort", value.join("_"));
150
- this.update(type);
168
+ await this.update(type, lang);
151
169
  },
152
- updateView({ value, type }) {
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,35 +180,41 @@ export const useRootStore = defineStore("rootStore", {
157
180
  name: value
158
181
  };
159
182
  }
160
- this.updateLocalStorage(type + "_view", value);
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
- updateFilter(key, val, type) {
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({ value, type }) {
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
- updatePage({ page, type }) {
212
+ async updatePage({
213
+ page,
214
+ type,
215
+ lang = "en"
216
+ }) {
217
+ console.log("updatePage", { page, type });
189
218
  const router = useRouter();
190
219
  const currentQuery = router.currentRoute.value.query;
191
220
  const newQuery = { ...currentQuery };
@@ -194,26 +223,27 @@ export const useRootStore = defineStore("rootStore", {
194
223
  } else {
195
224
  delete newQuery.page;
196
225
  }
197
- router.replace({ query: newQuery });
198
226
  this.page = page;
199
- this.update(type);
200
- },
201
- initializePageFromRoute() {
202
- const { query } = useRouter().currentRoute.value;
203
- const page = Number.parseInt(query.page, 10);
204
- this.page = isNaN(page) || page < 1 ? 1 : page;
227
+ await this.update(type, lang);
205
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
+ }, */
206
235
  async updateSearch({
207
236
  type = "all",
208
237
  search = "",
209
238
  lang = "en"
210
239
  }) {
240
+ console.log("updateSearch", { type, search, lang });
211
241
  this.search = search;
212
- this.setLoading(true);
213
242
  await this.update(type, lang);
214
243
  },
215
244
  async update(type, lang = "en") {
216
245
  const { $stores, $queries } = useNuxtApp();
246
+ console.log("update", { type, lang });
217
247
  this.setLoading(true);
218
248
  if (type !== "all" && $stores[type]) {
219
249
  $stores[type].loading = true;
@@ -251,7 +281,6 @@ export const useRootStore = defineStore("rootStore", {
251
281
  );
252
282
  args.options.filters = JSON.stringify(args.options.filters);
253
283
  console.log("args: ", args);
254
- console.log(`Fetching ${type}`);
255
284
  const { data, error } = await useAsyncQuery(
256
285
  type === "all" ? SEARCH : $queries[type]?.list,
257
286
  args
@@ -278,6 +307,7 @@ export const useRootStore = defineStore("rootStore", {
278
307
  $stores[type].numberOfPages = lastPage;
279
308
  }
280
309
  }
310
+ this.updateRouteQuery(type);
281
311
  this.setLoading(false, type);
282
312
  return true;
283
313
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "applications-closed-since-0": "Inscriptions fermées deepuis le {0}",
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
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "AGPL-3.0-only",
3
3
  "main": "./dist/module.mjs",
4
- "version": "1.0.100",
4
+ "version": "1.0.102",
5
5
  "name": "@paris-ias/list",
6
6
  "repository": {
7
7
  "url": "git+https://github.com/IEA-Paris/list.git",