@edifice.io/react 2.6.9-develop.20261013171251 → 2.6.10
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/components/Tree/utilities/tree.js +21 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useBackground/useBackground.d.ts +1 -1
- package/dist/hooks/useCarbonioUnread/index.d.ts +1 -0
- package/dist/hooks/useCarbonioUnread/useCarbonioUnread.d.ts +5 -0
- package/dist/hooks/useCarbonioUnread/useCarbonioUnread.js +24 -0
- package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +14 -0
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +64 -0
- package/dist/index.js +160 -152
- package/dist/modules/homepage/components/Header/Header.js +10 -3
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +102 -0
- package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +36 -11
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +48 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +2 -0
- package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +24 -0
- package/dist/modules/multimedia/Nextcloud/Nextcloud.js +120 -0
- package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
- package/dist/modules/multimedia/Workspace/Workspace.js +8 -5
- package/dist/modules/multimedia/index.d.ts +1 -0
- package/dist/multimedia.js +16 -12
- package/package.json +6 -6
|
@@ -16,6 +16,25 @@ function findNodeById(data, id) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
function modifyNode(data, callback) {
|
|
20
|
+
return doModify(data, callback) || data;
|
|
21
|
+
}
|
|
22
|
+
function doModify(current, callback, parent) {
|
|
23
|
+
var _a;
|
|
24
|
+
const result = callback(current, parent);
|
|
25
|
+
if ((_a = result == null ? void 0 : result.children) != null && _a.length) {
|
|
26
|
+
const children = [];
|
|
27
|
+
for (const child of (result == null ? void 0 : result.children) || []) {
|
|
28
|
+
const res = doModify(child, callback, result);
|
|
29
|
+
res && children.push(res);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
...result,
|
|
33
|
+
children
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
19
38
|
function findPathById(tree, nodeId) {
|
|
20
39
|
let path = [];
|
|
21
40
|
function traverse(node, currentPath) {
|
|
@@ -40,5 +59,6 @@ function findPathById(tree, nodeId) {
|
|
|
40
59
|
}
|
|
41
60
|
export {
|
|
42
61
|
findNodeById,
|
|
43
|
-
findPathById
|
|
62
|
+
findPathById,
|
|
63
|
+
modifyNode
|
|
44
64
|
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './useBookmark';
|
|
|
3
3
|
export * from './useBreakpoint';
|
|
4
4
|
export * from './useBrowserInfo';
|
|
5
5
|
export * from './useCantoo';
|
|
6
|
+
export * from './useCarbonioUnread';
|
|
6
7
|
export * from './useCheckable';
|
|
7
8
|
export * from './useClickOutside';
|
|
8
9
|
export * from './useConversation';
|
|
@@ -23,6 +24,7 @@ export * from './useIsAdmlcOrAdmc';
|
|
|
23
24
|
export * from './useKeyPress';
|
|
24
25
|
export * from './useLibraryUrl';
|
|
25
26
|
export * from './useMediaLibrary';
|
|
27
|
+
export * from './useNextcloudSearch';
|
|
26
28
|
export * from './usePublicConf';
|
|
27
29
|
export * from './useScreeb';
|
|
28
30
|
export * from './useScrollToTop';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Background = 'default' | 'pink-200' | 'yellow-200' | 'orange-200' | 'blue-200' | 'green-200';
|
|
1
|
+
export type Background = 'default' | 'pink-200' | 'yellow-200' | 'orange-200' | 'blue-200' | 'green-200' | 'crna';
|
|
2
2
|
declare const _default: () => {
|
|
3
3
|
betaEnabled: boolean | undefined;
|
|
4
4
|
background: Background;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useCarbonioUnread } from './useCarbonioUnread';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { odeServices } from "@edifice.io/client";
|
|
2
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
|
+
import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
|
|
4
|
+
const CARBONIO_PREAUTH_WORKFLOW = "org.entcore.auth.controllers.CarbonioPreauthController|preauth", useCarbonioUnread = () => {
|
|
5
|
+
const hasCarbonioWorkflow = useHasWorkflow(CARBONIO_PREAUTH_WORKFLOW) || !1, {
|
|
6
|
+
data
|
|
7
|
+
} = useQuery({
|
|
8
|
+
queryKey: ["carbonio", "unread", "count"],
|
|
9
|
+
queryFn: () => odeServices.http().get("/auth/carbonio/unread", {
|
|
10
|
+
disableNotifications: !0
|
|
11
|
+
}),
|
|
12
|
+
enabled: hasCarbonioWorkflow,
|
|
13
|
+
staleTime: 5 * 60 * 1e3,
|
|
14
|
+
// Each call queries the Carbonio server: a failure means no badge, not another try.
|
|
15
|
+
retry: !1
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
hasCarbonioWorkflow,
|
|
19
|
+
unreadCount: (data == null ? void 0 : data.count) ?? 0
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
useCarbonioUnread as default
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useNextcloudSearch } from './useNextcloudSearch';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ID, NextcloudDocument } from '@edifice.io/client';
|
|
2
|
+
import { TreeItem } from '../../components/Tree/types';
|
|
3
|
+
export type NextcloudFolderNode = TreeItem & {
|
|
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
|
+
isAuthError: boolean;
|
|
11
|
+
refetchAuthStatus: () => void;
|
|
12
|
+
loadContent: (folderId?: ID) => void;
|
|
13
|
+
loadError: unknown;
|
|
14
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useState, useCallback } from "react";
|
|
2
|
+
import { odeServices } from "@edifice.io/client";
|
|
3
|
+
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
|
|
5
|
+
function useNextcloudSearch(rootId, rootName, userId) {
|
|
6
|
+
var _a;
|
|
7
|
+
const [root, setRoot] = useState({
|
|
8
|
+
id: rootId,
|
|
9
|
+
name: rootName,
|
|
10
|
+
section: !0
|
|
11
|
+
}), updateFolder = useCallback((folderId, subfolders, files) => {
|
|
12
|
+
setRoot((prev) => {
|
|
13
|
+
const node = findNodeById(prev, folderId);
|
|
14
|
+
if (!node) return prev;
|
|
15
|
+
const children = subfolders.map((f) => {
|
|
16
|
+
var _a2;
|
|
17
|
+
const existing = (_a2 = node.children) == null ? void 0 : _a2.find((c) => c.id === f.path);
|
|
18
|
+
return existing ? {
|
|
19
|
+
...existing,
|
|
20
|
+
name: f.name
|
|
21
|
+
} : {
|
|
22
|
+
id: f.path,
|
|
23
|
+
name: f.name
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
return modifyNode(prev, (n) => n.id === node.id ? {
|
|
27
|
+
...n,
|
|
28
|
+
children,
|
|
29
|
+
files
|
|
30
|
+
} : n);
|
|
31
|
+
});
|
|
32
|
+
}, []), queryClient = useQueryClient(), oauth2StatusQuery = useQuery({
|
|
33
|
+
queryKey: ["nextcloud", "oauth2-status", userId],
|
|
34
|
+
queryFn: () => odeServices.nextcloud().getOauth2Status(userId),
|
|
35
|
+
enabled: !!userId
|
|
36
|
+
}), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
|
|
37
|
+
if (!userId) return;
|
|
38
|
+
const path = folderId === rootId ? void 0 : folderId;
|
|
39
|
+
try {
|
|
40
|
+
const payload = await queryClient.fetchQuery({
|
|
41
|
+
queryKey: ["nextcloud", "documents", userId, path ?? "/"],
|
|
42
|
+
queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
|
|
43
|
+
staleTime: 6e4
|
|
44
|
+
}), subfolders = [], files = [], currentPath = path ?? "/";
|
|
45
|
+
payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
|
|
46
|
+
doc.isFolder ? subfolders.push(doc) : files.push(doc);
|
|
47
|
+
}), setLoadError(null), updateFolder(folderId, subfolders, files);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
setLoadError(error);
|
|
50
|
+
}
|
|
51
|
+
}, [rootId, userId, queryClient, updateFolder]);
|
|
52
|
+
return {
|
|
53
|
+
root,
|
|
54
|
+
needsAuth,
|
|
55
|
+
isCheckingAuth: oauth2StatusQuery.isLoading,
|
|
56
|
+
isAuthError: oauth2StatusQuery.isError,
|
|
57
|
+
refetchAuthStatus: oauth2StatusQuery.refetch,
|
|
58
|
+
loadContent,
|
|
59
|
+
loadError
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
useNextcloudSearch as default
|
|
64
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -46,80 +46,84 @@ import { default as default44 } from "./modules/multimedia/MediaLibrary/MediaLib
|
|
|
46
46
|
import { default as default45 } from "./components/MediaViewer/MediaViewer.js";
|
|
47
47
|
import { default as default46 } from "./components/Modal/Modal.js";
|
|
48
48
|
import { default as default47 } from "./components/ModalBeta/ModalBeta.js";
|
|
49
|
-
import { default as default48 } from "./modules/
|
|
50
|
-
import { default as default49 } from "./
|
|
51
|
-
import { default as default50 } from "./
|
|
52
|
-
import { default as default51
|
|
53
|
-
import { default as default52 } from "./
|
|
54
|
-
import { default as default53 } from "./components/
|
|
55
|
-
import { default as default54 } from "./
|
|
56
|
-
import { default as default55 } from "./components/
|
|
57
|
-
import { default as default56 } from "./components/
|
|
58
|
-
import { default as default57 } from "./components/
|
|
59
|
-
import { default as default58 } from "./components/
|
|
60
|
-
import { default as default59 } from "./components/
|
|
61
|
-
import { default as default60 } from "./
|
|
62
|
-
import { default as default61 } from "./
|
|
63
|
-
import { default as default62 } from "./modules/modals/ShareModal/
|
|
64
|
-
import { default as default63 } from "./
|
|
65
|
-
import { default as default64 } from "./
|
|
66
|
-
import { default as default65 } from "./components/
|
|
67
|
-
import { default as default66 } from "./components/
|
|
68
|
-
import { default as default67 } from "./components/
|
|
69
|
-
import { default as default68 } from "./components/
|
|
70
|
-
import { default as default69 } from "./components/
|
|
71
|
-
import { default as default70 } from "./components/
|
|
72
|
-
import { default as default71 } from "./components/
|
|
73
|
-
import { default as default72 } from "./components/
|
|
74
|
-
import { default as default73 } from "./
|
|
75
|
-
import { default as default74 } from "./
|
|
76
|
-
import { default as default75 } from "./modules/multimedia/
|
|
77
|
-
import { default as default76 } from "./modules/multimedia/
|
|
78
|
-
import { default as default77 } from "./
|
|
79
|
-
import { default as default78 } from "./modules/multimedia/
|
|
80
|
-
import { default as default79 } from "./
|
|
81
|
-
import { default as default80 } from "./
|
|
82
|
-
import { default as default81 } from "./
|
|
83
|
-
import { default as default82 } from "./hooks/
|
|
84
|
-
import { default as default83 } from "./hooks/
|
|
85
|
-
import { default as default84 } from "./hooks/
|
|
86
|
-
import { default as default85 } from "./hooks/
|
|
87
|
-
import { default as default86 } from "./hooks/
|
|
88
|
-
import { default as default87 } from "./hooks/
|
|
89
|
-
import { default as default88 } from "./hooks/
|
|
90
|
-
import { default as default89 } from "./hooks/
|
|
91
|
-
import { default as default90 } from "./hooks/
|
|
92
|
-
import { default as default91 } from "./hooks/
|
|
93
|
-
import { default as default92 } from "./hooks/
|
|
94
|
-
import { default as default93 } from "./hooks/
|
|
95
|
-
import { default as default94 } from "./hooks/
|
|
96
|
-
import { default as default95 } from "./hooks/
|
|
97
|
-
import { default as default96 } from "./hooks/
|
|
98
|
-
import { default as default97 } from "./hooks/
|
|
99
|
-
import { default as default98 } from "./hooks/
|
|
100
|
-
import { default as default99 } from "./hooks/
|
|
101
|
-
import { default as default100 } from "./hooks/
|
|
102
|
-
import { default as default101 } from "./hooks/
|
|
103
|
-
import { default as default102 } from "./hooks/
|
|
104
|
-
import { default as default103 } from "./hooks/
|
|
105
|
-
import { default as default104 } from "./hooks/
|
|
106
|
-
import { default as default105 } from "./
|
|
107
|
-
import { default as default106 } from "./hooks/
|
|
108
|
-
import { default as default107 } from "./hooks/
|
|
109
|
-
import { default as default108 } from "./hooks/
|
|
110
|
-
import { default as default109 } from "./hooks/
|
|
111
|
-
import { default as default110 } from "./hooks/
|
|
112
|
-
import { default as default111 } from "./hooks/
|
|
113
|
-
import { default as default112 } from "./
|
|
114
|
-
import { default as default113 } from "./hooks/
|
|
115
|
-
import { default as default114 } from "./hooks/
|
|
116
|
-
import { default as default115 } from "./hooks/
|
|
117
|
-
import { default as default116 } from "./hooks/
|
|
118
|
-
import { default as default117 } from "./hooks/
|
|
119
|
-
import {
|
|
120
|
-
import { default as default119 } from "./hooks/
|
|
121
|
-
import { default as default120 } from "./hooks/
|
|
122
|
-
import { default as default121 } from "./hooks/
|
|
49
|
+
import { default as default48 } from "./modules/multimedia/Nextcloud/Nextcloud.js";
|
|
50
|
+
import { default as default49 } from "./modules/multimedia/FileCard/NextcloudFileCard.js";
|
|
51
|
+
import { default as default50 } from "./modules/modals/OnboardingModal/OnboardingModal.js";
|
|
52
|
+
import { default as default51 } from "./components/PageLayout/PageLayout.js";
|
|
53
|
+
import { default as default52 } from "./components/PreventPropagation/PreventPropagation.js";
|
|
54
|
+
import { default as default53, Root } from "./components/PromotionCard/PromotionCard.js";
|
|
55
|
+
import { default as default54 } from "./modules/modals/PublishModal/PublishModal.js";
|
|
56
|
+
import { default as default55 } from "./components/Radio/Radio.js";
|
|
57
|
+
import { default as default56 } from "./components/RadioCard/RadioCard.js";
|
|
58
|
+
import { default as default57 } from "./components/RadioTile/RadioTile.js";
|
|
59
|
+
import { default as default58 } from "./components/SearchBar/SearchBar.js";
|
|
60
|
+
import { default as default59 } from "./components/Button/SearchButton.js";
|
|
61
|
+
import { default as default60 } from "./components/SegmentedControl/SegmentedControl.js";
|
|
62
|
+
import { default as default61 } from "./components/Select/Select.js";
|
|
63
|
+
import { default as default62 } from "./modules/modals/ShareModal/apps/ShareBlog.js";
|
|
64
|
+
import { default as default63 } from "./modules/modals/ShareModal/ShareModal.js";
|
|
65
|
+
import { default as default64 } from "./modules/modals/ShareModal/ShareResources.js";
|
|
66
|
+
import { default as default65 } from "./components/Tree/components/SortableTree.js";
|
|
67
|
+
import { default as default66 } from "./components/StackedGroup/StackedGroup.js";
|
|
68
|
+
import { default as default67 } from "./components/Stepper/Stepper.js";
|
|
69
|
+
import { default as default68 } from "./components/Switch/Switch.js";
|
|
70
|
+
import { default as default69 } from "./components/Table/components/Table.js";
|
|
71
|
+
import { default as default70 } from "./components/TextArea/TextArea.js";
|
|
72
|
+
import { default as default71 } from "./components/Skeleton/TextSkeleton.js";
|
|
73
|
+
import { default as default72 } from "./components/Tooltip/Tooltip.js";
|
|
74
|
+
import { default as default73 } from "./components/Tree/components/Tree.js";
|
|
75
|
+
import { default as default74 } from "./components/TreeView/TreeView.js";
|
|
76
|
+
import { default as default75 } from "./modules/multimedia/UploadCard/UploadCard.js";
|
|
77
|
+
import { default as default76 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
|
|
78
|
+
import { default as default77 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
|
|
79
|
+
import { default as default78 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
|
|
80
|
+
import { default as default79 } from "./components/VisuallyHidden/VisuallyHidden.js";
|
|
81
|
+
import { default as default80 } from "./modules/multimedia/Workspace/Workspace.js";
|
|
82
|
+
import { default as default81 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
|
|
83
|
+
import { default as default82 } from "./hooks/useBookmark/useBookmark.js";
|
|
84
|
+
import { default as default83 } from "./hooks/useBreakpoint/useBreakpoint.js";
|
|
85
|
+
import { default as default84 } from "./hooks/useBrowserInfo/useBrowserInfo.js";
|
|
86
|
+
import { default as default85 } from "./hooks/useCantoo/useCantoo.js";
|
|
87
|
+
import { default as default86 } from "./hooks/useCarbonioUnread/useCarbonioUnread.js";
|
|
88
|
+
import { default as default87 } from "./hooks/useClickOutside/useClickOutside.js";
|
|
89
|
+
import { default as default88 } from "./hooks/useConversation/useConversation.js";
|
|
90
|
+
import { default as default89 } from "./hooks/useDate/useDate.js";
|
|
91
|
+
import { default as default90 } from "./hooks/useDebounce/useDebounce.js";
|
|
92
|
+
import { default as default91 } from "./hooks/useDirectory/useDirectory.js";
|
|
93
|
+
import { default as default92 } from "./hooks/useDropdown/useDropdown.js";
|
|
94
|
+
import { default as default93 } from "./hooks/useDropzone/useDropzone.js";
|
|
95
|
+
import { default as default94 } from "./hooks/useEdificeIcons/useEdificeIcons.js";
|
|
96
|
+
import { default as default95 } from "./hooks/useHasWorkflow/useHasWorkflow.js";
|
|
97
|
+
import { default as default96 } from "./hooks/useHover/useHover.js";
|
|
98
|
+
import { default as default97 } from "./hooks/useHttpErrorToast/useHttpErrorToast.js";
|
|
99
|
+
import { default as default98 } from "./hooks/useImage/useImage.js";
|
|
100
|
+
import { default as default99 } from "./hooks/useInfiniteScroll/useInfiniteScroll.js";
|
|
101
|
+
import { default as default100 } from "./hooks/useIsAdmc/useIsAdmc.js";
|
|
102
|
+
import { default as default101 } from "./hooks/useIsAdml/useIsAdml.js";
|
|
103
|
+
import { default as default102 } from "./hooks/useIsAdmlcOrAdmc/useIsAdmlcOrAdmc.js";
|
|
104
|
+
import { default as default103 } from "./hooks/useKeyPress/useKeyPress.js";
|
|
105
|
+
import { default as default104 } from "./hooks/useLibraryUrl/useLibraryUrl.js";
|
|
106
|
+
import { default as default105 } from "./hooks/useMediaLibrary/useMediaLibrary.js";
|
|
107
|
+
import { default as default106 } from "./hooks/useNextcloudSearch/useNextcloudSearch.js";
|
|
108
|
+
import { default as default107 } from "./hooks/usePublicConf/usePublicConf.js";
|
|
109
|
+
import { default as default108 } from "./hooks/useScrollToTop/useScrollToTop.js";
|
|
110
|
+
import { default as default109 } from "./modules/modals/ShareModal/hooks/useShareMutation.js";
|
|
111
|
+
import { default as default110 } from "./hooks/useTitle/useTitle.js";
|
|
112
|
+
import { default as default111 } from "./hooks/useToast/useToast.js";
|
|
113
|
+
import { default as default112 } from "./hooks/useToggle/useToggle.js";
|
|
114
|
+
import { default as default113 } from "./hooks/useTrapFocus/useTrapFocus.js";
|
|
115
|
+
import { default as default114 } from "./hooks/useTrashedResource/useTrashedResource.js";
|
|
116
|
+
import { default as default115 } from "./hooks/useUiOverride/useUiOverride.js";
|
|
117
|
+
import { default as default116 } from "./modules/modals/ResourceModal/hooks/useUpdateMutation.js";
|
|
118
|
+
import { default as default117 } from "./hooks/useUpload/useUpload.js";
|
|
119
|
+
import { default as default118 } from "./hooks/useUploadFiles/useUploadFiles.js";
|
|
120
|
+
import { default as default119 } from "./hooks/useUser/useUser.js";
|
|
121
|
+
import { default as default120 } from "./hooks/useWorkspaceFile/useWorkspaceFile.js";
|
|
122
|
+
import { default as default121 } from "./hooks/useWorkspaceFolders/useWorkspaceFolders.js";
|
|
123
|
+
import { WORKSPACE_SHARED_FOLDER_ID, WORKSPACE_USER_FOLDER_ID, default as default122 } from "./hooks/useWorkspaceFolders/useWorkspaceFoldersTree.js";
|
|
124
|
+
import { default as default123 } from "./hooks/useWorkspaceSearch/useWorkspaceSearch.js";
|
|
125
|
+
import { default as default124 } from "./hooks/useXitiTrackPageLoad/useXitiTrackPageLoad.js";
|
|
126
|
+
import { default as default125 } from "./hooks/useZendeskGuide/useZendeskGuide.js";
|
|
123
127
|
import { AccessiblePalette, DefaultPalette } from "./components/ColorPicker/ColorPalette.js";
|
|
124
128
|
import { AntProvider } from "./providers/AntThemeProvider/AntProvider.js";
|
|
125
129
|
import { BetaSwitch } from "./components/BetaSwitch/BetaSwitch.js";
|
|
@@ -155,7 +159,7 @@ import { emptyScreenMapping } from "./utilities/emptyscreen-mapping/emptyscreen-
|
|
|
155
159
|
import { getRotateTransitionStyle } from "./utilities/rotate-transition-style/get-rotate-transition-style.js";
|
|
156
160
|
import { invalidateQueriesWithFirstPage } from "./utilities/react-query/react-query-utils.js";
|
|
157
161
|
import { mergeRefs, setRef } from "./utilities/refs/ref.js";
|
|
158
|
-
import { default as
|
|
162
|
+
import { default as default126 } from "./hooks/useBackground/useBackground.js";
|
|
159
163
|
import { useCheckable } from "./hooks/useCheckable/useCheckable.js";
|
|
160
164
|
import { useEdificeClient } from "./providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
161
165
|
import { useEdificeTheme } from "./providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
@@ -164,7 +168,7 @@ import { useOverlay } from "./components/PageLayout/hook/useOverlay.js";
|
|
|
164
168
|
import { useScreeb } from "./hooks/useScreeb/useScreeb.js";
|
|
165
169
|
import { useTreeSortable } from "./components/Tree/hooks/useTreeSortable.js";
|
|
166
170
|
import { useTreeView } from "./components/TreeView/hooks/useTreeView.js";
|
|
167
|
-
import { default as
|
|
171
|
+
import { default as default127 } from "./hooks/useUserPreferences/useUserPreferences.js";
|
|
168
172
|
export {
|
|
169
173
|
AccessiblePalette,
|
|
170
174
|
default2 as ActionBar,
|
|
@@ -232,56 +236,58 @@ export {
|
|
|
232
236
|
MockedProvider,
|
|
233
237
|
default46 as Modal,
|
|
234
238
|
default47 as ModalBeta,
|
|
235
|
-
default48 as
|
|
236
|
-
default49 as
|
|
239
|
+
default48 as Nextcloud,
|
|
240
|
+
default49 as NextcloudFileCard,
|
|
241
|
+
default50 as OnboardingModal,
|
|
242
|
+
default51 as PageLayout,
|
|
237
243
|
PageLayoutContext,
|
|
238
244
|
Pagination,
|
|
239
245
|
Popover,
|
|
240
246
|
PopoverBody,
|
|
241
247
|
PopoverFooter,
|
|
242
248
|
PopoverHeader,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
+
default52 as PreventPropagation,
|
|
250
|
+
default53 as PromotionCard,
|
|
251
|
+
default54 as PublishModal,
|
|
252
|
+
default55 as Radio,
|
|
253
|
+
default56 as RadioCard,
|
|
254
|
+
default57 as RadioTile,
|
|
249
255
|
ResourceModal,
|
|
250
256
|
Root,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
257
|
+
default58 as SearchBar,
|
|
258
|
+
default59 as SearchButton,
|
|
259
|
+
default60 as SegmentedControl,
|
|
260
|
+
default61 as Select,
|
|
261
|
+
default62 as ShareBlog,
|
|
262
|
+
default63 as ShareModal,
|
|
263
|
+
default64 as ShareResources,
|
|
264
|
+
default65 as SortableTree,
|
|
265
|
+
default66 as StackedGroup,
|
|
266
|
+
default67 as Stepper,
|
|
267
|
+
default68 as Switch,
|
|
268
|
+
default69 as Table,
|
|
263
269
|
Tabs,
|
|
264
|
-
|
|
265
|
-
|
|
270
|
+
default70 as TextArea,
|
|
271
|
+
default71 as TextSkeleton,
|
|
266
272
|
Toolbar,
|
|
267
|
-
|
|
268
|
-
|
|
273
|
+
default72 as Tooltip,
|
|
274
|
+
default73 as Tree,
|
|
269
275
|
TreeNode,
|
|
270
276
|
TreeNodeFolderWrapper,
|
|
271
|
-
|
|
277
|
+
default74 as TreeView,
|
|
272
278
|
Upload,
|
|
273
|
-
|
|
274
|
-
|
|
279
|
+
default75 as UploadCard,
|
|
280
|
+
default76 as UploadFiles,
|
|
275
281
|
UserRightsList,
|
|
276
282
|
UserSearch,
|
|
277
|
-
|
|
278
|
-
|
|
283
|
+
default77 as VideoEmbed,
|
|
284
|
+
default78 as VideoRecorder,
|
|
279
285
|
VisibleType,
|
|
280
|
-
|
|
286
|
+
default79 as VisuallyHidden,
|
|
281
287
|
WORKSPACE_SHARED_FOLDER_ID,
|
|
282
288
|
WORKSPACE_USER_FOLDER_ID,
|
|
283
|
-
|
|
284
|
-
|
|
289
|
+
default80 as Workspace,
|
|
290
|
+
default81 as WorkspaceFolders,
|
|
285
291
|
addNode,
|
|
286
292
|
arrayUnique,
|
|
287
293
|
buildTree,
|
|
@@ -312,59 +318,61 @@ export {
|
|
|
312
318
|
setRef,
|
|
313
319
|
updateNode,
|
|
314
320
|
updateParentIds,
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
321
|
+
default126 as useBackground,
|
|
322
|
+
default82 as useBookmark,
|
|
323
|
+
default83 as useBreakpoint,
|
|
324
|
+
default84 as useBrowserInfo,
|
|
325
|
+
default85 as useCantoo,
|
|
326
|
+
default86 as useCarbonioUnread,
|
|
320
327
|
useCheckable,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
+
default87 as useClickOutside,
|
|
329
|
+
default88 as useConversation,
|
|
330
|
+
default89 as useDate,
|
|
331
|
+
default90 as useDebounce,
|
|
332
|
+
default91 as useDirectory,
|
|
333
|
+
default92 as useDropdown,
|
|
334
|
+
default93 as useDropzone,
|
|
328
335
|
useDropzoneContext,
|
|
329
336
|
useEdificeClient,
|
|
330
|
-
|
|
337
|
+
default94 as useEdificeIcons,
|
|
331
338
|
useEdificeTheme,
|
|
332
339
|
useFileToAttachment,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
340
|
+
default95 as useHasWorkflow,
|
|
341
|
+
default96 as useHover,
|
|
342
|
+
default97 as useHttpErrorToast,
|
|
343
|
+
default98 as useImage,
|
|
344
|
+
default99 as useInfiniteScroll,
|
|
345
|
+
default100 as useIsAdmc,
|
|
346
|
+
default101 as useIsAdml,
|
|
347
|
+
default102 as useIsAdmlcOrAdmc,
|
|
348
|
+
default103 as useKeyPress,
|
|
349
|
+
default104 as useLibraryUrl,
|
|
350
|
+
default105 as useMediaLibrary,
|
|
351
|
+
default106 as useNextcloudSearch,
|
|
344
352
|
useOverlay,
|
|
345
353
|
usePageLayout,
|
|
346
|
-
|
|
354
|
+
default107 as usePublicConf,
|
|
347
355
|
useScreeb,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
356
|
+
default108 as useScrollToTop,
|
|
357
|
+
default109 as useShareMutation,
|
|
358
|
+
default110 as useTitle,
|
|
359
|
+
default111 as useToast,
|
|
360
|
+
default112 as useToggle,
|
|
361
|
+
default113 as useTrapFocus,
|
|
362
|
+
default114 as useTrashedResource,
|
|
355
363
|
useTreeSortable,
|
|
356
364
|
useTreeView,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
365
|
+
default115 as useUiOverride,
|
|
366
|
+
default116 as useUpdateMutation,
|
|
367
|
+
default117 as useUpload,
|
|
368
|
+
default118 as useUploadFiles,
|
|
369
|
+
default119 as useUser,
|
|
370
|
+
default127 as useUserPreferences,
|
|
371
|
+
default120 as useWorkspaceFile,
|
|
372
|
+
default121 as useWorkspaceFolders,
|
|
373
|
+
default122 as useWorkspaceFoldersTree,
|
|
374
|
+
default123 as useWorkspaceSearch,
|
|
375
|
+
default124 as useXitiTrackPageLoad,
|
|
376
|
+
default125 as useZendeskGuide,
|
|
369
377
|
wrapTreeNode
|
|
370
378
|
};
|
|
@@ -16,7 +16,7 @@ import SvgIconNotificationBeta from "../../../icons/components/nav/IconNotificat
|
|
|
16
16
|
import { useHasNotificationToday } from "../Notifications/hooks/useNotificationList.js";
|
|
17
17
|
import useConversation from "../../../../hooks/useConversation/useConversation.js";
|
|
18
18
|
import useUser from "../../../../hooks/useUser/useUser.js";
|
|
19
|
-
import
|
|
19
|
+
import useCarbonioUnread from "../../../../hooks/useCarbonioUnread/useCarbonioUnread.js";
|
|
20
20
|
import { useEdificeTheme } from "../../../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
21
21
|
import useHover from "../../../../hooks/useHover/useHover.js";
|
|
22
22
|
import LogoBeta from "../../../../components/LogoBeta/LogoBeta.js";
|
|
@@ -37,7 +37,10 @@ const Header = ({
|
|
|
37
37
|
} = useConversation(), {
|
|
38
38
|
user,
|
|
39
39
|
avatar
|
|
40
|
-
} = useUser(),
|
|
40
|
+
} = useUser(), {
|
|
41
|
+
hasCarbonioWorkflow,
|
|
42
|
+
unreadCount: carbonioUnreadCount
|
|
43
|
+
} = useCarbonioUnread(), classes = clsx("header-beta d-print-none no-2d no-1d"), {
|
|
41
44
|
userAvatar,
|
|
42
45
|
userName,
|
|
43
46
|
communitiesWorkflow,
|
|
@@ -62,8 +65,12 @@ const Header = ({
|
|
|
62
65
|
level: "danger"
|
|
63
66
|
}, className: "position-absolute", children: messages })
|
|
64
67
|
] }) }),
|
|
65
|
-
|
|
68
|
+
hasCarbonioWorkflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsxs("a", { className: "nav-link position-relative", href: "/auth/carbonio/preauth", target: "_blank", "data-testid": "header-messagerie-button", children: [
|
|
66
69
|
/* @__PURE__ */ jsx(SvgIconMessagesBeta, {}),
|
|
70
|
+
carbonioUnreadCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: {
|
|
71
|
+
type: "notification",
|
|
72
|
+
level: "danger"
|
|
73
|
+
}, className: "position-absolute", children: carbonioUnreadCount }),
|
|
67
74
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: t("conversation") })
|
|
68
75
|
] }) }),
|
|
69
76
|
/* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(NavLink, { link: "/welcome", translate: t("navbar.applications"), "data-testid": "header-my-apps-button", children: /* @__PURE__ */ jsx(SvgIconMyAppsBeta, {}) }) }),
|
|
@@ -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,102 @@
|
|
|
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 roleMappings = {
|
|
13
|
+
csv: {
|
|
14
|
+
icon: ".CSV",
|
|
15
|
+
color: "bg-orange-200"
|
|
16
|
+
},
|
|
17
|
+
xls: {
|
|
18
|
+
icon: ".XLS",
|
|
19
|
+
color: "bg-green-200"
|
|
20
|
+
},
|
|
21
|
+
doc: {
|
|
22
|
+
icon: ".DOC",
|
|
23
|
+
color: "bg-blue-200"
|
|
24
|
+
},
|
|
25
|
+
txt: {
|
|
26
|
+
icon: ".TXT",
|
|
27
|
+
color: "bg-blue-200"
|
|
28
|
+
},
|
|
29
|
+
pdf: {
|
|
30
|
+
icon: ".PDF",
|
|
31
|
+
color: "bg-red-200"
|
|
32
|
+
},
|
|
33
|
+
audio: {
|
|
34
|
+
icon: /* @__PURE__ */ jsx(SvgIconMic, { width: 22, height: 22 }),
|
|
35
|
+
color: "bg-red-200"
|
|
36
|
+
},
|
|
37
|
+
ppt: {
|
|
38
|
+
icon: ".PPT",
|
|
39
|
+
color: "bg-red-200"
|
|
40
|
+
},
|
|
41
|
+
img: {
|
|
42
|
+
icon: /* @__PURE__ */ jsx(SvgIconLandscape, { width: 22, height: 22 }),
|
|
43
|
+
color: "bg-green-200"
|
|
44
|
+
},
|
|
45
|
+
video: {
|
|
46
|
+
icon: /* @__PURE__ */ jsx(SvgIconVideo, { width: 22, height: 22 }),
|
|
47
|
+
color: "bg-purple-200"
|
|
48
|
+
},
|
|
49
|
+
zip: {
|
|
50
|
+
icon: ".ZIP",
|
|
51
|
+
color: "bg-gray-300"
|
|
52
|
+
},
|
|
53
|
+
md: {
|
|
54
|
+
icon: ".MD",
|
|
55
|
+
color: "bg-blue-200"
|
|
56
|
+
},
|
|
57
|
+
unknown: {
|
|
58
|
+
icon: /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
|
|
59
|
+
color: "bg-gray-300"
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
function getRoleMap(type, customIcon, customColor) {
|
|
63
|
+
return customIcon !== void 0 || customColor !== void 0 ? {
|
|
64
|
+
icon: customIcon || /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
|
|
65
|
+
color: customColor || "bg-gray-300",
|
|
66
|
+
hasShadow: !1
|
|
67
|
+
} : roleMappings[type] ?? roleMappings.unknown;
|
|
68
|
+
}
|
|
69
|
+
const NextcloudFileCard = ({
|
|
70
|
+
doc,
|
|
71
|
+
userId,
|
|
72
|
+
isClickable = !0,
|
|
73
|
+
isSelectable = !1,
|
|
74
|
+
isSelected = !1,
|
|
75
|
+
onClick,
|
|
76
|
+
className,
|
|
77
|
+
onSelect,
|
|
78
|
+
isFocused,
|
|
79
|
+
app,
|
|
80
|
+
customIcon,
|
|
81
|
+
customColor
|
|
82
|
+
}) => {
|
|
83
|
+
const ref = useRef(null), type = DocumentHelper.role(doc.contentType, !1), roleMap = getRoleMap(type ?? "unknown", customIcon, customColor), 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, {
|
|
84
|
+
ref
|
|
85
|
+
}), imageStyles = hasThumbnail && {
|
|
86
|
+
backgroundImage: `url(${mediaSrc})`,
|
|
87
|
+
backgroundSize: "cover"
|
|
88
|
+
};
|
|
89
|
+
return /* @__PURE__ */ jsx(Card, { className: clsx("card-file", className), isClickable, isSelectable, isSelected, onClick, app, isFocused, onSelect, children: /* @__PURE__ */ jsxs(Card.Body, { space: "8", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("div", { ref, className: file, style: {
|
|
91
|
+
aspectRatio: "16/10",
|
|
92
|
+
...imageStyles
|
|
93
|
+
}, children: type !== "img" || !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap }) : null }),
|
|
94
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
|
|
95
|
+
/* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
|
|
96
|
+
/* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.ownerDisplayName })
|
|
97
|
+
] })
|
|
98
|
+
] }) });
|
|
99
|
+
};
|
|
100
|
+
export {
|
|
101
|
+
NextcloudFileCard as default
|
|
102
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
|
|
1
|
+
import { NextcloudDocument, WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
|
|
2
2
|
import { TabsItemProps } from '../../../components';
|
|
3
3
|
import { ExternalLinkTabProps } from './innertabs/ExternalLink';
|
|
4
4
|
import { InternalLinkTabProps, InternalLinkTabResult } from './innertabs/InternalLink';
|
|
@@ -54,7 +54,7 @@ export interface MediaLibraryRef {
|
|
|
54
54
|
/**
|
|
55
55
|
* The resulting type depends on the actual selected Tab when modal is closed.
|
|
56
56
|
*/
|
|
57
|
-
export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
|
|
57
|
+
export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | NextcloudDocument[] | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
|
|
58
58
|
/**
|
|
59
59
|
* MediaLibrary component properties
|
|
60
60
|
*/
|
|
@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
|
|
|
5
5
|
import SvgIconApplications from "../../icons/components/IconApplications.js";
|
|
6
6
|
import SvgIconCode from "../../icons/components/IconCode.js";
|
|
7
7
|
import SvgIconFolder from "../../icons/components/IconFolder.js";
|
|
8
|
+
import SvgIconGlobe2 from "../../icons/components/IconGlobe2.js";
|
|
8
9
|
import SvgIconGlobe from "../../icons/components/IconGlobe.js";
|
|
9
10
|
import SvgIconMic from "../../icons/components/IconMic.js";
|
|
10
11
|
import SvgIconRecordVideo from "../../icons/components/IconRecordVideo.js";
|
|
@@ -12,6 +13,7 @@ import SvgIconSmartphone from "../../icons/components/IconSmartphone.js";
|
|
|
12
13
|
import { InnerTabs } from "./innertabs/index.js";
|
|
13
14
|
import { MediaLibraryContext } from "./MediaLibraryContext.js";
|
|
14
15
|
import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
16
|
+
import usePublicConf from "../../../hooks/usePublicConf/usePublicConf.js";
|
|
15
17
|
import useHttpErrorToast from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
|
|
16
18
|
import Modal from "../../../components/Modal/Modal.js";
|
|
17
19
|
import { Tabs } from "../../../components/Tabs/components/Tabs.js";
|
|
@@ -29,6 +31,8 @@ const orderedTabs = [
|
|
|
29
31
|
// Filesystem browser + drag'n'drop of files
|
|
30
32
|
"workspace",
|
|
31
33
|
// Media browser
|
|
34
|
+
"nextcloud",
|
|
35
|
+
// Nextcloud media browser
|
|
32
36
|
"video-embedder"
|
|
33
37
|
// Link to a hosted video
|
|
34
38
|
], mediaLibraryTypes = {
|
|
@@ -70,7 +74,7 @@ const orderedTabs = [
|
|
|
70
74
|
onCancel,
|
|
71
75
|
onTabChange
|
|
72
76
|
}, ref) => {
|
|
73
|
-
var _a;
|
|
77
|
+
var _a, _b;
|
|
74
78
|
const linkTabProps = useRef(), refModal = useRef(null);
|
|
75
79
|
useImperativeHandle(ref, () => ({
|
|
76
80
|
show,
|
|
@@ -81,7 +85,9 @@ const orderedTabs = [
|
|
|
81
85
|
}));
|
|
82
86
|
const {
|
|
83
87
|
t
|
|
84
|
-
} = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"),
|
|
88
|
+
} = 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"), {
|
|
89
|
+
data: workspacePublicConf
|
|
90
|
+
} = usePublicConf("workspace"), enableNextcloudTab = ((_a = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _a.includes("nextcloud")) && nextcloudViewWorkflow, [type, setType] = useState(null);
|
|
85
91
|
useHttpErrorToast({
|
|
86
92
|
active: !!type,
|
|
87
93
|
isDismissible: !0,
|
|
@@ -96,6 +102,14 @@ const orderedTabs = [
|
|
|
96
102
|
availableFor: ["audio", "video", "image", "attachment"],
|
|
97
103
|
isEnable: null
|
|
98
104
|
},
|
|
105
|
+
nextcloud: {
|
|
106
|
+
id: "nextcloud",
|
|
107
|
+
icon: /* @__PURE__ */ jsx(SvgIconGlobe2, {}),
|
|
108
|
+
label: t("bbm.nextcloud"),
|
|
109
|
+
content: /* @__PURE__ */ jsx(InnerTabs.Nextcloud, {}),
|
|
110
|
+
availableFor: ["audio", "video", "image", "attachment"],
|
|
111
|
+
isEnable: () => !!enableNextcloudTab
|
|
112
|
+
},
|
|
99
113
|
upload: {
|
|
100
114
|
id: "upload",
|
|
101
115
|
icon: /* @__PURE__ */ jsx(SvgIconSmartphone, {}),
|
|
@@ -162,7 +176,7 @@ const orderedTabs = [
|
|
|
162
176
|
), [defaultTabId, setDefaultTabId] = useState(), defaultTabIdx = useMemo(() => {
|
|
163
177
|
const index = tabs.findIndex((t2) => t2.id === defaultTabId);
|
|
164
178
|
return 0 > index || index >= tabs.length ? 0 : index;
|
|
165
|
-
}, [tabs, defaultTabId]), [resultCounter, setResultCounter] = useState(), [result, setResult] = useState(), [deletionsOnCancel, setDeletionsOnCancel] = useState([]), [onSuccessAction, setPreSuccess] = useState();
|
|
179
|
+
}, [tabs, defaultTabId]), [resultCounter, setResultCounter] = useState(), [result, setResult] = useState(), [deletionsOnCancel, setDeletionsOnCancel] = useState([]), [onSuccessAction, setPreSuccess] = useState(), [isSubmitting, setIsSubmitting] = useState(!1);
|
|
166
180
|
function setVisibleTab(tab) {
|
|
167
181
|
throw tabs.findIndex((t2) => t2.id === tab) < 0 ? "tab.not.visible" : "not.implemented.yet";
|
|
168
182
|
}
|
|
@@ -177,22 +191,33 @@ const orderedTabs = [
|
|
|
177
191
|
linkTabProps.current = props, "resourceId" in props || "appPrefix" in props || setDefaultTabId("external-link"), setType("hyperlink");
|
|
178
192
|
};
|
|
179
193
|
useEffect(() => {
|
|
180
|
-
var _a2,
|
|
194
|
+
var _a2, _b2;
|
|
181
195
|
const typeKey = type || "none";
|
|
182
|
-
!defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((
|
|
196
|
+
!defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _b2.defaultTab);
|
|
183
197
|
}, [defaultTabId, type]);
|
|
184
|
-
const modalHeader = t(((
|
|
198
|
+
const modalHeader = t(((_b = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _b.title) ?? "bbm"), resetState = () => {
|
|
185
199
|
linkTabProps.current = void 0, setResult(void 0), setResultCounter(void 0), setDefaultTabId(void 0), setPreSuccess(void 0), setDeletionsOnCancel([]);
|
|
186
200
|
}, handleTabChange = (tab) => {
|
|
187
201
|
onTabChange == null || onTabChange(tab, deletionsOnCancel), resetState();
|
|
188
202
|
}, handleOnSuccess = useCallback(() => {
|
|
203
|
+
if (isSubmitting) return;
|
|
189
204
|
const triggerSuccess = async (result2) => {
|
|
190
205
|
result2 instanceof Array && ["protected", "public"].findIndex((v) => v === visibility) >= 0 && (result2 = await odeServices.workspace().transferDocuments(result2, appCode ?? "media-library", visibility)), onSuccess(result2);
|
|
191
206
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
207
|
+
(async () => {
|
|
208
|
+
setIsSubmitting(!0);
|
|
209
|
+
try {
|
|
210
|
+
if (onSuccessAction) {
|
|
211
|
+
const asyncResult = await onSuccessAction();
|
|
212
|
+
await triggerSuccess(asyncResult);
|
|
213
|
+
} else result && await triggerSuccess(result);
|
|
214
|
+
resetState();
|
|
215
|
+
} catch {
|
|
216
|
+
} finally {
|
|
217
|
+
setIsSubmitting(!1);
|
|
218
|
+
}
|
|
219
|
+
})();
|
|
220
|
+
}, [isSubmitting, onSuccessAction, result, onSuccess, visibility, appCode]), handleOnCancel = () => {
|
|
196
221
|
onCancel(deletionsOnCancel), resetState();
|
|
197
222
|
};
|
|
198
223
|
return type && /* @__PURE__ */ jsx(MediaLibraryContext.Provider, { value: {
|
|
@@ -214,7 +239,7 @@ const orderedTabs = [
|
|
|
214
239
|
] }) }),
|
|
215
240
|
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
216
241
|
/* @__PURE__ */ jsx(Button, { type: "button", color: "tertiary", variant: "ghost", onClick: handleOnCancel, children: t("cancel") }),
|
|
217
|
-
/* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", disabled: typeof result > "u", onClick: handleOnSuccess, children: resultCounter && resultCounter > 1 ? t("addMultiple", {
|
|
242
|
+
/* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", disabled: typeof result > "u" || isSubmitting, onClick: handleOnSuccess, children: resultCounter && resultCounter > 1 ? t("addMultiple", {
|
|
218
243
|
number: resultCounter
|
|
219
244
|
}) : t("add") })
|
|
220
245
|
] })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Nextcloud: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
appCode,
|
|
9
|
+
visibility,
|
|
10
|
+
type,
|
|
11
|
+
setResultCounter,
|
|
12
|
+
setResult,
|
|
13
|
+
setPreSuccess,
|
|
14
|
+
multiple
|
|
15
|
+
} = useMediaLibraryContext(), {
|
|
16
|
+
user
|
|
17
|
+
} = useUser();
|
|
18
|
+
function getDocumentRoleFilter() {
|
|
19
|
+
switch (type) {
|
|
20
|
+
case "image":
|
|
21
|
+
return "img";
|
|
22
|
+
case "audio":
|
|
23
|
+
return "audio";
|
|
24
|
+
case "video":
|
|
25
|
+
return "video";
|
|
26
|
+
default:
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function handleSelect(result) {
|
|
31
|
+
setResultCounter(result.length), result.length ? (setResult(result), setPreSuccess(() => () => user != null && user.userId ? odeServices.nextcloud().copyDocumentToWorkspace(
|
|
32
|
+
user.userId,
|
|
33
|
+
result.map((doc) => doc.path),
|
|
34
|
+
void 0,
|
|
35
|
+
// Copy the documents straight to their final place, the way an
|
|
36
|
+
// upload does, instead of leaving a copy in the user's own
|
|
37
|
+
// documents for the modal to transfer afterwards.
|
|
38
|
+
{
|
|
39
|
+
application: appCode,
|
|
40
|
+
visibility
|
|
41
|
+
}
|
|
42
|
+
) : Promise.resolve([]))) : (setResult(), setPreSuccess(void 0));
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsx(Nextcloud$1, { roles: getDocumentRoleFilter(), onSelect: handleSelect, multiple, className: "border rounded overflow-y-auto" });
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
Nextcloud
|
|
48
|
+
};
|
|
@@ -4,6 +4,7 @@ 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;
|
|
7
8
|
InternalLink: ({ target, resourceId, appPrefix, }: import('./InternalLink').InternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
Iframe: () => import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
VideoEmbedder: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,6 +2,7 @@ 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";
|
|
5
6
|
import { Upload } from "./Upload.js";
|
|
6
7
|
import { Video } from "./Video.js";
|
|
7
8
|
import { VideoEmbedder } from "./VideoEmbedder.js";
|
|
@@ -12,6 +13,7 @@ const InnerTabs = {
|
|
|
12
13
|
Upload,
|
|
13
14
|
ExternalLink,
|
|
14
15
|
Workspace,
|
|
16
|
+
Nextcloud,
|
|
15
17
|
InternalLink,
|
|
16
18
|
Iframe,
|
|
17
19
|
VideoEmbedder
|
|
@@ -0,0 +1,24 @@
|
|
|
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;
|
|
@@ -0,0 +1,120 @@
|
|
|
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 illuError from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-error.svg";
|
|
11
|
+
import illuConnectionLost from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-connection-lost.svg";
|
|
12
|
+
import illuTrash from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-trash.svg";
|
|
13
|
+
import useUser from "../../../hooks/useUser/useUser.js";
|
|
14
|
+
import useToast from "../../../hooks/useToast/useToast.js";
|
|
15
|
+
import useNextcloudSearch from "../../../hooks/useNextcloudSearch/useNextcloudSearch.js";
|
|
16
|
+
import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
17
|
+
import Flex from "../../../components/Flex/Flex.js";
|
|
18
|
+
import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
|
|
19
|
+
import Button from "../../../components/Button/Button.js";
|
|
20
|
+
import { Grid } from "../../../components/Grid/Grid.js";
|
|
21
|
+
import Tree from "../../../components/Tree/components/Tree.js";
|
|
22
|
+
import SearchBar from "../../../components/SearchBar/SearchBar.js";
|
|
23
|
+
import Dropdown from "../../../components/Dropdown/Dropdown.js";
|
|
24
|
+
import NextcloudFileCard from "../FileCard/NextcloudFileCard.js";
|
|
25
|
+
const ROOT_ID = "root";
|
|
26
|
+
function compare(a, b) {
|
|
27
|
+
return a === b ? 0 : a === void 0 ? -1 : b === void 0 ? 1 : a.localeCompare(b);
|
|
28
|
+
}
|
|
29
|
+
const Nextcloud = ({
|
|
30
|
+
onSelect,
|
|
31
|
+
multiple = !0,
|
|
32
|
+
roles,
|
|
33
|
+
className
|
|
34
|
+
}) => {
|
|
35
|
+
const {
|
|
36
|
+
t
|
|
37
|
+
} = useTranslation(), {
|
|
38
|
+
user
|
|
39
|
+
} = useUser(), toast = useToast(), {
|
|
40
|
+
root,
|
|
41
|
+
needsAuth,
|
|
42
|
+
isCheckingAuth,
|
|
43
|
+
isAuthError,
|
|
44
|
+
refetchAuthStatus,
|
|
45
|
+
loadContent,
|
|
46
|
+
loadError
|
|
47
|
+
} = useNextcloudSearch(ROOT_ID, t("nextcloud"), user == null ? void 0 : user.userId), popupRef = useRef(null), [currentNodeId, setCurrentNodeId] = useState(ROOT_ID), currentNode = findNodeById(root, currentNodeId) ?? root, [searchTerm, setSearchTerm] = useState(void 0), [sortOrder, setSortOrder] = useState(["modified", "desc"]), [selectedDocuments, setSelectedDocuments] = useState([]), handleTreeItemChange = useCallback((nodeId) => {
|
|
48
|
+
setCurrentNodeId(nodeId), loadContent(nodeId);
|
|
49
|
+
}, [loadContent]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
needsAuth || loadContent(ROOT_ID);
|
|
52
|
+
}, [loadContent, needsAuth]);
|
|
53
|
+
const documents = useMemo(() => {
|
|
54
|
+
if (!currentNode.files) return;
|
|
55
|
+
const matchesRole = (doc) => {
|
|
56
|
+
if (!roles) return !0;
|
|
57
|
+
const role = DocumentHelper.role(doc.contentType, !1);
|
|
58
|
+
return Array.isArray(roles) ? roles.includes(role) : roles === role;
|
|
59
|
+
}, normalizedSearchTerm = searchTerm == null ? void 0 : searchTerm.toLowerCase(), list = currentNode.files.filter((f) => (!normalizedSearchTerm || f.name.toLowerCase().includes(normalizedSearchTerm)) && matchesRole(f));
|
|
60
|
+
let sortFunction;
|
|
61
|
+
return sortOrder[0] === "name" ? sortFunction = sortOrder[1] === "asc" ? (a, b) => compare(a.name, b.name) : (a, b) => compare(b.name, a.name) : sortFunction = (a, b) => compare(b.lastModified, a.lastModified), list.sort(sortFunction);
|
|
62
|
+
}, [currentNode, searchTerm, sortOrder, roles]), selectedPaths = useMemo(() => new Set(selectedDocuments.map((d) => d.path)), [selectedDocuments]), handleSearchChange = useCallback((e) => {
|
|
63
|
+
setSearchTerm(e.target.value);
|
|
64
|
+
}, [setSearchTerm]);
|
|
65
|
+
function getSortOrderLabel() {
|
|
66
|
+
return sortOrder[0] === "name" ? sortOrder[1] === "asc" ? t("sort.order.alpha.asc") : t("sort.order.alpha.desc") : t("sort.order.modify.desc");
|
|
67
|
+
}
|
|
68
|
+
function handleSelectDoc(doc) {
|
|
69
|
+
let currentDocuments = [...selectedDocuments];
|
|
70
|
+
multiple ? currentDocuments.some((selectedDocument) => selectedDocument.path === doc.path) ? currentDocuments = currentDocuments.filter((selectedDocument) => selectedDocument.path !== doc.path) : currentDocuments = [...currentDocuments, doc] : currentDocuments = [doc], setSelectedDocuments(currentDocuments), onSelect(currentDocuments);
|
|
71
|
+
}
|
|
72
|
+
const nextcloud = clsx("workspace flex-grow-1 gap-0", className), openLoginPopup = () => {
|
|
73
|
+
popupRef.current = window.open(`${window.location.origin}/nextcloud/user/oauth2/init`, "", "popup, height=600, width=400"), popupRef.current || toast.error(t("nextcloud.auth.popupBlocked"));
|
|
74
|
+
};
|
|
75
|
+
return useEffect(() => {
|
|
76
|
+
function handleMessage(event) {
|
|
77
|
+
var _a;
|
|
78
|
+
event.origin !== window.location.origin || ((_a = event.data) == null ? void 0 : _a.type) !== "nextcloud-connected" || (popupRef.current && !popupRef.current.closed && popupRef.current.close(), refetchAuthStatus());
|
|
79
|
+
}
|
|
80
|
+
return window.addEventListener("message", handleMessage), () => window.removeEventListener("message", handleMessage);
|
|
81
|
+
}, [refetchAuthStatus]), isCheckingAuth ? /* @__PURE__ */ jsx(LoadingScreen, {}) : isAuthError ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", className: "h-full w-100", justify: "center", align: "center", children: [
|
|
82
|
+
/* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuError, title: t("nextcloud.error.title"), text: t("nextcloud.error.description") }),
|
|
83
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => refetchAuthStatus(), children: t("retry") })
|
|
84
|
+
] }) : needsAuth ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", className: "h-full w-100", justify: "center", align: "center", children: [
|
|
85
|
+
/* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuConnectionLost, title: t("nextcloud.auth.title"), text: t("nextcloud.auth.description") }),
|
|
86
|
+
/* @__PURE__ */ jsx(Button, { onClick: openLoginPopup, children: t("nextcloud.auth.connect") })
|
|
87
|
+
] }) : /* @__PURE__ */ jsxs(Grid, { className: nextcloud, children: [
|
|
88
|
+
/* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "3", xl: "4", className: "workspace-folders p-12 pt-0 gap-12", children: /* @__PURE__ */ jsx("div", { style: {
|
|
89
|
+
position: "sticky",
|
|
90
|
+
top: 0,
|
|
91
|
+
paddingTop: "1.2rem"
|
|
92
|
+
}, children: /* @__PURE__ */ jsx(Tree, { nodes: root, selectedNodeId: currentNodeId, showIcon: !0, onTreeItemClick: handleTreeItemChange, onTreeItemUnfold: handleTreeItemChange }) }) }),
|
|
93
|
+
/* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "5", xl: "8", children: /* @__PURE__ */ jsxs(Grid, { className: "flex-grow-1 gap-0", children: [
|
|
94
|
+
/* @__PURE__ */ jsxs(Grid.Col, { sm: "4", md: "8", xl: "12", children: [
|
|
95
|
+
/* @__PURE__ */ jsx("div", { className: "workspace-search px-16 py-8 ", children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, className: "gap-16", onChange: handleSearchChange }) }),
|
|
96
|
+
/* @__PURE__ */ jsxs(Flex, { className: "px-8 py-4", align: "center", justify: "end", children: [
|
|
97
|
+
/* @__PURE__ */ jsx("small", { className: "text-muted", children: t("workspace.search.order") }),
|
|
98
|
+
/* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
99
|
+
/* @__PURE__ */ jsx(Dropdown.Trigger, { size: "sm", label: getSortOrderLabel(), variant: "ghost" }),
|
|
100
|
+
/* @__PURE__ */ jsxs(Dropdown.Menu, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortTime, {}), onClick: () => setSortOrder(["modified", "desc"]), children: t("sort.order.modify.desc") }),
|
|
102
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortAscendingLetters, {}), onClick: () => setSortOrder(["name", "asc"]), children: t("sort.order.alpha.asc") }),
|
|
103
|
+
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortDescendingLetters, {}), onClick: () => setSortOrder(["name", "desc"]), children: t("sort.order.alpha.desc") })
|
|
104
|
+
] })
|
|
105
|
+
] })
|
|
106
|
+
] })
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ jsx(Grid.Col, { sm: "4", md: "8", xl: "12", className: "p-8 gap-8", children: loadError ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", className: "h-full w-100", justify: "center", align: "center", children: [
|
|
109
|
+
/* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuError, title: t("nextcloud.error.title"), text: t("nextcloud.error.description") }),
|
|
110
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => loadContent(currentNodeId), children: t("retry") })
|
|
111
|
+
] }) : documents ? documents.length !== 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-workspace", children: documents.map((doc) => {
|
|
112
|
+
const isSelected = selectedPaths.has(doc.path);
|
|
113
|
+
return /* @__PURE__ */ jsx(NextcloudFileCard, { doc, userId: user.userId, isSelected, onClick: () => handleSelectDoc(doc) }, doc.path);
|
|
114
|
+
}) }) : /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuTrash, text: t("workspace.empty.docSpace"), title: t("explorer.emptyScreen.trash.title") }) : /* @__PURE__ */ jsx(LoadingScreen, {}) })
|
|
115
|
+
] }) })
|
|
116
|
+
] });
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
Nextcloud as default
|
|
120
|
+
};
|
|
@@ -6,6 +6,7 @@ import SvgIconSortAscendingLetters from "../../icons/components/IconSortAscendin
|
|
|
6
6
|
import SvgIconSortDescendingLetters from "../../icons/components/IconSortDescendingLetters.js";
|
|
7
7
|
import SvgIconSortTime from "../../icons/components/IconSortTime.js";
|
|
8
8
|
import illuTrash from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-trash.svg";
|
|
9
|
+
import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
9
10
|
import useWorkspaceSearch from "../../../hooks/useWorkspaceSearch/useWorkspaceSearch.js";
|
|
10
11
|
import { Grid } from "../../../components/Grid/Grid.js";
|
|
11
12
|
import TreeView from "../../../components/TreeView/TreeView.js";
|
|
@@ -15,7 +16,7 @@ import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
|
15
16
|
import FileCard from "../FileCard/FileCard.js";
|
|
16
17
|
import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
|
|
17
18
|
import { findTreeNode } from "../../../components/TreeView/utilities/treeview.js";
|
|
18
|
-
const Workspace = ({
|
|
19
|
+
const WORKSPACE_VIEW_WORKFLOW = "org.entcore.workspace.controllers.WorkspaceController|view", Workspace = ({
|
|
19
20
|
roles,
|
|
20
21
|
onSelect,
|
|
21
22
|
multiple = !0,
|
|
@@ -25,7 +26,7 @@ const Workspace = ({
|
|
|
25
26
|
}) => {
|
|
26
27
|
const {
|
|
27
28
|
t
|
|
28
|
-
} = useTranslation(), {
|
|
29
|
+
} = useTranslation(), hasWorkspaceViewRight = useHasWorkflow(WORKSPACE_VIEW_WORKFLOW), canViewPersonalFolders = !!hasWorkspaceViewRight, {
|
|
29
30
|
root: ownerRoot,
|
|
30
31
|
loadContent: loadOwnerDocs
|
|
31
32
|
} = useWorkspaceSearch("root", t("workspace.tree.owner"), "owner", roles), {
|
|
@@ -111,7 +112,9 @@ const Workspace = ({
|
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
114
|
(_a = ref == null ? void 0 : ref.current) == null || _a.select("root");
|
|
114
|
-
}, [currentFilter]), useEffect(
|
|
115
|
+
}, [currentFilter]), useEffect(() => {
|
|
116
|
+
hasWorkspaceViewRight === !1 && (currentFilter === "owner" || currentFilter === "shared") && selectAndLoadContent("protected", "root");
|
|
117
|
+
}, [hasWorkspaceViewRight]), useEffect(loadContent, [loadContent]), useEffect(() => {
|
|
115
118
|
if (currentNode.files) {
|
|
116
119
|
let list = [].concat(currentNode.files);
|
|
117
120
|
searchTerm && (list = list.filter((f) => f.name.indexOf(searchTerm) >= 0));
|
|
@@ -140,8 +143,8 @@ const Workspace = ({
|
|
|
140
143
|
top: 0,
|
|
141
144
|
paddingTop: "1.2rem"
|
|
142
145
|
}, children: [
|
|
143
|
-
/* @__PURE__ */ jsx(TreeView, { ref: ownerRef, data: ownerRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("owner", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("owner", nodeId) }),
|
|
144
|
-
/* @__PURE__ */ jsx(TreeView, { ref: sharedRef, data: sharedRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("shared", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("shared", nodeId) }),
|
|
146
|
+
canViewPersonalFolders && /* @__PURE__ */ jsx(TreeView, { ref: ownerRef, data: ownerRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("owner", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("owner", nodeId) }),
|
|
147
|
+
canViewPersonalFolders && /* @__PURE__ */ jsx(TreeView, { ref: sharedRef, data: sharedRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("shared", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("shared", nodeId) }),
|
|
145
148
|
/* @__PURE__ */ jsx(TreeView, { ref: protectRef, data: protectRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("protected", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("protected", nodeId) }),
|
|
146
149
|
showPublicFolder && /* @__PURE__ */ jsx(TreeView, { ref: publicRef, data: publicRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("public", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("public", nodeId) })
|
|
147
150
|
] }) }),
|
package/dist/multimedia.js
CHANGED
|
@@ -4,12 +4,14 @@ 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/
|
|
8
|
-
import { default as default9 } from "./modules/multimedia/
|
|
9
|
-
import { default as default10 } from "./modules/multimedia/
|
|
10
|
-
import { default as default11 } from "./modules/multimedia/
|
|
11
|
-
import { default as default12 } from "./modules/multimedia/
|
|
12
|
-
import { default as default13 } from "./modules/multimedia/
|
|
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";
|
|
13
15
|
import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
|
|
14
16
|
import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
|
|
15
17
|
import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
|
|
@@ -22,11 +24,13 @@ export {
|
|
|
22
24
|
default6 as ImagePicker,
|
|
23
25
|
InternalLinker,
|
|
24
26
|
default7 as MediaLibrary,
|
|
27
|
+
default8 as Nextcloud,
|
|
28
|
+
default9 as NextcloudFileCard,
|
|
25
29
|
Upload,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
default10 as UploadCard,
|
|
31
|
+
default11 as UploadFiles,
|
|
32
|
+
default12 as VideoEmbed,
|
|
33
|
+
default13 as VideoRecorder,
|
|
34
|
+
default14 as Workspace,
|
|
35
|
+
default15 as WorkspaceFolders
|
|
32
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.10",
|
|
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.
|
|
144
|
-
"@edifice.io/utilities": "2.6.
|
|
145
|
-
"@edifice.io/tiptap-extensions": "2.6.
|
|
143
|
+
"@edifice.io/bootstrap": "2.6.10",
|
|
144
|
+
"@edifice.io/utilities": "2.6.10",
|
|
145
|
+
"@edifice.io/tiptap-extensions": "2.6.10"
|
|
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/
|
|
177
|
-
"@edifice.io/
|
|
176
|
+
"@edifice.io/client": "2.6.10",
|
|
177
|
+
"@edifice.io/config": "2.6.10"
|
|
178
178
|
},
|
|
179
179
|
"peerDependencies": {
|
|
180
180
|
"@react-spring/web": "9.7.5",
|