@tekkare/romulus 0.1.265 → 0.1.267

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.264",
7
+ "version": "0.1.266",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -66,7 +66,12 @@ const groups = computed(() => rmProjectGroups(props.projects, props.lang))
66
66
  <div class="rm-project-list__grid">
67
67
  <RmSectionCard v-for="project in group.projects" :key="project.id" position="none" action class="rm-project-list__card">
68
68
  <!-- Deux branches en dur : `<component :is="'NuxtLink'">` ne resout rien. -->
69
- <NuxtLink v-if="project.to" :to="project.to" class="rm-project-list__link">
69
+ <NuxtLink
70
+ v-if="project.to"
71
+ :to="project.to"
72
+ :target="project.external ? '_blank' : undefined"
73
+ class="rm-project-list__link"
74
+ >
70
75
  <div class="rm-project-list__head">
71
76
  <RmIcon name="FolderSimple" :size="18" />
72
77
  <span class="rm-project-list__title">{{ project.title }}</span>
@@ -34,6 +34,8 @@ export interface RmProject {
34
34
  pinned?: boolean;
35
35
  /** Lien vers la page du projet. */
36
36
  to?: string;
37
+ /** `to` mene a une autre app (projet Discovery...) : il s'ouvre dans un nouvel onglet. */
38
+ external?: boolean;
37
39
  }
38
40
  export interface RmProjectGroup {
39
41
  key: 'pinned' | 'mine' | 'shared';
@@ -91,7 +91,6 @@ const emit = defineEmits<{
91
91
  const FEATURE = { fr: "Projets", en: "Projects" };
92
92
 
93
93
  const { locale } = useI18n();
94
- const router = useRouter();
95
94
  const localePath = useLocalePath();
96
95
  const creating = ref(false);
97
96
 
@@ -132,7 +131,7 @@ function activate(id: string) {
132
131
  }
133
132
 
134
133
  function open(id: string) {
135
- if (own) router.push(own.pathOf(id));
134
+ if (own) own.open(id);
136
135
  else emit("open", id);
137
136
  }
138
137
 
@@ -25,7 +25,6 @@
25
25
  :options="periodOptions"
26
26
  size="sm"
27
27
  variant="soft"
28
- class="stats_periods"
29
28
  :aria-label="isFr ? 'Période' : 'Period'"
30
29
  />
31
30
  </div>
@@ -345,11 +344,6 @@ const topPages = computed(() => viewedPages.value.slice(0, pagesShown.value));
345
344
  gap: 10px;
346
345
  }
347
346
 
348
- .stats_periods {
349
- flex: 1;
350
- min-width: 280px;
351
- }
352
-
353
347
  .stats_rank {
354
348
  color: var(--text-secondary);
355
349
  width: 28px;
@@ -194,6 +194,7 @@ import {
194
194
  PROJECTS_UPSELL,
195
195
  PROJECT_WORDING,
196
196
  WATCHABLE_PROJECT_TYPES,
197
+ projectExternalHref,
197
198
  useProjectScopeRows,
198
199
  useProjectSuggestions,
199
200
  useProjectsAccess,
@@ -774,6 +775,12 @@ async function load() {
774
775
  failed.value = false;
775
776
  try {
776
777
  const [detail, list] = await Promise.all([useOipApi().projects.get(projectId), projects.fetchItems(projectId)]);
778
+ // Un projet d'une autre app (Discovery...) se lit chez elle : un ancien lien y renvoie.
779
+ const external = detail ? projectExternalHref(detail) : null;
780
+ if (external) {
781
+ await navigateTo(external, { external: true, replace: true });
782
+ return;
783
+ }
777
784
  project.value = {
778
785
  title: detail?.title ?? "",
779
786
  description: detail?.description ?? "",
@@ -18,7 +18,7 @@
18
18
  import type { RmProject, RmProjectArchivedEntry } from "@tekkare/romulus/utils/projects";
19
19
  import { useOipApi } from "#oip-app/api";
20
20
  import { oipSnackbar } from "#oip-app/ui";
21
- import { PROJECTS_PATH, PROJECTS_STORAGE_KEY } from "#oip-projects";
21
+ import { PROJECTS_PATH, PROJECTS_STORAGE_KEY, projectExternalHref } from "#oip-projects";
22
22
  import { useOipProjectKinds } from "./useOipProjectKinds";
23
23
 
24
24
  export interface Project {
@@ -33,6 +33,8 @@ export interface Project {
33
33
  membersCount?: number;
34
34
  /** Ressources presentes, tous types confondus, y compris ceux que l'app n'affiche pas. */
35
35
  resourcesCount?: number;
36
+ /** Le projet s'ouvre dans une autre app, a cette adresse (cf. projectExternalHref). */
37
+ href?: string;
36
38
  }
37
39
 
38
40
  /** Un document, ou les documents que porte une meme carte. */
@@ -165,7 +167,15 @@ export const useProjects = () => {
165
167
  }
166
168
 
167
169
  function pathOf(projectId: string) {
168
- return localePath(`${PROJECTS_PATH}/${projectId}`);
170
+ return projects.value.find((p) => p.id === projectId)?.href ?? localePath(`${PROJECTS_PATH}/${projectId}`);
171
+ }
172
+
173
+ /** Ouvre un projet : sa page ici, ou son app dans un nouvel onglet. */
174
+ function open(projectId: string) {
175
+ const href = projects.value.find((p) => p.id === projectId)?.href;
176
+ return href
177
+ ? navigateTo(href, { external: true, open: { target: "_blank" } })
178
+ : navigateTo(pathOf(projectId));
169
179
  }
170
180
 
171
181
  /** Le projet tel que les composants RmProject* l'affichent. */
@@ -181,6 +191,7 @@ export const useProjects = () => {
181
191
  resourcesCount: project.resourcesCount,
182
192
  pinned: pinnedIds.value.includes(project.id),
183
193
  to: pathOf(project.id),
194
+ external: !!project.href,
184
195
  };
185
196
  }
186
197
 
@@ -220,6 +231,7 @@ export const useProjects = () => {
220
231
  isShared: p.isShared,
221
232
  membersCount: p.membersCount,
222
233
  resourcesCount: p.resourcesCount,
234
+ href: projectExternalHref(p) ?? undefined,
223
235
  }));
224
236
  failure.value = null;
225
237
  loaded.value = true;
@@ -620,6 +632,7 @@ export const useProjects = () => {
620
632
  active,
621
633
  activeId,
622
634
  pathOf,
635
+ open,
623
636
  isMine,
624
637
  togglePin,
625
638
  items,
@@ -40,6 +40,16 @@ export const PROJECTS_STORAGE_KEY = "oipProject";
40
40
  */
41
41
  export const PROJECT_KINDS: RmProjectKind[] = [];
42
42
 
43
+ /**
44
+ * L'adresse d'un projet qui s'ouvre dans une autre app, lue sur le projet tel
45
+ * que l'API le rend (projet Discovery : ses PICOTS sont renseignes...). `null`
46
+ * : sa page dans cette app. Une adresse ouvre la carte dans un nouvel onglet
47
+ * et renvoie `/projects/<id>` vers elle.
48
+ */
49
+ export function projectExternalHref(_project: Record<string, any>): string | null {
50
+ return null;
51
+ }
52
+
43
53
  /** Les projets sont-ils ouverts a l'utilisateur (licence...) ? Faux : le panneau `PROJECTS_UPSELL`. */
44
54
  export function useProjectsAccess(): Ref<boolean> | ComputedRef<boolean> {
45
55
  return computed(() => true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.265",
3
+ "version": "0.1.267",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",