@paris-ias/list 1.0.165 → 1.0.167

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.165",
4
+ "version": "1.0.167",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -43,7 +43,7 @@
43
43
  </v-btn>
44
44
 
45
45
  <v-btn
46
- v-if="item.type === 'HYBRID'"
46
+ v-if="item.eventType === 'HYBRID'"
47
47
  color="grey-lighten-3"
48
48
  flat
49
49
  rounded="0"
@@ -7,11 +7,11 @@
7
7
  <div>{{ $t("from-starttime-to-stoptime", [startTime, stopTime]) }}</div>
8
8
  </div>
9
9
 
10
- <div class="text-overline font-weight-bold mt-md-4">
10
+ <!-- <div class="text-overline font-weight-bold mt-md-4">
11
11
  {{ $t("location") }}
12
12
  </div>
13
- <div>{{ item.location }}</div>
14
-
13
+ <div>{{ item.location }}</div> -->
14
+ <EventsLocation :item="item" />
15
15
  <v-btn
16
16
  variant="text"
17
17
  class="ml-n4"
@@ -22,7 +22,14 @@
22
22
  </v-col>
23
23
 
24
24
  <v-col align-self="start" class="pl-2">
25
+ <v-skeleton-loader
26
+ v-if="isLoading"
27
+ type="chip"
28
+ class="mr-3"
29
+ width="120"
30
+ />
25
31
  <v-chip
32
+ v-else
26
33
  class="mr-3"
27
34
  color="black"
28
35
  size="small"
@@ -32,7 +39,13 @@
32
39
  >
33
40
  {{ $t("list.filters.events.category." + item.category) }}
34
41
  </v-chip>
