@tekkare/romulus 0.1.314 → 0.1.315

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.313",
7
+ "version": "0.1.314",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -2,8 +2,9 @@
2
2
  Panneau « Inbox » du rail, servi par le layer OIP (tuile Inbox).
3
3
 
4
4
  Reprend l'Inbox de l'accueil OIP Platform : les fichiers que Tekkare a
5
- partages avec les workspaces du lecteur et les vues que des collegues lui
6
- ont partagees, du plus recent au plus ancien. Une vue s'ouvre dans son app,
5
+ partages avec les workspaces du lecteur, et les vues et projets que des
6
+ collegues lui ont partages, du plus recent au plus ancien. Un projet s'ouvre
7
+ sur sa page dans l'app courante. Une vue s'ouvre dans son app,
7
8
  dans l'onglet courant si c'est celle-ci, sinon dans un nouvel onglet. Un
8
9
  fichier s'ouvre dans un apercu par-dessus l'ecran (OipDocumentPreview), sans
9
10
  quitter l'app : ses octets passent par /api/oip/inbox/files.
@@ -14,6 +15,7 @@
14
15
  -->
15
16
  <script setup lang="ts">
16
17
  import type { OipInboxItem } from "../../composables/useOipInbox";
18
+ import { PROJECTS_PATH } from "#oip-projects";
17
19
 
18
20
  // Passee par OipShell a tous les panneaux ; l'Inbox n'en depend pas.
19
21
  defineProps<{ appKey?: string; superAdmin?: boolean }>();
@@ -45,7 +47,11 @@ function hostOf(url?: string): string {
45
47
  }
46
48
  }
47
49
 
50
+ const localePath = useLocalePath();
51
+
52
+ /** Un projet s'ouvre sur sa page dans cette app ; une vue a son adresse. */
48
53
  function hrefOf(item: OipInboxItem): string {
54
+ if (item.kind === "project") return localePath(`${PROJECTS_PATH}/${encodeURIComponent(item.id)}`);
49
55
  return item.url ?? "";
50
56
  }
51
57
 
