@paris-ias/list 1.0.166 → 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.166",
4
+ "version": "1.0.167",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.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"
@@ -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>
@@ -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>
@@ -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>
@@ -1,15 +1,9 @@
1
- export declare const useFetchItem: () => {
2
- fetchItem: <T>(payload: {
3
- query: string;
4
- key: string;
5
- }) => Promise<T>;
6
- };
7
1
  type FetchItemPayload = {
8
2
  query: any;
9
3
  key: string;
10
4
  variables?: Record<string, any>;
11
5
  };
12
- export declare const useFetchItem2: () => {
6
+ export declare const useFetchItem: () => {
13
7
  fetchItem: <T>({ query, key, variables, }: FetchItemPayload) => Promise<T>;
14
8
  };
15
9
  export {};
@@ -1,61 +1,11 @@
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) => {
4
- try {
5
- const { locale } = useI18n();
6
- const route = useRoute();
7
- 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
- };
15
- const apolloClient = $apollo?.clients?.default;
16
- if (!apolloClient) {
17
- throw new Error("Apollo client is not available");
18
- }
19
- console.log("variables: ", variables);
20
- const { data } = await apolloClient.query({
21
- query: payload.query,
22
- variables
23
- });
24
- console.log("data: ", data);
25
- const item = data?.[payload.key];
26
- if (!item) {
27
- throw new Error("Item not found in response");
28
- }
29
- const setI18nParams = useSetI18nParams();
30
- if (!route.name.includes("people")) {
31
- setI18nParams({
32
- en: { slug: item.slug.en },
33
- fr: { slug: item.slug.fr }
34
- });
35
- } else {
36
- setI18nParams({
37
- en: { slug: item.slug },
38
- fr: { slug: item.slug }
39
- });
40
- }
41
- return item;
42
- } catch (error) {
43
- console.error("Error fetching item:", error);
44
- throw new Error(
45
- `Item not found: ${error instanceof Error ? error.message : String(error)}`
46
- );
47
- }
48
- };
49
- return {
50
- fetchItem
51
- };
52
- };
53
- export const useFetchItem2 = () => {
54
3
  const fetchItem = async ({
55
4
  query,
56
5
  key,
57
6
  variables
58
7
  }) => {
8
+ console.log("useFetchItem2 called with:", { query, key, variables });
59
9
  try {
60
10
  const { $apollo } = useNuxtApp();
61
11
  const route = useRoute();
@@ -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,7 +1,7 @@
1
1
  {
2
2
  "license": "AGPL-3.0-only",
3
3
  "main": "./dist/module.mjs",
4
- "version": "1.0.166",
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",