35
- <span v-if="smAndDown" class="text-overline">
42
+ <v-skeleton-loader
43
+ v-if="isLoading && smAndDown"
44
+ type="text"
45
+ width="90"
46
+ class="d-inline-block"
47
+ />
48
+ <span v-else-if="smAndDown" class="text-overline">
36
49
  {{
37
50
  new Date(item.start).toLocaleDateString(locale, {
38
51
  year: "numeric",
@@ -42,7 +55,15 @@
42
55
  }}
43
56
  </span>
44
57
 
58
+ <v-skeleton-loader
59
+ v-if="isLoading"
60
+ type="heading"
61
+ width="80%"
62
+ class="mt-2"
63
+ />
64
+
45
65
  <div
66
+ v-else
46
67
  class="text-h5 dense paragraph mt-2"
47
68
  v-html="
48
69
  $rootStore.search.length
@@ -50,7 +71,9 @@
50
71
  : item.name
51
72
  "
52
73
  />
74
+ <v-skeleton-loader v-if="isLoading" type="text@3" class="mt-2" />
53
75
  <MDC
76
+ v-else
54
77
  class="text-body-1 font-weight-light paragraph"
55
78
  :value="`${highlightAndTruncate(
56
79
  85,
@@ -61,7 +84,10 @@
61
84
  </v-col>
62
85
 
63
86
  <v-col align-self="center" cols="auto">
64
- <EventsBadges :item />
87
+ <v-skeleton-loader v-if="isLoading" type="button" />
88
+ <div v-else>
89
+ <EventsBadges :item />
90
+ </div>
65
91
  </v-col>
66
92
  </v-row>
67
93
  </template>
@@ -92,5 +118,5 @@ const props = defineProps({
92
118
  },
93
119
  })
94
120
 
95
- const isLoading = computed(() => props.loading)
121
+ const isLoading = computed(() => rootStore.loading || props.loading)
96
122
  </script>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <div v-if="item?.location" class="text-overline font-weight-bold mt-md-4">
3
+ {{ $t("location") }}
4
+ </div>
5
+
6
+ <div v-if="item?.location">
7
+ <b>{{ item.location.name }}</b>
8
+
9
+ <div v-if="formattedAddress">
10
+ {{ formattedAddress }}
11
+ </div>
12
+ </div>
13
+
14
+ <div v-if="item?.location?.details" class="text-caption">
15
+ {{ item.location.details }}
16
+ </div>
17
+ </template>
18
+
19
+ <script setup>
20
+ import { computed } from "vue"
21
+
22
+ const props = defineProps({
23
+ item: {
24
+ type: Object,
25
+ required: true,
26
+ },
27
+ })
28
+
29
+ const formattedAddress = computed(() => {
30
+ const loc = props.item?.location
31
+ if (!loc) return ""
32
+
33
+ const parts = [loc.street, loc.city].filter(Boolean)
34
+
35
+ const zipCountry = [loc.zip, loc.country].filter(Boolean)
36
+
37
+ if (zipCountry.length) {
38
+ parts.push(`(${zipCountry.join(", ")})`)
39
+ }
40
+
41
+ return parts.join(", ")
42
+ })
43
+ </script>
@@ -62,11 +62,7 @@
62
62
  <v-col cols="12">
63
63
  <v-skeleton-loader
64
64
  v-if="isLoading"
65
- :type="
66
- ['article, heading, text, heading, text, button, button'][
67
- ['md'].indexOf(name || 'md')
68
- ]
69
- "
65
+ :type="['button'][['md'].indexOf(name || 'md')]"
70
66
  />
71
67
 
72
68
  <div v-else>
@@ -330,7 +330,9 @@ const panel = ref("presentation")
330
330
 
331
331
  function redirectToMap(long, lat) {
332
332
  router.push(
333
- `https://www.openstreetmap.org/?mlat=${lat}&amp;mlon=${long}#map=19/${lat}/${long}`
333
+ `https://www.openstreetmap.org/?mlat=${lat}&amp;mlon=${long}#map=19/${lat}/${long}`,
334
334
  )
335
335
  }
336
+
337
+ console.log("Events", props.item)
336
338
  </script>
@@ -1,7 +1,12 @@
1
1
  <template>
2
2
  <v-row v-ripple no-gutters class="cursor-pointer highlight-on-hover">
3
3
  <v-col align-self="center" cols="8" class="text-h5 dense">
4
- <v-skeleton-loader v-if="isLoading" type="heading" />
4
+ <v-skeleton-loader
5
+ v-if="isLoading"
6
+ type="heading"
7
+ width="75%"
8
+ class="mb-2"
9
+ />
5
10
  <div
6
11
  v-else
7
12
  v-html="
@@ -13,7 +18,12 @@
13
18
  <FellowshipsBadges :item="item" />
14
19
  </v-col>
15
20
  <v-col align-self="center" cols="4">
16
- <v-skeleton-loader v-if="isLoading" type="chip@3" class="mt-2" />
21
+ <v-skeleton-loader
22
+ v-if="isLoading"
23
+ type="chip"
24
+ width="260"
25
+ class="mt-2"
26
+ />
17
27
  <MiscMoleculesChipContainer
18
28
  v-else
19
29
  :items="[
@@ -1,38 +1,51 @@
1
1
  <template>
2
- <v-col cols="12" md="6" class="highlight-on-hover">
3
- <div v-ripple class="border-thin pa-6">
4
- <FellowshipsBadges :item />
5
- <div class="d-flex">
6
- <v-skeleton-loader v-if="isLoading" type="heading" />
7
- <div v-else class="text-h4 text-black text-wrap mt-4 pb-4">
8
- {{ item.name }}
9
- </div>
10
- </div>
11
- <div
12
- class="text-wrap clamped-text d-flex"
13
- :style="
14
- '-webkit-line-clamp:' +
15
- [5, 5, 5, 10, 12, 14][
16
- ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
17
- ]
18
- "
19
- >
20
- <v-skeleton-loader v-if="isLoading" type="text@4" />
21
- <MDC v-else-if="item.description" :value="item.description" />
2
+ <v-row v-ripple no-gutters class="cursor-pointer highlight-on-hover my-2">
3
+ <v-col cols="12" class="w-100">
4
+ <div v-ripple class="border-thin pa-6">
5
+ <template v-if="isLoading">
6
+ <v-skeleton-loader type="chip@2" class="mb-2" />
7
+ <v-skeleton-loader type="heading" width="70%" class="mt-4" />
8
+ <v-skeleton-loader type="text@4" class="mt-2 w-100" />
9
+
10
+ <v-skeleton-loader type="chip" class="mt-4" width="260" />
11
+ </template>
12
+
13
+ <template v-else>
14
+ <FellowshipsBadges :item />
15
+
16
+ <div class="text-h4 text-black text-wrap mt-4 pb-4">
17
+ {{ item.name }}
18
+ </div>
19
+
20
+ <div
21
+ v-if="item.summary"
22
+ class="text-wrap clamped-text d-flex"
23
+ :style="
24
+ '-webkit-line-clamp:' +
25
+ [5, 5, 4, 8, 10, 11][
26
+ ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
27
+ ]
28
+ "
29
+ >
30
+ <MDC :value="item.summary" />
31
+ </div>
32
+
33
+ <MiscMoleculesChipContainer
34
+ :items="[
35
+ $t(
36
+ 'list.filters.fellowships.fellowshipType.' +
37
+ item.fellowshipType,
38
+ ),
39
+ ...(item?.disciplines?.length
40
+ ? item.disciplines.map((d) => d.name)
41
+ : []),
42
+ ]"
43
+ class="mt-4"
44
+ />
45
+ </template>
22
46
  </div>