@@ -60,9 +66,11 @@ const previewOpen = computed({
60
66
  const fileBase = (item: OipInboxItem) => `/api/oip/inbox/files/${encodeURIComponent(item.id)}`;
61
67
 
62
68
  /** Une autre app (ou la plateforme) s'ouvre a cote : on ne quitte pas l'ecran en cours. */
63
- const isExternal = (href: string) => !!origin.value && !href.startsWith(origin.value);
69
+ // Un chemin relatif (page projet) reste dans l'app.
70
+ const isExternal = (href: string) => !!origin.value && !href.startsWith("/") && !href.startsWith(origin.value);
64
71
 
65
72
  function iconOf(item: OipInboxItem): string {
73
+ if (item.kind === "project") return "ph-folder-simple";
66
74
  if (item.kind === "view") return item.isTemplate ? "ph-sparkle" : "ph-bookmark-simple";
67
75
  const type = item.contentType ?? "";
68
76
  if (type.includes("pdf")) return "ph-file-pdf";
@@ -78,6 +86,12 @@ function subtitleOf(item: OipInboxItem): string {
78
86
  month: "short",
79
87
  year: "numeric",
80
88
  });
89
+ if (item.kind === "project") {
90
+ const who = item.ownerName
91
+ ? en.value ? `Project shared by ${item.ownerName}` : `Projet partagé par ${item.ownerName}`
92
+ : en.value ? "Shared project" : "Projet partagé";
93
+ return [who, date].join(" · ");
94
+ }
81
95
  if (item.kind === "file") {
82
96
  const who = en.value ? "Shared by Tekkare" : "Partagé par Tekkare";
83
97
  return [who, item.workspaceName, date].filter(Boolean).join(" · ");
@@ -97,8 +111,8 @@ function subtitleOf(item: OipInboxItem): string {
97
111
  <p class="inbox_intro">
98
112
  {{
99
113
  en
100
- ? "Files Tekkare shared with your workspaces and views your colleagues shared with you, in every OIP app."
101
- : "Les fichiers partagés par Tekkare avec vos workspaces et les vues que vos collègues vous ont partagées, dans toutes les apps OIP."
114
+ ? "Files Tekkare shared with your workspaces, and views and projects your colleagues shared with you, in every OIP app."
115
+ : "Les fichiers partagés par Tekkare avec vos workspaces, et les vues et projets que vos collègues vous ont partagés, dans toutes les apps OIP."
102
116
  }}
103
117
  </p>
104
118
 
@@ -113,10 +127,10 @@ function subtitleOf(item: OipInboxItem): string {
113
127
  <ul v-else-if="items.length" class="inbox_list">
114
128
  <li v-for="item in items" :key="`${item.kind}:${item.id}`">
115
129
  <component
116
- :is="item.kind === 'view' ? 'a' : 'button'"
130
+ :is="item.kind === 'file' ? 'button' : 'a'"
117
131
  class="inbox_row"
118
132
  v-bind="
119
- item.kind === 'view'
133
+ item.kind !== 'file'
120
134
  ? {
121
135
  href: hrefOf(item),
122
136
  target: isExternal(hrefOf(item)) ? '_blank' : undefined,
@@ -8,7 +8,7 @@
8
8
  * ou qu'on survole une ligne de l'accueil, et ne recule jamais.
9
9
  */
10
10
  export interface OipInboxItem {
11
- kind: "file" | "view";
11
+ kind: "file" | "view" | "project";
12
12
  id: string;
13
13
  title: string;
14
14
  date: string;
@@ -2,12 +2,12 @@ import type { H3Event } from "h3";
2
2
 
3
3
  // Inbox personnelle du lecteur, lue par la tuile Inbox du rail et par
4
4
  // l'accueil oip7 : les fichiers que Tekkare a partages avec ses workspaces
5
- // (share-platform) et les vues que des collegues lui ont partagees (Virtual
6
- // Lab). Le curseur « lu jusqu'a » vit dans la Virtual Lab (/me/inbox-cursor) :
5
+ // (share-platform), les vues et les projets que des collegues lui ont
6
+ // partages (Virtual Lab). Le curseur « lu jusqu'a » vit dans la Virtual Lab (/me/inbox-cursor) :
7
7
  // un seul pour toutes les apps, donc la meme pastille partout.
8
8
 
9
9
  export interface OipInboxItem {
10
- kind: "file" | "view";
10
+ kind: "file" | "view" | "project";
11
11
  id: string;
12
12
  title: string;
13
13
  /** Date du partage, pas de la creation : une vieille vue partagee aujourd'hui est une nouveaute. */
@@ -98,6 +98,34 @@ async function sharedViews(token: string, workspaceId?: string): Promise<OipInbo
98
98
  }
99
99
  }
100
100
 
101
+ /**
102
+ * Projets du workspace actif qu'un autre a partages avec le lecteur, dates de
103
+ * son entree dans le projet (`joinedAt`). Une Virtual Lab qui ne renvoie pas
104
+ * encore `joinedAt` ne fait sortir aucun projet plutot qu'un projet mal date.
105
+ */
106
+ async function sharedProjects(token: string, workspaceId?: string): Promise<OipInboxItem[]> {
107
+ try {
108
+ const [summary, list] = await Promise.all([
109
+ $fetch<{ user?: { userId?: string } }>(`${vlBase()}/me/summary`, { headers: oipVlHeaders(token) }),
110
+ $fetch<{ projects?: any[] }>(`${vlBase()}/projects`, { headers: oipVlHeaders(token, workspaceId) }),
111
+ ]);
112
+ const me = summary?.user?.userId;
113
+ if (!me) return [];
114
+ return (list?.projects ?? [])
115
+ .filter((project) => project.owner?.userId && project.owner.userId !== me && project.joinedAt)
116
+ .map<OipInboxItem>((project) => ({
117
+ kind: "project",
118
+ id: project.projectId,
119
+ title: project.title,
120
+ date: project.joinedAt,
121
+ ownerName: project.owner?.displayName || project.owner?.email || null,
122
+ }));
123
+ } catch (error: any) {
124
+ console.error(`[oip/inbox] /projects -> ${error?.response?.status ?? "?"}`);
125
+ return [];
126
+ }
127
+ }
128
+
101
129
  async function cursor(token: string): Promise<string | null> {
102
130
  try {
103
131
  const { seenUntil } = await $fetch<{ seenUntil: string | null }>(`${vlBase()}/me/inbox-cursor`, {
@@ -111,12 +139,13 @@ async function cursor(token: string): Promise<string | null> {
111
139
 
112
140
  export async function oipInbox(event: H3Event, workspaceId?: string) {
113
141
  const token = await requireOipSession(event);
114
- const [files, views, seenUntil] = await Promise.all([
142
+ const [files, views, projects, seenUntil] = await Promise.all([
115
143
  sharedFiles(token),
116
144
  sharedViews(token, workspaceId),
145
+ sharedProjects(token, workspaceId),
117
146
  cursor(token),
118
147
  ]);
119
- const items = [...files, ...views].sort((a, b) => b.date.localeCompare(a.date));
148
+ const items = [...files, ...views, ...projects].sort((a, b) => b.date.localeCompare(a.date));
120
149
  return { items, seenUntil };
121
150
  }
122
151
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.314",
3
+ "version": "0.1.315",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",