@edifice.io/react 2.6.2-develop-integration.20260824151812 → 2.6.2-develop-integration-crna.20260825121901

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 (88) hide show
  1. package/dist/components/Alert/Alert.js +1 -1
  2. package/dist/components/DatePicker/DatePicker.d.ts +5 -0
  3. package/dist/components/DatePicker/DatePicker.js +2 -0
  4. package/dist/components/Layout/Layout.js +5 -3
  5. package/dist/hooks/index.d.ts +0 -1
  6. package/dist/icons-apps.js +112 -100
  7. package/dist/icons.js +340 -338
  8. package/dist/index.js +146 -152
  9. package/dist/modules/homepage/components/Communities/Communities.d.ts +10 -0
  10. package/dist/modules/homepage/components/Communities/CommunitiesContainer.d.ts +9 -0
  11. package/dist/modules/homepage/components/Communities/CommunitiesSkeleton.d.ts +5 -0
  12. package/dist/modules/homepage/components/Communities/CommunityItem.d.ts +11 -0
  13. package/dist/modules/homepage/components/Communities/index.d.ts +8 -0
  14. package/dist/modules/homepage/components/Communities/useCommunities.d.ts +13 -0
  15. package/dist/modules/homepage/components/Favorites/Favorites.js +7 -4
  16. package/dist/modules/homepage/components/Header/Header.js +20 -2
  17. package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +5 -1
  18. package/dist/modules/homepage/components/HomeCard/HomeCard.js +10 -2
  19. package/dist/modules/homepage/components/LastInfos/LastInfosList.js +2 -2
  20. package/dist/modules/homepage/components/Notifications/NotificationItem.js +5 -4
  21. package/dist/modules/homepage/components/Notifications/NotificationList.d.ts +7 -1
  22. package/dist/modules/homepage/components/Notifications/NotificationList.js +10 -3
  23. package/dist/modules/homepage/components/Notifications/NotificationListContainer.js +4 -1
  24. package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.d.ts +2 -1
  25. package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.js +14 -10
  26. package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.d.ts +16 -0
  27. package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +29 -0
  28. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.d.ts +18 -0
  29. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +67 -0
  30. package/dist/modules/homepage/components/Notifications/components/NotificationItemResource.d.ts +2 -1
  31. package/dist/modules/homepage/components/Notifications/components/NotificationItemResource.js +3 -2
  32. package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.d.ts +12 -0
  33. package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +42 -0
  34. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.d.ts +13 -0
  35. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +31 -0
  36. package/dist/modules/homepage/components/Notifications/components/SystemNotificationItem.d.ts +3 -1
  37. package/dist/modules/homepage/components/Notifications/components/SystemNotificationItem.js +3 -2
  38. package/dist/modules/homepage/components/Notifications/components/UserNotificationItem.d.ts +3 -1
  39. package/dist/modules/homepage/components/Notifications/components/UserNotificationItem.js +3 -2
  40. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +22 -7
  41. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +31 -13
  42. package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.d.ts +11 -1
  43. package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +34 -2
  44. package/dist/modules/homepage/components/Notifications/services/api/index.d.ts +2 -0
  45. package/dist/modules/homepage/components/Notifications/services/api/notificationService.d.ts +8 -0
  46. package/dist/modules/homepage/components/Notifications/services/api/notificationService.js +12 -0
  47. package/dist/modules/homepage/components/Notifications/services/queries/notification.d.ts +13 -1
  48. package/dist/modules/homepage/components/Notifications/services/queries/notification.js +41 -4
  49. package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.js +20 -11
  50. package/dist/modules/homepage/components/UserSpace/UserSpace.js +5 -2
  51. package/dist/modules/homepage/components/UserSpace/hooks/useChildren.d.ts +14 -0
  52. package/dist/modules/homepage/components/UserSpace/hooks/useChildren.js +23 -0
  53. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.d.ts +8 -0
  54. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +65 -0
  55. package/dist/modules/icons/components/IconClass.d.ts +7 -0
  56. package/dist/modules/icons/components/IconClass.js +13 -0
  57. package/dist/modules/icons/components/apps/IconNextcloudDeck.d.ts +7 -0
  58. package/dist/modules/icons/components/apps/IconNextcloudDeck.js +14 -0
  59. package/dist/modules/icons/components/apps/IconNextcloudFiles.d.ts +7 -0
  60. package/dist/modules/icons/components/apps/IconNextcloudFiles.js +14 -0
  61. package/dist/modules/icons/components/apps/IconNextcloudForms.d.ts +7 -0
  62. package/dist/modules/icons/components/apps/IconNextcloudForms.js +14 -0
  63. package/dist/modules/icons/components/apps/IconNextcloudNotes.d.ts +7 -0
  64. package/dist/modules/icons/components/apps/IconNextcloudNotes.js +14 -0
  65. package/dist/modules/icons/components/apps/IconNextcloudTalk.d.ts +7 -0
  66. package/dist/modules/icons/components/apps/IconNextcloudTalk.js +14 -0
  67. package/dist/modules/icons/components/apps/IconPeertube.d.ts +7 -0
  68. package/dist/modules/icons/components/apps/IconPeertube.js +21 -0
  69. package/dist/modules/icons/components/apps/index.d.ts +6 -0
  70. package/dist/modules/icons/components/index.d.ts +1 -0
  71. package/dist/modules/multimedia/FileCard/index.d.ts +0 -2
  72. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
  73. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +7 -20
  74. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +0 -1
  75. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +0 -2
  76. package/dist/modules/multimedia/index.d.ts +0 -1
  77. package/dist/multimedia.js +12 -16
  78. package/package.json +6 -6
  79. package/dist/hooks/useNextcloudSearch/index.d.ts +0 -1
  80. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +0 -12
  81. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +0 -56
  82. package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +0 -25
  83. package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +0 -105
  84. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +0 -1
  85. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +0 -35
  86. package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +0 -24
  87. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +0 -109
  88. package/dist/modules/multimedia/Nextcloud/index.d.ts +0 -2