23
- <v-skeleton-loader v-if="isLoading" type="chip@3" class="mt-2" />
24
- <MiscMoleculesChipContainer
25
- v-else
26
- :items="[
27
- $t('list.filters.fellowships.fellowshipType.' + item.fellowshipType),
28
- ...(props.item && props.item.disciplines
29
- ? props.item.disciplines.map((discipline) => discipline.name)
30
- : []),
31
- ]"
32
- class="mt-2"
33
- />
34
- </div>
35
- </v-col>
47
+ </v-col>
48
+ </v-row>
36
49
  </template>
37
50
 
38
51
  <script setup>
@@ -29,7 +29,7 @@
29
29
  </v-tooltip>
30
30
  </template>
31
31
  <v-list density="compact">
32
- <template v-for="(item, index) in $stores[props.type].sort">
32
+ <!-- <template v-for="(item, index) in $stores[props.type].sort">
33
33
  <v-list-item
34
34
  v-if="item.text !== current.text"
35
35
  :key="index"
@@ -41,7 +41,22 @@
41
41
  </template>
42
42
  <v-list-item-title>{{ $t("list." + item.text) }}</v-list-item-title>
43
43
  </v-list-item>
44
- </template>
44
+ </template> -->
45
+
46
+ <v-list-item
47
+ v-for="(item, index) in $stores[props.type].sort"
48
+ :key="index"
49
+ :disabled="$stores[type].loading || isActiveSort(item)"
50
+ :active="isActiveSort(item)"
51
+ active-class="bg-black text-white"
52
+ @click="updateSort(item.value)"
53
+ >
54
+ <template #prepend>
55
+ <v-icon>mdi-{{ item.icon }}</v-icon>
56
+ </template>
57
+
58
+ <v-list-item-title>{{ $t("list." + item.text) }}</v-list-item-title>
59
+ </v-list-item>
45
60
  </v-list>
46
61
  </v-menu>
47
62
  </template>
@@ -93,6 +108,13 @@ const current = computed(() => {
93
108
  const updateSort = async (value) => {
94
109
  rootStore.updateSort({ value, type: props.type, lang: locale.value })
95
110
  }
111
+
112
+ const isActiveSort = (item) => {
113
+ return (
114
+ item?.value?.[0] === $stores[props.type].sortBy?.[0] &&
115
+ item?.value?.[1] === $stores[props.type].sortDesc?.[0]
116
+ )
117
+ }
96
118
  </script>
97
119
 
98
120
  <style lang="scss"></style>
@@ -24,7 +24,9 @@
24
24
  <v-list-item
25
25
  v-for="(value, key, index) in items"
26
26
  :key="index"
27
- :disabled="$stores[type].loading"
27
+ :disabled="$stores[type].loading || (value.name || key) === currentName"
28
+ :active="(value.name || key) === currentName"
29
+ active-class="bg-black text-white"
28
30
  @click="updateView(value.name || key)"
29
31
  >
30
32
  <template #prepend>
@@ -14,7 +14,7 @@
14
14
  params: { slug: JSON.parse(item.slug) },
15
15
  })
