@edifice.io/react 2.6.2-develop-integration-crna.20260823185851 → 2.6.2-develop-integration.20260824122250

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.
Files changed (73) hide show
  1. package/dist/components/Alert/Alert.js +1 -1
  2. package/dist/components/DatePicker/DatePicker.d.ts +0 -5
  3. package/dist/components/DatePicker/DatePicker.js +0 -2
  4. package/dist/components/Layout/Layout.js +3 -5
  5. package/dist/hooks/index.d.ts +1 -0
  6. package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
  7. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +12 -0
  8. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +56 -0
  9. package/dist/icons.js +338 -340
  10. package/dist/index.js +152 -146
  11. package/dist/modules/homepage/components/Favorites/Favorites.js +4 -7
  12. package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +1 -5
  13. package/dist/modules/homepage/components/HomeCard/HomeCard.js +2 -10
  14. package/dist/modules/homepage/components/LastInfos/LastInfosList.js +2 -2
  15. package/dist/modules/homepage/components/Notifications/NotificationItem.js +4 -5
  16. package/dist/modules/homepage/components/Notifications/NotificationList.d.ts +1 -7
  17. package/dist/modules/homepage/components/Notifications/NotificationList.js +3 -10
  18. package/dist/modules/homepage/components/Notifications/NotificationListContainer.js +1 -4
  19. package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.d.ts +1 -2
  20. package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.js +10 -14
  21. package/dist/modules/homepage/components/Notifications/components/NotificationItemResource.d.ts +1 -2
  22. package/dist/modules/homepage/components/Notifications/components/NotificationItemResource.js +2 -3
  23. package/dist/modules/homepage/components/Notifications/components/SystemNotificationItem.d.ts +1 -3
  24. package/dist/modules/homepage/components/Notifications/components/SystemNotificationItem.js +2 -3
  25. package/dist/modules/homepage/components/Notifications/components/UserNotificationItem.d.ts +1 -3
  26. package/dist/modules/homepage/components/Notifications/components/UserNotificationItem.js +2 -3
  27. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +7 -22
  28. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +13 -27
  29. package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.d.ts +1 -5
  30. package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +2 -22
  31. package/dist/modules/homepage/components/Notifications/services/api/index.d.ts +0 -2
  32. package/dist/modules/homepage/components/Notifications/services/api/notificationService.d.ts +0 -8
  33. package/dist/modules/homepage/components/Notifications/services/api/notificationService.js +0 -12
  34. package/dist/modules/homepage/components/Notifications/services/queries/notification.d.ts +1 -13
  35. package/dist/modules/homepage/components/Notifications/services/queries/notification.js +4 -41
  36. package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.js +11 -20
  37. package/dist/modules/homepage/components/UserSpace/UserSpace.js +2 -5
  38. package/dist/modules/icons/components/index.d.ts +0 -1
  39. package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
  40. package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +105 -0
  41. package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
  42. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
  43. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +20 -7
  44. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
  45. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +35 -0
  46. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +1 -0
  47. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +2 -0
  48. package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +24 -0
  49. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +109 -0
  50. package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
  51. package/dist/modules/multimedia/index.d.ts +1 -0
  52. package/dist/multimedia.js +16 -12
  53. package/package.json +6 -6
  54. package/dist/modules/homepage/components/Communities/Communities.d.ts +0 -10
  55. package/dist/modules/homepage/components/Communities/CommunitiesContainer.d.ts +0 -9
  56. package/dist/modules/homepage/components/Communities/CommunitiesSkeleton.d.ts +0 -5
  57. package/dist/modules/homepage/components/Communities/CommunityItem.d.ts +0 -11
  58. package/dist/modules/homepage/components/Communities/index.d.ts +0 -8
  59. package/dist/modules/homepage/components/Communities/useCommunities.d.ts +0 -13
  60. package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.d.ts +0 -16
  61. package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +0 -29
  62. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.d.ts +0 -18
  63. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +0 -67
  64. package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.d.ts +0 -12
  65. package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +0 -42
  66. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.d.ts +0 -13
  67. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +0 -31
  68. package/dist/modules/homepage/components/UserSpace/hooks/useChildren.d.ts +0 -14
  69. package/dist/modules/homepage/components/UserSpace/hooks/useChildren.js +0 -23
  70. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.d.ts +0 -8
  71. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +0 -65
  72. package/dist/modules/icons/components/IconClass.d.ts +0 -7
  73. package/dist/modules/icons/components/IconClass.js +0 -13