@@ -12,7 +12,6 @@ import SvgIconSmartphone from "../../icons/components/IconSmartphone.js";
12
12
  import { InnerTabs } from "./innertabs/index.js";
13
13
  import { MediaLibraryContext } from "./MediaLibraryContext.js";
14
14
  import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
15
- import usePublicConf from "../../../hooks/usePublicConf/usePublicConf.js";
16
15
  import useHttpErrorToast from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
17
16
  import Modal from "../../../components/Modal/Modal.js";
18
17
  import { Tabs } from "../../../components/Tabs/components/Tabs.js";
@@ -30,8 +29,6 @@ const orderedTabs = [
30
29
  // Filesystem browser + drag'n'drop of files
31
30
  "workspace",
32
31
  // Media browser
33
- "nextcloud",
34
- // Nextcloud media browser
35
32
  "video-embedder"
36
33
  // Link to a hosted video
37
34
  ], mediaLibraryTypes = {
@@ -73,7 +70,7 @@ const orderedTabs = [
73
70
  onCancel,
74
71
  onTabChange
75
72
  }, ref) => {
76
- var _a, _b;
73
+ var _a;
77
74
  const linkTabProps = useRef(), refModal = useRef(null);
78
75
  useImperativeHandle(ref, () => ({
79
76
  show,
@@ -84,9 +81,7 @@ const orderedTabs = [
84
81
  }));
85
82
  const {
86
83
  t
87
- } = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), nextcloudViewWorkflow = useHasWorkflow("fr.openent.nextcloud.controller.NextcloudController|view"), {
88
- data: workspacePublicConf
89
- } = usePublicConf("workspace"), enableNextcloudTab = ((_a = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _a.includes("nextcloud")) && nextcloudViewWorkflow, [type, setType] = useState(null);
84
+ } = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), [type, setType] = useState(null);
90
85
  useHttpErrorToast({
91
86
  active: !!type,
92
87
  isDismissible: !0,
@@ -101,14 +96,6 @@ const orderedTabs = [
101
96
  availableFor: ["audio", "video", "image", "attachment"],
102
97
  isEnable: null
103
98
  },
104
- nextcloud: {
105
- id: "nextcloud",
106
- icon: /* @__PURE__ */ jsx(SvgIconGlobe, {}),
107
- label: t("bbm.nextcloud"),
108
- content: /* @__PURE__ */ jsx(InnerTabs.Nextcloud, {}),
109
- availableFor: ["audio", "video", "image", "attachment"],
110
- isEnable: () => !!enableNextcloudTab
111
- },
112
99
  upload: {
113
100
  id: "upload",
114
101
  icon: /* @__PURE__ */ jsx(SvgIconSmartphone, {}),
@@ -190,17 +177,17 @@ const orderedTabs = [
190
177
  linkTabProps.current = props, "resourceId" in props || "appPrefix" in props || setDefaultTabId("external-link"), setType("hyperlink");
191
178
  };
192
179
  useEffect(() => {
193
- var _a2, _b2;
180
+ var _a2, _b;
194
181
  const typeKey = type || "none";
195
- !defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _b2.defaultTab);
182
+ !defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b = mediaLibraryTypes[typeKey]) == null ? void 0 : _b.defaultTab);
196
183
  }, [defaultTabId, type]);