16
16
  "
17
- class="text-decoration-none text-black"
17
+ class="text-decoration-none text-black w-100"
18
18
  >
19
19
  <component
20
20
  :is="itemTemplate"
@@ -40,7 +40,7 @@
40
40
  ? highlightAndTruncate(
41
41
  300,
42
42
  item.name,
43
- $rootStore.search.split(' ')
43
+ $rootStore.search.split(' '),
44
44
  )
45
45
  : item.name
46
46
  "
@@ -84,5 +84,5 @@ const eventCategory = computed(() => {
84
84
  }
85
85
  })
86
86
 
87
- const isLoading = computed(() => props.loading)
87
+ const isLoading = computed(() => rootStore.loading || props.loading)
88
88
  </script>
@@ -12,7 +12,7 @@
12
12
  />
13
13
  </v-col>
14
14
  <v-col align-self="center" class="text-h5 dense pl-2">
15
- <v-skeleton-loader v-if="isLoading" type="heading" />
15
+ <v-skeleton-loader v-if="isLoading" type="heading" width="50%" />
16
16
  <span
17
17
  v-else
18
18
  v-html="
@@ -21,23 +21,29 @@
21
21
  : item.name
22
22
  "
23
23
  />
24
- <v-skeleton-loader
24
+ <!-- <v-skeleton-loader
25
25
  v-if="isLoading"
26
26
  :type="
27
27
  ['chip', 'chip@2', 'chip@3', 'chip@4', 'chip@4', 'chip@4'][
28
28
  ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
29
29
  ]
30
30
  "
31
+ /> -->
32
+ <MiscMoleculesChipContainer
33
+ v-if="item.tags"
34
+ :items="item.tags || []"
35
+ size="small"
31
36
  />
32
- <MiscMoleculesChipContainer :items="item.tags || []" size="small" />
37
+
38
+ <v-skeleton-loader v-if="isLoading" type="text@2" class="mt-3" />
33
39
 
34
40
  <MDC
35
- v-if="item.summary"
41
+ v-else-if="item.summary"
36
42
  class="text-caption font-weight-light paragraph"
37
43
  :value="`${highlightAndTruncate(
38
44
  150,
39
45
  item.summary,