@@ -2,12 +2,11 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import AppIcon from "../../../../../components/AppIcon/AppIcon.js";
4
4
  const NotificationItemResource = ({
5
- appCode,
6
- appI18nKey
5
+ appCode
7
6
  }) => {
8
7
  const {
9
8
  t
10
- } = useTranslation(), appLabel = t(`${appI18nKey}`, {
9
+ } = useTranslation(), appLabel = t(`${appCode}`, {
11
10
  defaultValue: appCode
12
11
  }), appCssClass = `app-${appCode}`;
13
12
  return /* @__PURE__ */ jsxs("div", { className: `notification-item-resource ${appCssClass} bg-app-light`, children: [
@@ -1,8 +1,6 @@
1
- import { ReactNode } from 'react';
2
1
  import { SystemWebNotification } from './notificationAdapter';
3
2
  export type SystemNotificationItemProps = {
4
3
  notification: SystemWebNotification;
5
- menu?: ReactNode;
6
4
  };
7
5
  /**
8
6
  * Renders a system notification (no sender) using an app icon as the picture.
@@ -11,7 +9,7 @@ export type SystemNotificationItemProps = {
11
9
  * rather than this component directly.
12
10
  */
13
11
  declare const SystemNotificationItem: {
14
- ({ notification, menu, }: SystemNotificationItemProps): import("react/jsx-runtime").JSX.Element;
12
+ ({ notification, }: SystemNotificationItemProps): import("react/jsx-runtime").JSX.Element;
15
13
  displayName: string;
16
14
  };
17
15
  export default SystemNotificationItem;
@@ -3,8 +3,7 @@ import { useTranslation } from "react-i18next";
3
3
  import CommonNotificationItem from "./CommonNotificationItem.js";
4
4
  import AppIcon from "../../../../../components/AppIcon/AppIcon.js";
5
5
  const SystemNotificationItem = ({
6
- notification,
7
- menu
6
+ notification
8
7
  }) => {
9
8
  const {
10
9
  params,
@@ -14,7 +13,7 @@ const SystemNotificationItem = ({
14
13
  } = notification, {
15
14
  t
16
15
  } = useTranslation(), appName = t(params.appCode);
17
- return /* @__PURE__ */ jsx(CommonNotificationItem, { uri, message, date, menu, picture: /* @__PURE__ */ jsx("a", { href: uri, title: appName, "data-testid": "notification-item-app-icon", "aria-label": t("homepage.notifications.app-icon.placeholder"), children: /* @__PURE__ */ jsx(AppIcon, { app: params.appCode, size: "24", variant: "square", className: "notification-item-app-icon" }) }) });
16
+ return /* @__PURE__ */ jsx(CommonNotificationItem, { uri, message, date, picture: /* @__PURE__ */ jsx("a", { href: uri, title: appName, "data-testid": "notification-item-app-icon", "aria-label": t("homepage.notifications.app-icon.placeholder"), children: /* @__PURE__ */ jsx(AppIcon, { app: params.appCode, size: "24", variant: "square", className: "notification-item-app-icon" }) }) });
18
17
  };
19
18
  export {
20
19
  SystemNotificationItem as default
@@ -1,8 +1,6 @@
1
- import { ReactNode } from 'react';
2
1
  import { UserWebNotification } from './notificationAdapter';
3
2
  export type UserNotificationItemProps = {
4
3
  notification: UserWebNotification;
5
- menu?: ReactNode;
6
4
  };
7
5
  /**
8
6
  * Renders a user-triggered notification using the sender's avatar as the picture.
@@ -11,7 +9,7 @@ export type UserNotificationItemProps = {
11
9
  * — prefer using `Notification` at the top level rather than this component directly.
12
10
  */
13
11
  declare const UserNotificationItem: {
14
- ({ notification, menu, }: UserNotificationItemProps): import("react/jsx-runtime").JSX.Element;
12
+ ({ notification }: UserNotificationItemProps): import("react/jsx-runtime").JSX.Element;
15
13
  displayName: string;
16
14
  };
17
15
  export default UserNotificationItem;
@@ -5,8 +5,7 @@ import NotificationItemResource from "./NotificationItemResource.js";
5
5
  import useDirectory from "../../../../../hooks/useDirectory/useDirectory.js";
6
6
  import Avatar from "../../../../../components/Avatar/Avatar.js";
7
7
  const UserNotificationItem = ({
8
- notification,
9
- menu
8
+ notification
10
9
  }) => {
11
10
  const {
12
11
  getAvatarURL,
@@ -19,7 +18,7 @@ const UserNotificationItem = ({
19
18
  } = notification, {
20
19
  t
21
20
  } = useTranslation(), userName = t(params.username);
22
- return /* @__PURE__ */ jsx(CommonNotificationItem, { uri, message, date, menu, picture: /* @__PURE__ */ jsx("a", { href: getUserbookURL(params.userId, "user"), title: userName, "data-testid": "notification-item-avatar", children: /* @__PURE__ */ jsx(Avatar, { "aria-label": t("homepage.notifications.avatar.placeholder"), src: getAvatarURL(params.userId, "user"), alt: userName, variant: "circle", className: "notification-item-avatar" }) }), children: /* @__PURE__ */ jsx(NotificationItemResource, { appCode: params.appCode, appI18nKey: params.appI18nKey }) });
21
+ return /* @__PURE__ */ jsx(CommonNotificationItem, { uri, message, date, picture: /* @__PURE__ */ jsx("a", { href: getUserbookURL(params.userId, "user"), title: userName, "data-testid": "notification-item-avatar", children: /* @__PURE__ */ jsx(Avatar, { "aria-label": t("homepage.notifications.avatar.placeholder"), src: getAvatarURL(params.userId, "user"), alt: userName, variant: "circle", className: "notification-item-avatar" }) }), children: /* @__PURE__ */ jsx(NotificationItemResource, { appCode: params.appCode }) });
23
22
  };
24
23
  export {
25
24
  UserNotificationItem as default
@@ -1,21 +1,15 @@
1
1
  import { NotificationModel } from '@edifice.io/client';
2
- type NotificationType = 'system' | 'user';
3
- interface WebNotificationParamsBase {
4
- appCode: string;
5
- appI18nKey: string;
6
- }
7
- interface WebNotificationBase {
8
- type: NotificationType;
2
+ type WebNotificationBase = {
9
3
  id: string;
10
4
  uri?: string;
11
5
  message: string;
12
6
  date: Date;
13
- params: WebNotificationParamsBase;
14
- }
7
+ };
15
8
  /** Notification triggered by another user (e.g. shared a resource). */
16
9
  export type UserWebNotification = WebNotificationBase & {
17
10
  type: 'user';
18
- params: WebNotificationParamsBase & {
11
+ params: {
12
+ appCode: string;
19
13
  username: string;
20
14
  userId: string;
21
15
  };
@@ -23,20 +17,11 @@ export type UserWebNotification = WebNotificationBase & {
23
17
  /** Notification triggered by an application event (no sender). */
24
18
  export type SystemWebNotification = WebNotificationBase & {
25
19
  type: 'system';
20
+ params: {
21
+ appCode: string;
22
+ };
26
23
  };
27
24
  /** Discriminated union — narrow on `type` to get the specific variant. */
28
25
  export type WebNotification = UserWebNotification | SystemWebNotification;
29
- export declare const getAppCodeAndI18nKey: (appCode: string) => [string, string];
30
- /**
31
- * Transforms a raw `NotificationModel` (API shape) into a `WebNotification`
32
- * ready for rendering.
33
- *
34
- * Responsibilities:
35
- * - Determines the variant: **user** when a `sender` is present, **system** otherwise.
36
- * - Resolves the target URI from the model's `params` (handles both user and system naming conventions).
37
- * - Converts the MongoDB `$date` timestamp to a JS `Date`.
38
- * - Normalises the `type` field into a kebab-case `appCode` (e.g. `"BLOG_POST"` → `"blog-post"`).
39
- * - Strips anchor tags from the message, keeping only the inner text as `<strong>`.
40
- */
41
26
  export declare const notificationAdapter: (notification: NotificationModel) => WebNotification;
42
27
  export {};
@@ -1,41 +1,30 @@
1
- const resolveNotificationResourceUri = (params, type, appCode, eventType) => {
2
- if (appCode === "timeline" && eventType === "NOTIFY-REPORT")
3
- return "/admin";
1
+ const resolveNotificationResourceUri = (params, type) => {
4
2
  if (type === "user")
5
3
  return params.resourceUri || params.uri;
6
4
  for (const [key, value] of Object.entries(params))
7
5
  if (typeof value == "string" && value.length > 0 && key.endsWith("Uri") && key !== "profilUri" && key !== "resourceFolderUri")
8
6
  return value;
9
- }, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"), getAppCodeAndI18nKey = (appCode) => {
10
- appCode = appCode.toLowerCase();
11
- let appI18nKey = appCode;
12
- switch (appCode) {
7
+ }, parseNotificationMessage = (message) => message.replace(/<\/a>/gi, "</strong>").replace(/<a\b[^>]*>/gi, "<strong>"), getAppCode = (appCode) => {
8
+ switch (appCode = appCode.toLowerCase(), appCode) {
13
9
  case "collaborativewall":
14
- appCode = "collaborative-wall";
15
- break;
10
+ return "collaborative-wall";
16
11
  case "formulaire":
17
- appI18nKey = appCode = "forms";
18
- break;
12
+ return "forms";
19
13
  case "messagerie":
20
- appI18nKey = appCode = "conversation";
21
- break;
14
+ return "conversation";
22
15
  case "news":
23
- appI18nKey = appCode = "actualites";
24
- break;
16
+ return "actualites";
25
17
  case "homeworks":
26
- appCode = "cahier-de-texte";
27
- break;
18
+ return "cahier-de-texte";
28
19
  case "userbook_motto":
29
20
  case "userbook_mood":
30
21
  case "userbook_discovervisiblegroups":
31
- appCode = "userbook";
32
- break;
22
+ return "userbook";
33
23
  default:
34
- appI18nKey = appCode = appCode.replace(/_/g, "-");
24
+ return appCode.replace(/_/g, "-");
35
25
  }
36
- return [appCode, appI18nKey];
37
26
  }, notificationAdapter = (notification) => {
38
- const type = notification.sender ? "user" : "system", [appCode, appI18nKey] = getAppCodeAndI18nKey(notification.type), uri = resolveNotificationResourceUri(notification.params, type, appCode, notification["event-type"] || notification.eventType), date = new Date(notification.date.$date), message = parseNotificationMessage(notification.message), base = {
27
+ const type = notification.sender ? "user" : "system", uri = resolveNotificationResourceUri(notification.params, type), date = new Date(notification.date.$date), appCode = getAppCode(notification.type), message = parseNotificationMessage(notification.message), base = {
39
28
  id: notification._id,
40
29
  uri,
41
30
  message,
@@ -49,19 +38,16 @@ const resolveNotificationResourceUri = (params, type, appCode, eventType) => {
49
38
  // cannot be undefined if sender is present (user type)
50
39
  userId: notification.sender,
51
40
  // cannot be undefined if sender is present (user type)
52
- appCode,
53
- appI18nKey
41
+ appCode
54
42
  }
55
43
  } : {
56
44
  ...base,
57
45
  type: "system",
58
46
  params: {
59
- appCode,
60
- appI18nKey
47
+ appCode
61
48
  }
62
49
  };
63
50
  };
64
51
  export {
65
- getAppCodeAndI18nKey,
66
52
  notificationAdapter
67
53
  };
@@ -2,12 +2,8 @@ import { NotificationModel } from '@edifice.io/client';
2
2
  export interface UseNotificationListContainerReturn {
3
3
  /** Array of notifications */
4
4
  notifications: NotificationModel[] | undefined;
5
- /** Array of all notification types available */
5
+ /** Array of notification types */
6
6
  notificationTypes: string[] | undefined;
7
- /** Array of notification types currently selected as filter */
8
- selectedTypes: string[] | undefined;
9
- /** Callback to change the selected notification types filter */
10
- setSelectedTypes: (types: string[]) => void;
11
7
  /** Indicates if there are more notifications to load */
12
8
  hasNextPage: boolean | undefined;
13
9
  /** Callback to load the next page of notifications */
@@ -1,5 +1,4 @@
1
- import { useState, useEffect } from "react";
2
- import { useNotificationTypes, useTimelinePreference, useSaveTimelinePreference, useNotifications } from "../services/queries/notification.js";
1
+ import { useNotificationTypes, useNotifications } from "../services/queries/notification.js";
3
2
  const useNotificationListContainer = () => {
4
3
  const {
5
4
  data: notificationTypes,
@@ -7,34 +6,15 @@ const useNotificationListContainer = () => {
7
6
  isFetched: isFetchedTypes,
8
7
  error: errorTypes
9
8
  } = useNotificationTypes(), {
10
- data: preference,
11
- isFetched: isFetchedPreference
12
- } = useTimelinePreference(), {
13
- mutate: saveTimelinePreference
14
- } = useSaveTimelinePreference(), [selectedTypes, setSelectedTypesState] = useState();
15
- useEffect(() => {
16
- if (selectedTypes === void 0 && isFetchedTypes && isFetchedPreference) {
17
- const preferredTypes = preference == null ? void 0 : preference.type;
18
- setSelectedTypesState(preferredTypes && preferredTypes.length > 0 ? preferredTypes : notificationTypes ?? []);
19
- }
20
- }, [selectedTypes, isFetchedTypes, isFetchedPreference, preference, notificationTypes]);
21
- const setSelectedTypes = (types) => {
22
- setSelectedTypesState(types), saveTimelinePreference({
23
- ...preference,
24
- type: types
25
- });
26
- }, {
27
9
  data: notifications,
28
10
  hasNextPage,
29
11
  isLoading: isLoadingNotifications,
30
12
  error: errorNotifications,
31
13
  fetchNextPage
32
- } = useNotifications(selectedTypes ?? [], isFetchedTypes && !!selectedTypes);
14
+ } = useNotifications(notificationTypes ?? [], isFetchedTypes && !!notificationTypes);
33
15
  return {
34
16
  notifications,
35
17
  notificationTypes,
36
- selectedTypes,
37
- setSelectedTypes,
38
18
  hasNextPage,
39
19
  loadNextPage: () => fetchNextPage(),
40
20
  isLoading: isLoadingTypes || isLoadingNotifications,
@@ -1,6 +1,4 @@
1
1
  export declare const notificationService: {
2
2
  getNotifications(types: string[], page: number): Promise<import('@edifice.io/client').NotificationModel[]>;
3
3
  getNotificationTypes(): Promise<string[]>;
4
- reportNotification(id: string): Promise<any>;
5
- deleteNotification(id: string): Promise<any>;
6
4
  };
@@ -12,12 +12,4 @@ export declare const createNotificationService: (baseURL: string) => {
12
12
  */
13
13
  getNotifications(types: string[], page: number): Promise<NotificationModel[]>;
14
14
  getNotificationTypes(): Promise<string[]>;
15
- /**
16
- * Report a notification as inappropriate.
17
- */
18
- reportNotification(id: string): Promise<any>;
19
- /**
20
- * Delete a notification.
21
- */
22
- deleteNotification(id: string): Promise<any>;
23
15
  };
@@ -14,18 +14,6 @@ const createNotificationService = (baseURL) => ({
14
14
  },
15
15
  getNotificationTypes() {
16
16
  return odeServices.http().get(`${baseURL}/timeline/types`);
17
- },
18
- /**
19
- * Report a notification as inappropriate.
20
- */
21
- reportNotification(id) {
22
- return odeServices.http().put(`${baseURL}/timeline/${id}/report`);
23
- },
24
- /**
25
- * Delete a notification.
26
- */
27
- deleteNotification(id) {
28
- return odeServices.http().put(`${baseURL}/timeline/${id}`);
29
17
  }
30
18
  });
31
19
  export {
@@ -1,22 +1,14 @@
1
1
  import { NotificationModel } from '@edifice.io/client';
2
- import { InfiniteData } from '@tanstack/react-query';
3
- /** Shape of the `timeline` userbook preference (only `type` is read/written here). */
4
- export interface TimelinePreference {
5
- page?: number;
6
- type: string[];
7
- config?: Record<string, unknown>;
8
- }
9
2
  export declare const notificationQueryKeys: {
10
3
  all: () => readonly ["notifications"];
11
4
  notifications: (types?: string[]) => readonly ["notifications", "list", string[]];
12
5
  types: () => readonly ["notifications", "types"];
13
- preference: () => readonly ["notifications", "preference"];
14
6
  };
15
7
  export declare const notificationQueryOptions: {
16
8
  getNotifications(types: string[], enabled: boolean): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseInfiniteQueryOptions<NotificationModel[], Error, NotificationModel[], NotificationModel[], readonly ["notifications", "list", string[]], number>, "queryFn"> & {
17
9
  queryFn?: import('@tanstack/react-query').QueryFunction<NotificationModel[], readonly ["notifications", "list", string[]], number> | undefined;
18
10
  } & {
19
- queryKey: import('@tanstack/react-query').DataTag<readonly ["notifications", "list", string[]], InfiniteData<NotificationModel[], unknown>>;
11
+ queryKey: import('@tanstack/react-query').DataTag<readonly ["notifications", "list", string[]], import('@tanstack/react-query').InfiniteData<NotificationModel[], unknown>>;
20
12
  };
21
13
  getNotificationTypes(): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<string[], Error, string[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
22
14
  queryFn?: import('@tanstack/react-query').QueryFunction<string[], import('@tanstack/react-query').QueryKey, never> | undefined;
@@ -26,7 +18,3 @@ export declare const notificationQueryOptions: {
26
18
  };
27
19
  export declare const useNotifications: (types?: string[], enabled?: boolean) => import('@tanstack/react-query').UseInfiniteQueryResult<NotificationModel[], Error>;
28
20
  export declare const useNotificationTypes: () => import('@tanstack/react-query').UseQueryResult<string[], Error>;
29
- export declare const useTimelinePreference: () => import('@tanstack/react-query').UseQueryResult<TimelinePreference, Error>;
30
- export declare const useSaveTimelinePreference: () => import('@tanstack/react-query').UseMutationResult<void, Error, TimelinePreference, unknown>;
31
- export declare const useReportNotification: () => import('@tanstack/react-query').UseMutationResult<any, Error, string, unknown>;
32
- export declare const useDeleteNotification: () => import('@tanstack/react-query').UseMutationResult<any, Error, string, unknown>;
@@ -1,11 +1,9 @@
1
- import { odeServices } from "@edifice.io/client";
2
- import { useMutation, useQueryClient, useQuery, useInfiniteQuery, queryOptions, infiniteQueryOptions } from "@tanstack/react-query";
1
+ import { useQuery, useInfiniteQuery, queryOptions, infiniteQueryOptions } from "@tanstack/react-query";
3
2
  import { notificationService } from "../api/index.js";
4
3
  const notificationQueryKeys = {
5
4
  all: () => ["notifications"],
6
5
  notifications: (types = []) => [...notificationQueryKeys.all(), "list", types],
7
- types: () => [...notificationQueryKeys.all(), "types"],
8
- preference: () => [...notificationQueryKeys.all(), "preference"]
6
+ types: () => [...notificationQueryKeys.all(), "types"]
9
7
  }, notificationQueryOptions = {
10
8
  getNotifications(types, enabled) {
11
9
  return infiniteQueryOptions({
@@ -33,45 +31,10 @@ const notificationQueryKeys = {
33
31
  queryFn: async () => notificationService.getNotificationTypes()
34
32
  });
35
33
  }
36
- }, useNotifications = (types = [], enabled = !0) => useInfiniteQuery(notificationQueryOptions.getNotifications(types, enabled)), useNotificationTypes = () => useQuery(notificationQueryOptions.getNotificationTypes()), useTimelinePreference = () => useQuery({
37
- queryKey: notificationQueryKeys.preference(),
38
- queryFn: () => odeServices.conf().getPreference("timeline")
39
- }), useSaveTimelinePreference = () => {
40
- const queryClient = useQueryClient();
41
- return useMutation({
42
- mutationFn: (preference) => odeServices.conf().savePreference("timeline", preference),
43
- onSuccess: (_data, preference) => {
44
- queryClient.setQueryData(notificationQueryKeys.preference(), preference);
45
- },
46
- onError: () => {
47
- queryClient.invalidateQueries({
48
- queryKey: notificationQueryKeys.preference()
49
- });
50
- }
51
- });
52
- }, useReportNotification = () => useMutation({
53
- mutationFn: (id) => notificationService.reportNotification(id)
54
- }), useDeleteNotification = () => {
55
- const queryClient = useQueryClient();
56
- return useMutation({
57
- mutationFn: (id) => notificationService.deleteNotification(id),
58
- onSuccess: (_data, id) => {
59
- queryClient.setQueriesData({
60
- queryKey: [...notificationQueryKeys.all(), "list"]
61
- }, (data) => data && {
62
- ...data,
63
- pages: data.pages.map((page) => page.filter((notification) => notification._id !== id))
64
- });
65
- }
66
- });
67
- };
34
+ }, useNotifications = (types = [], enabled = !0) => useInfiniteQuery(notificationQueryOptions.getNotifications(types, enabled)), useNotificationTypes = () => useQuery(notificationQueryOptions.getNotificationTypes());
68
35
  export {
69
36
  notificationQueryKeys,
70
37
  notificationQueryOptions,
71
- useDeleteNotification,
72
38
  useNotificationTypes,
73
- useNotifications,
74
- useReportNotification,
75
- useSaveTimelinePreference,
76
- useTimelinePreference
39
+ useNotifications
77
40
  };
@@ -1,12 +1,10 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import SvgIconRafterUp from "../../../icons/components/IconRafterUp.js";
4
- import SvgIconUserSearch from "../../../icons/components/IconUserSearch.js";
5
4
  import useToggle from "../../../../hooks/useToggle/useToggle.js";
6
5
  import Flex from "../../../../components/Flex/Flex.js";
7
6
  import Dropdown from "../../../../components/Dropdown/Dropdown.js";
8
7
  import IconButton from "../../../../components/Button/IconButton.js";
9
- import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
10
8
  import { getRotateTransitionStyle } from "../../../../utilities/rotate-transition-style/get-rotate-transition-style.js";
11
9
  const SchoolSpace = ({
12
10
  schools,
@@ -15,23 +13,16 @@ const SchoolSpace = ({
15
13
  }) => {
16
14
  const [isExpanded, toggleExpanded] = useToggle(!1), {
17
15
  t
18
- } = useTranslation();
19
- if (!selectedSchool) return null;
20
- const hasManySchools = schools && schools.length > 1, directoryUrl = `/userbook/annuaire#/search?${new URLSearchParams({
21
- structure: selectedSchool.id
22
- }).toString()}`;
23
- return /* @__PURE__ */ jsxs(Flex, { gap: "4", direction: "column", className: "school-space", children: [
24
- /* @__PURE__ */ jsxs(Flex, { className: "school-space-container", justify: "center", gap: "4", align: "center", children: [
25
- /* @__PURE__ */ jsx("b", { children: selectedSchool.name }),
26
- hasManySchools && /* @__PURE__ */ jsx(Dropdown, { placement: "bottom-end", onToggle: toggleExpanded, children: (triggerProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
27
- /* @__PURE__ */ jsx(IconButton, { ...triggerProps, "aria-label": t("show"), color: "tertiary", variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconRafterUp, { className: "w-16 min-w-0", style: getRotateTransitionStyle(isExpanded, {
28
- degrees: 180
29
- }) }) }),
30
- /* @__PURE__ */ jsx(Dropdown.Menu, { children: schools.map((school) => /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onSelectedSchoolChange == null ? void 0 : onSelectedSchoolChange(school), children: /* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx("p", { children: school.name }) }) }, school.id)) })
31
- ] }) })
32
- ] }),
33
- /* @__PURE__ */ jsx(ButtonBeta, { variant: "outline", className: "school-space-directory-button", leftIcon: /* @__PURE__ */ jsx(SvgIconUserSearch, {}), onClick: () => window.location.href = directoryUrl, children: t("homepage.school-space.directory") })
34
- ] });
16
+ } = useTranslation(), hasManySchools = schools && schools.length > 1;
17
+ return selectedSchool ? /* @__PURE__ */ jsx("div", { className: "school-space", children: /* @__PURE__ */ jsxs(Flex, { className: "school-space-container", justify: "center", gap: "4", align: "center", children: [
18
+ /* @__PURE__ */ jsx("b", { children: selectedSchool.name }),
19
+ hasManySchools && /* @__PURE__ */ jsx(Dropdown, { placement: "bottom-end", onToggle: toggleExpanded, children: (triggerProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
20
+ /* @__PURE__ */ jsx(IconButton, { ...triggerProps, "aria-label": t("show"), color: "tertiary", variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconRafterUp, { className: "w-16 min-w-0", style: getRotateTransitionStyle(isExpanded, {
21
+ degrees: 180
22
+ }) }) }),
23
+ /* @__PURE__ */ jsx(Dropdown.Menu, { children: schools.map((school) => /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onSelectedSchoolChange == null ? void 0 : onSelectedSchoolChange(school), children: /* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx("p", { children: school.name }) }) }, school.id)) })
24
+ ] }) })
25
+ ] }) }) : null;
35
26
  };
36
27
  export {
37
28
  SchoolSpace as default
@@ -1,11 +1,8 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
- import SvgIconClass from "../../../icons/components/IconClass.js";
4
- import { useProfileLinks } from "./hooks/useProfileLinks.js";
5
3
  import HomeCard from "../HomeCard/HomeCard.js";
6
4
  import Flex from "../../../../components/Flex/Flex.js";
7
5
  import Avatar from "../../../../components/Avatar/Avatar.js";
8
- import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
9
6
  function UserSpace({
10
7
  name,
11
8
  avatar,
@@ -14,8 +11,8 @@ function UserSpace({
14
11
  }) {
15
12
  const {
16
13
  t
17
- } = useTranslation(), links = useProfileLinks(profile);
18
- return /* @__PURE__ */ jsxs(HomeCard, { variant: "user", footer: !!links && /* @__PURE__ */ jsx(Flex, { children: links.map((link, index) => /* @__PURE__ */ jsx(ButtonBeta, { size: "sm", variant: "ghost", leftIcon: /* @__PURE__ */ jsx(SvgIconClass, {}), onClick: () => window.location.href = link.url, children: link.text }, `${link.url}-${index}`)) }), children: [
14
+ } = useTranslation();
15
+ return /* @__PURE__ */ jsxs(HomeCard, { variant: "user", children: [
19
16
  /* @__PURE__ */ jsxs(Flex, { className: "user-space", direction: "row", gap: "8", children: [
20
17
  /* @__PURE__ */ jsx(Avatar, { className: "user-space--avatar", size: "auto", alt: name, src: avatar, variant: "circle" }),
21
18
  /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
@@ -30,7 +30,6 @@ export { default as IconCantoo } from './IconCantoo';
30
30
  export { default as IconCenter } from './IconCenter';
31
31
  export { default as IconCheck } from './IconCheck';
32
32
  export { default as IconChecklist } from './IconChecklist';
33
- export { default as IconClass } from './IconClass';
34
33
  export { default as IconClockAlert } from './IconClockAlert';
35
34
  export { default as IconClock } from './IconClock';
36
35
  export { default as IconCloseFullScreen } from './IconCloseFullScreen';
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { NextcloudDocument } from '@edifice.io/client';
3
+ import { CardProps } from '../../../components/Card';
4
+ export interface NextcloudFileCardProps extends CardProps {
5
+ doc: NextcloudDocument;
6
+ /**
7
+ * Id of the user who owns the Nextcloud document, used to build the preview URL.
8
+ */
9
+ userId: string;
10
+ /**
11
+ * Custom icon to override the default based on file type
12
+ * Can be a string or a React node
13
+ */
14
+ customIcon?: ReactNode;
15
+ /**
16
+ * Custom color class to override the default based on file type
17
+ * Example: "bg-purple-300" or any valid CSS class
18
+ */
19
+ customColor?: string;
20
+ }
21
+ declare const NextcloudFileCard: {
22
+ ({ doc, userId, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: NextcloudFileCardProps): import("react/jsx-runtime").JSX.Element;
23
+ displayName: string;
24
+ };
25
+ export default NextcloudFileCard;
@@ -0,0 +1,105 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import { DocumentHelper, odeServices } from "@edifice.io/client";
4
+ import clsx from "clsx";
5
+ import SvgIconLandscape from "../../icons/components/IconLandscape.js";
6
+ import SvgIconMic from "../../icons/components/IconMic.js";
7
+ import SvgIconTextPage from "../../icons/components/IconTextPage.js";
8
+ import SvgIconVideo from "../../icons/components/IconVideo.js";
9
+ import FileIcon from "./FileIcon.js";
10
+ import useThumbnail from "../../../hooks/useThumbnail/useThumbnail.js";
11
+ import Card from "../../../components/Card/Card.js";
12
+ const NextcloudFileCard = ({
13
+ doc,
14
+ userId,
15
+ isClickable = !0,
16
+ isSelectable = !1,
17
+ isSelected = !1,
18
+ onClick,
19
+ className,
20
+ onSelect,
21
+ isFocused,
22
+ app,
23
+ customIcon,
24
+ customColor
25
+ }) => {
26
+ const ref = useRef(null), type = DocumentHelper.role(doc.contentType, !1);
27
+ function getRoleMap(type2) {
28
+ if (customIcon !== void 0 || customColor !== void 0)
29
+ return {
30
+ icon: customIcon || /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
31
+ color: customColor || "bg-gray-300",
32
+ hasShadow: !1
33
+ };
34
+ const roleMappings = {
35
+ csv: {
36
+ icon: ".CSV",
37
+ color: "bg-orange-200"
38
+ },
39
+ xls: {
40
+ icon: ".XLS",
41
+ color: "bg-green-200"
42
+ },
43
+ doc: {
44
+ icon: ".DOC",
45
+ color: "bg-blue-200"
46
+ },
47
+ txt: {
48
+ icon: ".TXT",
49
+ color: "bg-blue-200"
50
+ },
51
+ pdf: {
52
+ icon: ".PDF",
53
+ color: "bg-red-200"
54
+ },
55
+ audio: {
56
+ icon: /* @__PURE__ */ jsx(SvgIconMic, { width: 22, height: 22 }),
57
+ color: "bg-red-200"
58
+ },
59
+ ppt: {
60
+ icon: ".PPT",
61
+ color: "bg-red-200"
62
+ },
63
+ img: {
64
+ icon: /* @__PURE__ */ jsx(SvgIconLandscape, { width: 22, height: 22 }),
65
+ color: "bg-green-200"
66
+ },
67
+ video: {
68
+ icon: /* @__PURE__ */ jsx(SvgIconVideo, { width: 22, height: 22 }),
69
+ color: "bg-purple-200"
70
+ },
71
+ zip: {
72
+ icon: ".ZIP",
73
+ color: "bg-gray-300"
74
+ },
75
+ md: {
76
+ icon: ".MD",
77
+ color: "bg-blue-200"
78
+ },
79
+ unknown: {
80
+ icon: /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
81
+ color: "bg-gray-300"
82
+ }
83
+ };
84
+ return roleMappings[type2] || roleMappings.unknown;
85
+ }
86
+ const roleMap = getRoleMap(type ?? "unknown"), file = clsx("file position-relative rounded", (roleMap == null ? void 0 : roleMap.color) ?? "bg-yellow-200"), mediaSrc = type === "img" ? odeServices.nextcloud().getFileUrl(userId, doc) : null, hasThumbnail = useThumbnail(mediaSrc, {
87
+ ref
88
+ }), imageStyles = hasThumbnail && {
89
+ backgroundImage: `url(${mediaSrc})`,
90
+ backgroundSize: "cover"
91
+ };
92
+ return /* @__PURE__ */ jsx(Card, { className: clsx("card-file", className), isClickable, isSelectable, isSelected, onClick, app, isFocused, onSelect, children: /* @__PURE__ */ jsxs(Card.Body, { space: "8", children: [
93
+ /* @__PURE__ */ jsx("div", { ref, className: file, style: {
94
+ aspectRatio: "16/10",
95
+ ...imageStyles
96
+ }, children: type !== "img" || type === "img" && !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap }) : null }),
97
+ /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
98
+ /* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
99
+ /* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.ownerDisplayName })
100
+ ] })
101
+ ] }) });
102
+ };
103
+ export {
104
+ NextcloudFileCard as default
105
+ };
@@ -1,2 +1,4 @@
1
1
  export { default as FileCard } from './FileCard';
2
2
  export * from './FileCard';
3
+ export { default as NextcloudFileCard } from './NextcloudFileCard';
4
+ export * from './NextcloudFileCard';