197
- const modalHeader = t(((_b = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _b.title) ?? "bbm"), resetState = () => {
184
+ const modalHeader = t(((_a = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _a.title) ?? "bbm"), resetState = () => {
198
185
  linkTabProps.current = void 0, setResult(void 0), setResultCounter(void 0), setDefaultTabId(void 0), setPreSuccess(void 0), setDeletionsOnCancel([]);
199
186
  }, handleTabChange = (tab) => {
200
187
  onTabChange == null || onTabChange(tab, deletionsOnCancel), resetState();
201
- }, isWorkspaceElementArray = (result2) => Array.isArray(result2) && (result2.length === 0 || "eType" in result2[0]), handleOnSuccess = useCallback(() => {
188
+ }, handleOnSuccess = useCallback(() => {
202
189
  const triggerSuccess = async (result2) => {
203
- isWorkspaceElementArray(result2) && ["protected", "public"].findIndex((v) => v === visibility) >= 0 && (result2 = await odeServices.workspace().transferDocuments(result2, appCode ?? "media-library", visibility)), onSuccess(result2);
190
+ result2 instanceof Array && ["protected", "public"].findIndex((v) => v === visibility) >= 0 && (result2 = await odeServices.workspace().transferDocuments(result2, appCode ?? "media-library", visibility)), onSuccess(result2);
204
191
  };
205
192
  onSuccessAction ? onSuccessAction().then((result2) => {
206
193
  triggerSuccess(result2);
@@ -4,7 +4,6 @@ export declare const InnerTabs: {
4
4
  Upload: () => import("react/jsx-runtime").JSX.Element;
5
5
  ExternalLink: ({ link, multiNodeSelected, }: import('./ExternalLink').ExternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
6
6
  Workspace: () => import("react/jsx-runtime").JSX.Element;
7
- Nextcloud: () => import("react/jsx-runtime").JSX.Element;
8
7
  InternalLink: ({ target, resourceId, appPrefix, }: import('./InternalLink').InternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
9
8
  Iframe: () => import("react/jsx-runtime").JSX.Element;
10
9
  VideoEmbedder: () => import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,6 @@ import { Audio } from "./Audio.js";
2
2
  import { ExternalLink } from "./ExternalLink.js";
3
3
  import { Iframe } from "./Iframe.js";
4
4
  import { InternalLink } from "./InternalLink.js";
5
- import { Nextcloud } from "./Nextcloud.js";
6
5
  import { Upload } from "./Upload.js";
7
6
  import { Video } from "./Video.js";
8
7
  import { VideoEmbedder } from "./VideoEmbedder.js";
@@ -13,7 +12,6 @@ const InnerTabs = {
13
12
  Upload,
14
13
  ExternalLink,
15
14
  Workspace,
16
- Nextcloud,
17
15
  InternalLink,
18
16
  Iframe,
19
17
  VideoEmbedder
@@ -5,7 +5,6 @@ export * from './ImagePicker';
5
5
  export * from './FileCard';
6
6
  export * from './Linker';
7
7
  export * from './MediaLibrary';
8
- export * from './Nextcloud';
9
8
  export * from './UploadCard';
10
9
  export * from './VideoEmbed';
11
10
  export * from './VideoRecorder';
@@ -4,14 +4,12 @@ import { default as default4 } from "./modules/multimedia/FileCard/FileCard.js";
4
4
  import { default as default5 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
5
5
  import { default as default6 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
6
6
  import { default as default7 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
7
- import { default as default8 } from "./modules/multimedia/Nextcloud/Nextcloud.js";
8
- import { default as default9 } from "./modules/multimedia/FileCard/NextcloudFileCard.js";
9
- import { default as default10 } from "./modules/multimedia/UploadCard/UploadCard.js";
10
- import { default as default11 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
11
- import { default as default12 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
12
- import { default as default13 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
13
- import { default as default14 } from "./modules/multimedia/Workspace/Workspace.js";
14
- import { default as default15 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
7
+ import { default as default8 } from "./modules/multimedia/UploadCard/UploadCard.js";
8
+ import { default as default9 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
9
+ import { default as default10 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
10
+ import { default as default11 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
11
+ import { default as default12 } from "./modules/multimedia/Workspace/Workspace.js";
12
+ import { default as default13 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
15
13
  import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
16
14
  import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
17
15
  import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
@@ -24,13 +22,11 @@ export {
24
22
  default6 as ImagePicker,
25
23
  InternalLinker,
26
24
  default7 as MediaLibrary,
27
- default8 as Nextcloud,
28
- default9 as NextcloudFileCard,
29
25
  Upload,
30
- default10 as UploadCard,
31
- default11 as UploadFiles,
32
- default12 as VideoEmbed,
33
- default13 as VideoRecorder,
34
- default14 as Workspace,
35
- default15 as WorkspaceFolders
26
+ default8 as UploadCard,
27
+ default9 as UploadFiles,
28
+ default10 as VideoEmbed,
29
+ default11 as VideoRecorder,
30
+ default12 as Workspace,
31
+ default13 as WorkspaceFolders
36
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.6.2-develop-integration.20260824151812",
3
+ "version": "2.6.2-develop-integration-crna.20260825121901",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -140,9 +140,9 @@
140
140
  "swiper": "10.1.0",
141
141
  "ua-parser-js": "1.0.36",
142
142
  "zustand": "4.5.7",
143
- "@edifice.io/bootstrap": "2.6.2-develop-integration.20260824151812",
144
- "@edifice.io/tiptap-extensions": "2.6.2-develop-integration.20260824151812",
145
- "@edifice.io/utilities": "2.6.2-develop-integration.20260824151812"
143
+ "@edifice.io/bootstrap": "2.6.2-develop-integration-crna.20260825121901",
144
+ "@edifice.io/utilities": "2.6.2-develop-integration-crna.20260825121901",
145
+ "@edifice.io/tiptap-extensions": "2.6.2-develop-integration-crna.20260825121901"
146
146
  },
147
147
  "devDependencies": {
148
148
  "@babel/plugin-transform-react-pure-annotations": "7.27.1",
@@ -173,8 +173,8 @@
173
173
  "vite": "5.4.14",
174
174
  "vite-plugin-dts": "4.5.4",
175
175
  "vite-tsconfig-paths": "5.1.4",
176
- "@edifice.io/client": "2.6.2-develop-integration.20260824151812",
177
- "@edifice.io/config": "2.6.2-develop-integration.20260824151812"
176
+ "@edifice.io/client": "2.6.2-develop-integration-crna.20260825121901",
177
+ "@edifice.io/config": "2.6.2-develop-integration-crna.20260825121901"
178
178
  },
179
179
  "peerDependencies": {
180
180
  "@react-spring/web": "9.7.5",
@@ -1 +0,0 @@
1
- export { default as useNextcloudSearch } from './useNextcloudSearch';
@@ -1,12 +0,0 @@
1
- import { ID, NextcloudDocument } from '@edifice.io/client';
2
- import { TreeData } from '../../types';
3
- export type NextcloudFolderNode = TreeData & {
4
- files?: NextcloudDocument[];
5
- };
6
- export default function useNextcloudSearch(rootId: string, rootName: string, userId?: string): {
7
- root: NextcloudFolderNode;
8
- needsAuth: boolean;
9
- isCheckingAuth: boolean;
10
- refetchAuthStatus: () => void;
11
- loadContent: (folderId?: ID) => void;
12
- };
@@ -1,56 +0,0 @@
1
- import { useReducer, useCallback } from "react";
2
- import { odeServices } from "@edifice.io/client";
3
- import { useQueryClient, useQuery } from "@tanstack/react-query";
4
- import { findNodeById } from "../../components/TreeView/utilities/treeview.js";
5
- function useNextcloudSearch(rootId, rootName, userId) {
6
- var _a;
7
- function treeReducer(state, action) {
8
- switch (action.type) {
9
- case "update": {
10
- const node = findNodeById(state, action.folderId);
11
- return node && (node.children = action.subfolders.map((f) => ({
12
- id: f.path,
13
- name: f.name
14
- })), node.files = action.files), {
15
- ...state
16
- };
17
- }
18
- default:
19
- throw Error("[useNextcloudSearch] Unknown action type: " + action.type);
20
- }
21
- }
22
- const [root, dispatch] = useReducer(treeReducer, {
23
- id: rootId,
24
- name: rootName,
25
- section: !0
26
- }), queryClient = useQueryClient(), oauth2StatusQuery = useQuery({
27
- queryKey: ["nextcloud", "oauth2-status", userId],
28
- queryFn: () => odeServices.nextcloud().getOauth2Status(userId),
29
- enabled: !!userId
30
- }), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), loadContent = useCallback(async (folderId) => {
31
- if (!userId) return;
32
- const path = folderId === rootId ? void 0 : folderId, payload = await queryClient.fetchQuery({
33
- queryKey: ["nextcloud", "documents", userId, path ?? "/"],
34
- queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
35
- staleTime: 6e4
36
- }), subfolders = [], files = [], currentPath = path ?? "/";
37
- payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
38
- doc.isFolder ? subfolders.push(doc) : files.push(doc);
39
- }), dispatch({
40
- folderId,
41
- subfolders,
42
- files,
43
- type: "update"
44
- });
45
- }, [rootId, userId, queryClient]);
46
- return {
47
- root,
48
- needsAuth,
49
- isCheckingAuth: oauth2StatusQuery.isLoading,
50
- refetchAuthStatus: oauth2StatusQuery.refetch,
51
- loadContent
52
- };
53
- }
54
- export {
55
- useNextcloudSearch as default
56
- };
@@ -1,25 +0,0 @@
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;
@@ -1,105 +0,0 @@
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 +0,0 @@
1
- export declare const Nextcloud: () => import("react/jsx-runtime").JSX.Element;
@@ -1,35 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { odeServices } from "@edifice.io/client";
3
- import { useMediaLibraryContext } from "../MediaLibraryContext.js";
4
- import useUser from "../../../../hooks/useUser/useUser.js";
5
- import Nextcloud$1 from "../../Nextcloud/Nextcloud.js";
6
- const Nextcloud = () => {
7
- const {
8
- type,
9
- setResultCounter,
10
- setResult,
11
- setPreSuccess,
12
- multiple
13
- } = useMediaLibraryContext(), {
14
- user
15
- } = useUser();
16
- function getDocumentRoleFilter() {
17
- switch (type) {
18
- case "image":
19
- return "img";
20
- case "audio":
21
- return "audio";
22
- case "video":
23
- return "video";
24
- default:
25
- return null;
26
- }
27
- }
28
- function handleSelect(result) {
29
- setResultCounter(result.length), result.length ? (setResult(result), setPreSuccess(() => () => user != null && user.userId ? odeServices.nextcloud().copyDocumentToWorkspace(user.userId, result.map((doc) => doc.path)) : Promise.resolve([]))) : (setResult(), setPreSuccess(void 0));
30
- }
31
- return /* @__PURE__ */ jsx(Nextcloud$1, { roles: getDocumentRoleFilter(), onSelect: handleSelect, multiple, className: "border rounded overflow-y-auto" });
32
- };
33
- export {
34
- Nextcloud
35
- };
@@ -1,24 +0,0 @@
1
- import { NextcloudDocument, Role } from '@edifice.io/client';
2
- /**
3
- * Nextcloud component properties
4
- */
5
- export interface NextcloudProps {
6
- /**
7
- * Notify parent when media elements are successfully selected.
8
- */
9
- onSelect: (result: NextcloudDocument[]) => void;
10
- /**
11
- * Boolean to know if we can select 1 or many files.
12
- */
13
- multiple?: boolean | undefined;
14
- /**
15
- * Document roles to filter files by; null (default) shows all roles.
16
- */
17
- roles?: Role | Role[] | null;
18
- /**
19
- * Optional class for styling purpose
20
- */
21
- className?: string;
22
- }
23
- declare const Nextcloud: ({ onSelect, multiple, roles, className, }: NextcloudProps) => import("react/jsx-runtime").JSX.Element;
24
- export default Nextcloud;
@@ -1,109 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef, useState, useCallback, useEffect, useMemo } from "react";
3
- import { DocumentHelper } from "@edifice.io/client";
4
- import clsx from "clsx";
5
- import { useTranslation } from "react-i18next";
6
- import { findNodeById } from "../../../components/Tree/utilities/tree.js";
7
- import SvgIconSortAscendingLetters from "../../icons/components/IconSortAscendingLetters.js";
8
- import SvgIconSortDescendingLetters from "../../icons/components/IconSortDescendingLetters.js";
9
- import SvgIconSortTime from "../../icons/components/IconSortTime.js";
10
- import illuNoContentInFolder from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-no-content-in-folder.svg";
11
- import useUser from "../../../hooks/useUser/useUser.js";
12
- import useNextcloudSearch from "../../../hooks/useNextcloudSearch/useNextcloudSearch.js";
13
- import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
14
- import Flex from "../../../components/Flex/Flex.js";
15
- import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
16
- import Button from "../../../components/Button/Button.js";
17
- import { Grid } from "../../../components/Grid/Grid.js";
18
- import Tree from "../../../components/Tree/components/Tree.js";
19
- import SearchBar from "../../../components/SearchBar/SearchBar.js";
20
- import Dropdown from "../../../components/Dropdown/Dropdown.js";
21
- import NextcloudFileCard from "../FileCard/NextcloudFileCard.js";
22
- const ROOT_ID = "root";
23
- function compare(a, b) {
24
- return a ? b ? a.localeCompare(b) : 1 : -1;
25
- }
26
- const Nextcloud = ({
27
- onSelect,
28
- multiple = !0,
29
- roles,
30
- className
31
- }) => {
32
- const {
33
- t
34
- } = useTranslation(), {
35
- user
36
- } = useUser(), {
37
- root,
38
- needsAuth,
39
- isCheckingAuth,
40
- refetchAuthStatus,
41
- loadContent
42
- } = useNextcloudSearch(ROOT_ID, t("nextcloud"), user == null ? void 0 : user.userId), popupRef = useRef(null), [currentNodeId, setCurrentNodeId] = useState(ROOT_ID), treeRoot = root, currentNode = findNodeById(treeRoot, currentNodeId) ?? root, [searchTerm, setSearchTerm] = useState(null), [sortOrder, setSortOrder] = useState(["modified", "desc"]), [selectedDocuments, setSelectedDocuments] = useState([]), handleTreeItemChange = useCallback((nodeId) => {
43
- setCurrentNodeId(nodeId), loadContent(nodeId);
44
- }, [loadContent]);
45
- useEffect(() => {
46
- loadContent(ROOT_ID);
47
- }, [loadContent]);
48
- const documents = useMemo(() => {
49
- if (!currentNode.files) return;
50
- let list = [].concat(currentNode.files);
51
- searchTerm && (list = list.filter((f) => f.name.indexOf(searchTerm) >= 0)), roles && (list = list.filter((f) => {
52
- const role = DocumentHelper.role(f.contentType, !1);
53
- return typeof roles == "string" ? roles === role : Array.isArray(roles) ? roles.includes(role) : !1;
54
- }));
55
- const sortFunction = sortOrder[0] === "name" ? sortOrder[1] === "asc" ? (a, b) => compare(a.name, b.name) : (a, b) => compare(b.name, a.name) : (a, b) => compare(b.lastModified, a.lastModified);
56
- return list.sort(sortFunction);
57
- }, [root, currentNode, searchTerm, sortOrder, roles]), selectedPaths = useMemo(() => new Set(selectedDocuments.map((d) => d.path)), [selectedDocuments]), handleSearchChange = useCallback((e) => {
58
- setSearchTerm(e.target.value);
59
- }, [setSearchTerm]);
60
- function getSortOrderLabel() {
61
- return sortOrder[0] === "name" ? sortOrder[1] === "asc" ? t("sort.order.alpha.asc") : t("sort.order.alpha.desc") : t("sort.order.modify.desc");
62
- }
63
- function handleSelectDoc(doc) {
64
- let currentDocuments = [...selectedDocuments];
65
- multiple ? currentDocuments.includes(doc) ? currentDocuments = currentDocuments.filter((selectedDocument) => selectedDocument.path !== doc.path) : currentDocuments = [...currentDocuments, doc] : currentDocuments = [doc], setSelectedDocuments(currentDocuments), onSelect(currentDocuments);
66
- }
67
- const nextcloud = clsx("workspace flex-grow-1 gap-0", className), openLoginPopup = () => {
68
- popupRef.current = window.open(`${window.location.origin}/nextcloud/user/oauth2/init`, "", "popup, height=600, width=400");
69
- };
70
- return useEffect(() => {
71
- function handleMessage(event) {
72
- var _a;
73
- event.origin !== window.location.origin || ((_a = event.data) == null ? void 0 : _a.type) !== "nextcloud-connected" || (popupRef.current && !popupRef.current.closed && popupRef.current.close(), refetchAuthStatus());
74
- }
75
- return window.addEventListener("message", handleMessage), () => window.removeEventListener("message", handleMessage);
76
- }, [refetchAuthStatus]), isCheckingAuth ? /* @__PURE__ */ jsx(LoadingScreen, {}) : needsAuth ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "8", className: "h-full w-100", justify: "center", align: "center", children: [
77
- /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuNoContentInFolder }),
78
- /* @__PURE__ */ jsx(Button, { onClick: openLoginPopup, children: "Login to nextcloud" })
79
- ] }) : /* @__PURE__ */ jsxs(Grid, { className: nextcloud, children: [
80
- /* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "3", xl: "4", className: "workspace-folders p-12 pt-0 gap-12", children: /* @__PURE__ */ jsx("div", { style: {
81
- position: "sticky",
82
- top: 0,
83
- paddingTop: "1.2rem"
84
- }, children: /* @__PURE__ */ jsx(Tree, { nodes: treeRoot, selectedNodeId: currentNodeId, showIcon: !0, onTreeItemClick: handleTreeItemChange, onTreeItemUnfold: handleTreeItemChange }) }) }),
85
- /* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "5", xl: "8", children: /* @__PURE__ */ jsxs(Grid, { className: "flex-grow-1 gap-0", children: [
86
- /* @__PURE__ */ jsxs(Grid.Col, { sm: "4", md: "8", xl: "12", children: [
87
- /* @__PURE__ */ jsx("div", { className: "workspace-search px-16 py-8 ", children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, className: "gap-16", onChange: handleSearchChange }) }),
88
- /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center justify-content-end px-8 py-4", children: [
89
- /* @__PURE__ */ jsx("small", { className: "text-muted", children: t("workspace.search.order") }),
90
- /* @__PURE__ */ jsxs(Dropdown, { children: [
91
- /* @__PURE__ */ jsx(Dropdown.Trigger, { size: "sm", label: getSortOrderLabel(), variant: "ghost" }),
92
- /* @__PURE__ */ jsxs(Dropdown.Menu, { children: [
93
- /* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortTime, {}), onClick: () => setSortOrder(["modified", "desc"]), children: t("sort.order.modify.desc") }),
94
- /* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortAscendingLetters, {}), onClick: () => setSortOrder(["name", "asc"]), children: t("sort.order.alpha.asc") }),
95
- /* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortDescendingLetters, {}), onClick: () => setSortOrder(["name", "desc"]), children: t("sort.order.alpha.desc") })
96
- ] })
97
- ] })
98
- ] })
99
- ] }),
100
- /* @__PURE__ */ jsx(Grid.Col, { sm: "4", md: "8", xl: "12", className: "p-8 gap-8", children: documents ? documents.length !== 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-workspace", children: documents.map((doc) => {
101
- const isSelected = selectedPaths.has(doc.path);
102
- return /* @__PURE__ */ jsx(NextcloudFileCard, { doc, userId: user.userId, isSelected, onClick: () => handleSelectDoc(doc) }, doc.path);
103
- }) }) : /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuNoContentInFolder, size: 64, text: t("nextcloud.empty.docSpace") }) : /* @__PURE__ */ jsx(LoadingScreen, {}) })
104
- ] }) })
105
- ] });
106
- };
107
- export {
108
- Nextcloud as default
109
- };
@@ -1,2 +0,0 @@
1
- export { default as Nextcloud } from './Nextcloud';
2
- export * from './Nextcloud';