40
- rootStore.search.split(' ')
46
+ rootStore.search.split(' '),
41
47
  )}`"
42
48
  />
43
49
  </v-col>
@@ -70,13 +76,6 @@ const props = defineProps({
70
76
  default: false,
71
77
  },
72
78
  })
73
- const eventCategory = computed(() => {
74
- if (props.item.category) {
75
- return "list.filters.news.category." + props.item.category
76
- } else {
77
- return "list.filters.news.category.others"
78
- }
79
- })
80
79
 
81
- const isLoading = computed(() => props.loading)
80
+ const isLoading = computed(() => rootStore.loading || props.loading)
82
81
  </script>
@@ -31,7 +31,7 @@
31
31
  class="mt-n3 text-wrap clamped-text"
32
32
  :style="
33
33
  '-webkit-line-clamp:' +
34
- [5, 5, 4, 8, 10][
34
+ [5, 5, 4, 8, 10, 11][
35
35
  ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
36
36
  ]
37
37
  "
@@ -11,7 +11,7 @@
11
11
  v-else
12
12
  contain
13
13
  :loading="loading"
14
- :src="item.image.url ? item.image : '/default.png'"
14
+ :src="item && item.image ? item.image.url : '/default.png'"
15
15
  :ratio="1 / 1"
16
16
  />
17
17
  </v-col>
@@ -31,7 +31,10 @@
31
31
  />
32
32
 
33
33
  <div v-else class="d-flex align-center flex-column mt-12">
34
- <div class="d-flex text-center text-wrap text-h3 text-black">
34
+ <div
35
+ v-if="item && item.name"
36
+ class="d-flex text-center text-wrap text-h3 text-black"
37
+ >
35
38
  {{ item.name }}
36
39
  </div>
37
40
  <v-divider width="154px" class="mb-1 mt-6" />
@@ -40,7 +43,7 @@
40
43
  v-if="!loading"
41
44
  class="d-flex text-center text-wrap text-h5 text-black mt-6"
42
45
  >
43
- <MDC v-if="item.subtitle" :value="item.subtitle" />
46
+ <MDC v-if="item && item.subtitle" :value="item.subtitle" />
44
47
  </div>
45
48
  <MiscMoleculesChipContainer
46
49
  v-if="item && item.tags"
@@ -51,7 +54,7 @@
51
54
  <MiscAtomsShareMenu :item class="mt-6" />
52
55
  </v-btn-toggle>
53
56
  <v-btn
54
- v-if="item.url"
57
+ v-if="item && item.url"
55
58
  class="my-6 d-flex"
56
59
  variant="outlined"
57
60
  :href="item.url"
@@ -77,7 +80,7 @@
77
80
  ]
78
81
  "
79
82
  />
80
- <div v-if="item.description" class="mt-md-n2 mx-10 mx-md-0">
83
+ <div v-if="item && item.description" class="mt-md-n2 mx-10 mx-md-0">
81
84
  <MDC :value="item.description" />
82
85
  </div>
83
86
  </v-col>
@@ -124,8 +127,7 @@ const props = defineProps({
124
127
  loading: {
125
128
  type: Boolean,
126
129
  required: false,
127
- default: false,
128
130
  },
129
131
  })
130
- $stores.projects.loading = false
132
+ console.log("project view props", props.loading)
131
133
  </script>
@@ -13,14 +13,7 @@
13
13
  </v-col>
14
14
  <v-col class="pl-2">
15
15
  <div class="inline-flex flex-row flex-wrap">
16
- <v-skeleton-loader
17
- v-if="isLoading"
18
- :type="
19
- ['chip', 'chip@2', 'chip@3', 'chip@4', 'chip@4', 'chip@4'][
20
- ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
21
- ]
22
- "
23
- />
16
+ <v-skeleton-loader v-if="isLoading" :type="heading" />
24
17
 
25
18
  <template v-else>
26
19
  <v-chip
@@ -55,17 +48,20 @@
55
48
  ? highlightAndTruncate(
56
49
  300,
57
50
  item.name,
58
- $rootStore.search.split(' ')
51
+ $rootStore.search.split(' '),
59
52
  )
60
53
  : item.name
61
54
  "
62
55
  />
56
+
57
+ <v-skeleton-loader v-if="isLoading" type="text@3" class="mt-2" />
63
58
  <MDC
59
+ v-else
64
60
  class="text-body-1 font-weight-light paragraph"
65
61
  :value="`${highlightAndTruncate(
66
62
  150,
67
63
  item.summary,
68
- rootStore.search.split(' ')
64
+ rootStore.search.split(' '),
69
65
  )}`"
70
66
  />
71
67
  </div> </v-col
@@ -112,5 +108,5 @@ const eventType = computed(() => {
112
108
  }
113
109
  })
114
110
 
115
- const isLoading = computed(() => props.loading)
111
+ const isLoading = computed(() => rootStore.loading || props.loading)
116
112
  </script>
@@ -1,75 +1,77 @@
1
1
  <template>
2
- <v-col v-ripple cols="12" sm="6" md="4" lg="3" xl="2">
3
- <MiscAtomsImageContainer
4
- contain
5
- :src="item.image.url ? item.image : '/default.png'"
6
- :loading="isLoading"
7
- :ratio="1 / 1"
8
- />
9
- </v-col>
10
- <v-col
11
- v-ripple
12
- cols="12"
13
- sm="6"
14
- md="8"
15
- lg="9"
16
- xl="10"
17
- class="px-6 cursor-pointer"
18
- >
19
- <div>
20
- <v-skeleton-loader
21
- v-if="isLoading"
22
- type="heading,ossein,text@8,ossein,button,button"
2
+ <v-row v-ripple no-gutters class="cursor-pointer highlight-on-hover my-2">
3
+ <v-col v-ripple cols="12" sm="6" md="4" lg="3" xl="2">
4
+ <MiscAtomsImageContainer
5
+ contain
6
+ :src="item.image.url ? item.image : '/default.png'"
7
+ :loading="isLoading"
8
+ :ratio="1 / 1"
23
9
  />
10
+ </v-col>
11
+ <v-col
12
+ v-ripple
13
+ cols="12"
14
+ sm="6"
15
+ md="8"
16
+ lg="9"
17
+ xl="10"
18
+ class="px-6 cursor-pointer"
19
+ >
20
+ <div>
21
+ <v-skeleton-loader
22
+ v-if="isLoading"
23
+ type="heading,ossein,text@8,ossein,button,button"
24
+ />
24
25
 
25
- <template v-else>
26
- <div v-if="item.type" class="text-overline">{{ $t(item.type) }}</div>
27
- <div class="text-h5 text-sm-h3 text-md-h4 text-md-h4 my-6">
28
- {{ item.name }}
29
- </div>
30
- <div
31
- v-if="item.summary"
32
- class="text-wrap clamped-text"
33
- :style="
34
- '-webkit-line-clamp:' +
35
- [5, 5, 5, 10, 12, 14][
36
- ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
37
- ]
38
- "
39
- >
40
- <MDC :value="item.summary" />
41
- </div>
42
- <v-btn
43
- class="mt-4"
44
- variant="outlined"
45
- tile
46
- :size="
47
- ['small', 'small', 'small', 'default', 'default', 'large'][
48
- ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
49
- ]
50
- "
51
- >
52
- {{ $t("read-more") }}
53
- </v-btn>
54
- <v-btn
55
- v-if="item.url"
56
- variant="outlined"
57
- tile
58
- target="_blank"
59
- :href="item.url"
60
- class="mt-4 ml-4"
61
- prepend-icon="mdi-web"
62
- :size="
63
- ['small', 'small', 'small', 'default', 'default', 'large'][
64
- ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
65
- ]
66
- "
67
- >
68
- {{ $t("visit-the-publications-website") }}
69
- </v-btn>
70
- </template>
71
- </div>
72
- </v-col>
26
+ <template v-else>
27
+ <div v-if="item.type" class="text-overline">{{ $t(item.type) }}</div>
28
+ <div class="text-h5 text-sm-h3 text-md-h4 text-md-h4 my-6">
29
+ {{ item.name }}
30
+ </div>
31
+ <div
32
+ v-if="item.summary"
33
+ class="text-wrap clamped-text"
34
+ :style="
35
+ '-webkit-line-clamp:' +
36
+ [5, 5, 5, 10, 12, 14][
37
+ ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
38
+ ]
39
+ "
40
+ >
41
+ <MDC :value="item.summary" />
42
+ </div>
43
+ <v-btn
44
+ class="mt-4"
45
+ variant="outlined"
46
+ tile
47
+ :size="
48
+ ['small', 'small', 'small', 'default', 'default', 'large'][
49
+ ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
50
+ ]
51
+ "
52
+ >
53
+ {{ $t("read-more") }}
54
+ </v-btn>
55
+ <v-btn
56
+ v-if="item.url"
57
+ variant="outlined"
58
+ tile
59
+ target="_blank"
60
+ :href="item.url"
61
+ class="mt-4 ml-4"
62
+ prepend-icon="mdi-web"
63
+ :size="
64
+ ['small', 'small', 'small', 'default', 'default', 'large'][
65
+ ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(name || 'md')
66
+ ]
67
+ "
68
+ >
69
+ {{ $t("visit-the-publications-website") }}
70
+ </v-btn>
71
+ </template>
72
+ </div>
73
+ </v-col></v-row
74
+ >
73
75
  <v-divider />
74
76
  </template>
75
77
 
@@ -1,6 +1,9 @@
1
+ type FetchItemPayload = {
2
+ query: any;
3
+ key: string;
4
+ variables?: Record<string, any>;
5
+ };
1
6
  export declare const useFetchItem: () => {
2
- fetchItem: <T>(payload: {
3
- query: string;
4
- key: string;
5
- }) => Promise<T>;
7
+ fetchItem: <T>({ query, key, variables, }: FetchItemPayload) => Promise<T>;
6
8
  };
9
+ export {};
@@ -1,33 +1,25 @@
1
- import { useRoute, useI18n, useSetI18nParams, useNuxtApp } from "#imports";
1
+ import { useRoute, useSetI18nParams, useNuxtApp } from "#imports";
2
2
  export const useFetchItem = () => {
3
- const fetchItem = async (payload) => {
3
+ const fetchItem = async ({
4
+ query,
5
+ key,
6
+ variables
7
+ }) => {
8
+ console.log("useFetchItem2 called with:", { query, key, variables });
4
9
  try {
5
- const { locale } = useI18n();
6
- const route = useRoute();
7
10
  const { $apollo } = useNuxtApp();
8
- console.log("query: ", payload.query);
9
- console.log("key: ", payload.key);
10
- const variables = {
11
- itemId: route.params.slug?.toString().trim(),
12
- appId: "iea",
13
- lang: locale.value
14
- };
11
+ const route = useRoute();
15
12
  const apolloClient = $apollo?.clients?.default;
16
- if (!apolloClient) {
17
- throw new Error("Apollo client is not available");
18
- }
19
- console.log("variables: ", variables);
13
+ if (!apolloClient) throw new Error("Apollo client is not available");
20
14
  const { data } = await apolloClient.query({
21
- query: payload.query,
22
- variables
15
+ query,
16
+ variables,
17
+ fetchPolicy: "network-only"
23
18
  });
24
- console.log("data: ", data);
25
- const item = data?.[payload.key];
26
- if (!item) {
27
- throw new Error("Item not found in response");
28
- }
19
+ const item = data?.[key];
20
+ if (!item) throw new Error("Item not found in response");
29
21
  const setI18nParams = useSetI18nParams();
30
- if (!route.name.includes("people")) {
22
+ if (!String(route.name ?? "").includes("people")) {
31
23
  setI18nParams({
32
24
  en: { slug: item.slug.en },
33
25
  fr: { slug: item.slug.fr }
@@ -41,12 +33,8 @@ export const useFetchItem = () => {
41
33
  return item;
42
34
  } catch (error) {
43
35
  console.error("Error fetching item:", error);
44
- throw new Error(
45
- `Item not found: ${error instanceof Error ? error.message : String(error)}`
46
- );
36
+ throw error instanceof Error ? error : new Error(String(error));
47
37
  }
48
38
  };
49
- return {
50
- fetchItem
51
- };
39
+ return { fetchItem };
52
40
  };
@@ -6,7 +6,7 @@ export declare const createDynamicStore: (storeName: string, moduleState: object
6
6
  numberOfPages: import("vue").Ref<number, number>;
7
7
  search: import("vue").Ref<string, string>;
8
8
  error: import("vue").Ref<string | null, string | null>;
9
- }, "search" | "loading" | "total" | "skip" | "page" | "numberOfPages" | "error">, Pick<{
9
+ }, "loading" | "total" | "skip" | "page" | "numberOfPages" | "search" | "error">, Pick<{
10
10
  loading: import("vue").Ref<boolean, boolean>;
11
11
  total: import("vue").Ref<number, number>;
12
12
  skip: import("vue").Ref<number, number>;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "license": "AGPL-3.0-only",
3
3
  "main": "./dist/module.mjs",
4
- "version": "1.0.165",
4
+ "version": "1.0.167",
5
5
  "name": "@paris-ias/list",
6
6
  "repository": {
7
7
  "url": "git+https://github.com/IEA-Paris/list.git",
8
8
  "type": "git"
9
9
  },
10
10
  "dependencies": {
11
- "@paris-ias/trees": "^2.0.32"
11
+ "@paris-ias/trees": "^2.0.34"
12
12
  },
13
13
  "description": "Paris IAS List Module",
14
14
  "peerDependencies": {