@edifice.io/react 2.6.10-develop-integration.20261021201242 → 2.6.10-develop-pedago.20261022103835
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/editor.js +2 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/icons-apps.js +182 -184
- package/dist/index.js +192 -198
- package/dist/modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js +110 -91
- package/dist/modules/editor/components/BubbleMenuEditInformationPane/BubbleMenuEditInformationPane.js +123 -96
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.HighlightColor.js +5 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextColor.js +5 -8
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +3 -2
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +6 -4
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.d.ts +29 -0
- package/dist/modules/editor/components/Toolbar/FloatingMenuOptions.js +22 -0
- package/dist/modules/editor/components/Toolbar/LinkToolbar.d.ts +6 -3
- package/dist/modules/editor/components/Toolbar/LinkToolbar.js +29 -7
- package/dist/modules/editor/components/Toolbar/TableToolbar.CellColor.js +3 -2
- package/dist/modules/editor/components/Toolbar/TableToolbar.js +65 -45
- package/dist/modules/editor/hooks/index.d.ts +1 -0
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useCommentEditor.js +12 -4
- package/dist/modules/editor/hooks/useEditorState.d.ts +20 -0
- package/dist/modules/editor/hooks/useEditorState.js +16 -0
- package/dist/modules/editor/hooks/useLinkToolbar.d.ts +2 -2
- package/dist/modules/editor/hooks/useLinkToolbar.js +2 -1
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +3 -3
- package/dist/modules/editor/hooks/useTipTapEditor.js +72 -24
- package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.js +9 -9
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +1 -2
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +2 -2
- package/dist/modules/icons/components/apps/index.d.ts +0 -1
- package/dist/modules/multimedia/FileCard/index.d.ts +0 -2
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +1 -7
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +7 -16
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +4 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +2 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +3 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +0 -2
- package/dist/modules/multimedia/index.d.ts +0 -1
- package/dist/multimedia.js +22 -26
- package/dist/node_modules/.pnpm/@tiptap_extension-floating-menu@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm@3.32.0/node_modules/@tiptap/extension-floating-menu/dist/index.js +159 -0
- package/dist/node_modules/.pnpm/@tiptap_react@3.32.0_@floating-ui_dom@1.6.0_@tiptap_core@3.32.0_@tiptap_pm@3.32.0__@tiptap_pm_6inmb43gajy4fnlwtngbwkv7um/node_modules/@tiptap/react/dist/menus/index.js +341 -0
- package/dist/node_modules/.pnpm/prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js +419 -0
- package/dist/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js +489 -0
- package/dist/node_modules/.pnpm/prosemirror-transform@1.12.2/node_modules/prosemirror-transform/dist/index.js +607 -0
- package/package.json +35 -43
- package/dist/hooks/useGoogleDriveSearch/index.d.ts +0 -1
- package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +0 -19
- package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +0 -60
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.d.ts +0 -2
- package/dist/modules/editor/components/Toolbar/LinkToolbar.TippyOptions.js +0 -8
- package/dist/modules/icons/components/apps/IconElea.d.ts +0 -7
- package/dist/modules/icons/components/apps/IconElea.js +0 -23
- package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +0 -25
- package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +0 -102
- package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +0 -24
- package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +0 -103
- package/dist/modules/multimedia/GoogleDrive/index.d.ts +0 -2
- package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +0 -61
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.6.10-develop-
|
|
3
|
+
"version": "2.6.10-develop-pedago.20261022103835",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -81,47 +81,39 @@
|
|
|
81
81
|
"@dnd-kit/core": "6.3.1",
|
|
82
82
|
"@dnd-kit/sortable": "8.0.0",
|
|
83
83
|
"@dnd-kit/utilities": "3.2.2",
|
|
84
|
+
"@floating-ui/dom": "1.6.0",
|
|
84
85
|
"@floating-ui/react": "0.26.0",
|
|
85
86
|
"@popperjs/core": "2.11.8",
|
|
86
87
|
"@screeb/sdk-browser": "0.5.0",
|
|
87
88
|
"@screeb/sdk-react": "0.6.0",
|
|
88
|
-
"@tiptap/core": "
|
|
89
|
-
"@tiptap/extension-blockquote": "
|
|
90
|
-
"@tiptap/extension-
|
|
91
|
-
"@tiptap/extension-
|
|
92
|
-
"@tiptap/extension-
|
|
93
|
-
"@tiptap/extension-
|
|
94
|
-
"@tiptap/extension-
|
|
95
|
-
"@tiptap/extension-
|
|
96
|
-
"@tiptap/extension-
|
|
97
|
-
"@tiptap/extension-
|
|
98
|
-
"@tiptap/extension-
|
|
99
|
-
"@tiptap/extension-
|
|
100
|
-
"@tiptap/extension-
|
|
101
|
-
"@tiptap/extension-
|
|
102
|
-
"@tiptap/extension-
|
|
103
|
-
"@tiptap/extension-
|
|
104
|
-
"@tiptap/extension-
|
|
105
|
-
"@tiptap/extension-
|
|
106
|
-
"@tiptap/extension-
|
|
107
|
-
"@tiptap/extension-
|
|
108
|
-
"@tiptap/extension-
|
|
109
|
-
"@tiptap/extension-
|
|
110
|
-
"@tiptap/extension-
|
|
111
|
-
"@tiptap/extension-
|
|
112
|
-
"@tiptap/
|
|
113
|
-
"@tiptap/
|
|
114
|
-
"@tiptap/
|
|
115
|
-
"@tiptap/
|
|
116
|
-
"@tiptap/extension-table-header": "2.11.0",
|
|
117
|
-
"@tiptap/extension-table-row": "2.11.0",
|
|
118
|
-
"@tiptap/extension-text-align": "2.11.0",
|
|
119
|
-
"@tiptap/extension-text-style": "2.11.0",
|
|
120
|
-
"@tiptap/extension-typography": "2.11.0",
|
|
121
|
-
"@tiptap/extension-underline": "2.11.0",
|
|
122
|
-
"@tiptap/pm": "2.11.0",
|
|
123
|
-
"@tiptap/react": "2.11.0",
|
|
124
|
-
"@tiptap/starter-kit": "2.11.0",
|
|
89
|
+
"@tiptap/core": "3.32.0",
|
|
90
|
+
"@tiptap/extension-blockquote": "3.32.0",
|
|
91
|
+
"@tiptap/extension-code": "3.32.0",
|
|
92
|
+
"@tiptap/extension-code-block": "3.32.0",
|
|
93
|
+
"@tiptap/extension-hard-break": "3.32.0",
|
|
94
|
+
"@tiptap/extension-heading": "3.32.0",
|
|
95
|
+
"@tiptap/extension-highlight": "3.32.0",
|
|
96
|
+
"@tiptap/extension-horizontal-rule": "3.32.0",
|
|
97
|
+
"@tiptap/extension-image": "3.32.0",
|
|
98
|
+
"@tiptap/extension-italic": "3.32.0",
|
|
99
|
+
"@tiptap/extension-link": "3.32.0",
|
|
100
|
+
"@tiptap/extension-mathematics": "3.32.0",
|
|
101
|
+
"@tiptap/extension-strike": "3.32.0",
|
|
102
|
+
"@tiptap/extension-subscript": "3.32.0",
|
|
103
|
+
"@tiptap/extension-superscript": "3.32.0",
|
|
104
|
+
"@tiptap/extension-table": "3.32.0",
|
|
105
|
+
"@tiptap/extension-text-align": "3.32.0",
|
|
106
|
+
"@tiptap/extension-text-style": "3.32.0",
|
|
107
|
+
"@tiptap/extension-color": "3.32.0",
|
|
108
|
+
"@tiptap/extension-font-family": "3.32.0",
|
|
109
|
+
"@tiptap/extension-typography": "3.32.0",
|
|
110
|
+
"@tiptap/extension-underline": "3.32.0",
|
|
111
|
+
"@tiptap/extension-list": "3.32.0",
|
|
112
|
+
"@tiptap/extension-bubble-menu": "3.32.0",
|
|
113
|
+
"@tiptap/extensions": "3.32.0",
|
|
114
|
+
"@tiptap/pm": "3.32.0",
|
|
115
|
+
"@tiptap/react": "3.32.0",
|
|
116
|
+
"@tiptap/starter-kit": "3.32.0",
|
|
125
117
|
"@uidotdev/usehooks": "2.4.1",
|
|
126
118
|
"antd": "5.29.1",
|
|
127
119
|
"clsx": "2.1.1",
|
|
@@ -140,9 +132,9 @@
|
|
|
140
132
|
"swiper": "10.1.0",
|
|
141
133
|
"ua-parser-js": "1.0.36",
|
|
142
134
|
"zustand": "4.5.7",
|
|
143
|
-
"@edifice.io/
|
|
144
|
-
"@edifice.io/utilities": "2.6.10-develop-
|
|
145
|
-
"@edifice.io/
|
|
135
|
+
"@edifice.io/bootstrap": "2.6.10-develop-pedago.20261022103835",
|
|
136
|
+
"@edifice.io/utilities": "2.6.10-develop-pedago.20261022103835",
|
|
137
|
+
"@edifice.io/tiptap-extensions": "2.6.10-develop-pedago.20261022103835"
|
|
146
138
|
},
|
|
147
139
|
"devDependencies": {
|
|
148
140
|
"@babel/plugin-transform-react-pure-annotations": "7.27.1",
|
|
@@ -173,8 +165,8 @@
|
|
|
173
165
|
"vite": "5.4.14",
|
|
174
166
|
"vite-plugin-dts": "4.5.4",
|
|
175
167
|
"vite-tsconfig-paths": "5.1.4",
|
|
176
|
-
"@edifice.io/
|
|
177
|
-
"@edifice.io/
|
|
168
|
+
"@edifice.io/client": "2.6.10-develop-pedago.20261022103835",
|
|
169
|
+
"@edifice.io/config": "2.6.10-develop-pedago.20261022103835"
|
|
178
170
|
},
|
|
179
171
|
"peerDependencies": {
|
|
180
172
|
"@react-spring/web": "9.7.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as useGoogleDriveSearch } from './useGoogleDriveSearch';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { GoogleDriveDocument, ID } from '@edifice.io/client';
|
|
2
|
-
import { TreeItem } from '../../components/Tree/types';
|
|
3
|
-
export type GoogleDriveFolderNode = TreeItem & {
|
|
4
|
-
files?: GoogleDriveDocument[];
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Which documents a search browses from its root: the user's own Drive, or
|
|
8
|
-
* the documents other users shared with them.
|
|
9
|
-
*/
|
|
10
|
-
export type GoogleDriveSearchFilter = 'mydrive' | 'shared';
|
|
11
|
-
export default function useGoogleDriveSearch(rootId: string, rootName: string, userId?: string, filter?: GoogleDriveSearchFilter): {
|
|
12
|
-
root: GoogleDriveFolderNode;
|
|
13
|
-
needsAuth: boolean;
|
|
14
|
-
isCheckingAuth: boolean;
|
|
15
|
-
isAuthError: boolean;
|
|
16
|
-
refetchAuthStatus: () => void;
|
|
17
|
-
loadContent: (folderId?: ID) => void;
|
|
18
|
-
loadError: unknown;
|
|
19
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from "react";
|
|
2
|
-
import { odeServices } from "@edifice.io/client";
|
|
3
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
-
import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
|
|
5
|
-
function useGoogleDriveSearch(rootId, rootName, userId, filter = "mydrive") {
|
|
6
|
-
const [root, setRoot] = useState({
|
|
7
|
-
id: rootId,
|
|
8
|
-
name: rootName,
|
|
9
|
-
section: !0
|
|
10
|
-
}), updateFolder = useCallback((folderId, subfolders, files) => {
|
|
11
|
-
setRoot((prev) => {
|
|
12
|
-
const node = findNodeById(prev, folderId);
|
|
13
|
-
if (!node) return prev;
|
|
14
|
-
const children = subfolders.map((f) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const existing = (_a = node.children) == null ? void 0 : _a.find((c) => c.id === f.id);
|
|
17
|
-
return existing ? {
|
|
18
|
-
...existing,
|
|
19
|
-
name: f.name
|
|
20
|
-
} : {
|
|
21
|
-
id: f.id,
|
|
22
|
-
name: f.name
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
return modifyNode(prev, (n) => n.id === node.id ? {
|
|
26
|
-
...n,
|
|
27
|
-
children,
|
|
28
|
-
files
|
|
29
|
-
} : n);
|
|
30
|
-
});
|
|
31
|
-
}, []), queryClient = useQueryClient(), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
|
|
32
|
-
if (!userId) return;
|
|
33
|
-
const parentId = folderId === rootId ? void 0 : folderId, isSharedRoot = filter === "shared" && !parentId;
|
|
34
|
-
try {
|
|
35
|
-
const payload = await queryClient.fetchQuery({
|
|
36
|
-
queryKey: ["googledrive", "documents", userId, isSharedRoot ? "shared" : parentId ?? "root"],
|
|
37
|
-
queryFn: () => isSharedRoot ? odeServices.googledrive().listSharedDocuments(userId) : odeServices.googledrive().listDocuments(userId, parentId),
|
|
38
|
-
staleTime: 6e4
|
|
39
|
-
}), subfolders = [], files = [];
|
|
40
|
-
payload.filter((doc) => doc.id !== parentId).forEach((doc) => {
|
|
41
|
-
doc.isFolder ? doc.canCopyToWorkspace && subfolders.push(doc) : files.push(doc);
|
|
42
|
-
}), setLoadError(null), updateFolder(folderId, subfolders, files);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
setLoadError(error);
|
|
45
|
-
}
|
|
46
|
-
}, [rootId, userId, filter, queryClient, updateFolder]);
|
|
47
|
-
return {
|
|
48
|
-
root,
|
|
49
|
-
needsAuth: !1,
|
|
50
|
-
isCheckingAuth: !1,
|
|
51
|
-
isAuthError: !1,
|
|
52
|
-
refetchAuthStatus: () => {
|
|
53
|
-
},
|
|
54
|
-
loadContent,
|
|
55
|
-
loadError
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
useGoogleDriveSearch as default
|
|
60
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SVGProps } from 'react';
|
|
2
|
-
interface SVGRProps {
|
|
3
|
-
title?: string;
|
|
4
|
-
titleId?: string;
|
|
5
|
-
}
|
|
6
|
-
declare const SvgIconElea: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default SvgIconElea;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
const SvgIconElea = ({
|
|
3
|
-
title,
|
|
4
|
-
titleId,
|
|
5
|
-
...props
|
|
6
|
-
}) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 593 512", width: "24", height: "24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
|
|
7
|
-
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
8
|
-
/* @__PURE__ */ jsx("path", { fill: "#c05382", d: "M484.091 53.268c8.412 6.559 16.526 13.34 24.562 20.353l6.236 5.268c48.117 43.915 74.575 113.077 77.843 176.915 1.737 74.603-24.159 143.023-75.034 197.535-18.204 18.599-39.779 36.844-65.933 41.929l4.274-10.157q2.78-6.738 5.555-13.477l2.817-6.66c16.47-40.282 12.872-79.412-2.83-119.327-9.178-19.688-22.28-45.218-43.32-53.961-11.269-.93-18.064 6.336-26.732 12.837l6.615 5.176c23.402 19.468 43.27 40.331 47.894 71.637 2.295 26.74.603 52.617-11.005 77.121-10.039 3.346-10.039 3.346-18.392-.157-54.682-31.662-93.019-75.478-120.963-132.257l-3.416-6.566-2.871-5.81c-15.451-18.111-42.847-25.361-64.41-33.575l-10.495-4.051a14418 14418 0 0 0-33.151-12.721q-10.926-4.203-21.85-8.412l-10.806-4.16q-10.66-4.105-21.318-8.212c-16.117-6.204-32.244-12.371-48.423-18.411l-8.369-3.16a1530 1530 0 0 0-15.16-5.634c-25.035-9.507-37.074-21.382-48.715-44.666C-4.515 134.531 5.537 90.65 20.08 56.887c11.997 2.117 19.761 7.095 29.647 14.091l9.569 6.722 10.143 7.213q10.424 7.335 20.849 14.666l10.358 7.311c13.306 9.362 26.695 18.6 40.113 27.8l6.317 4.345a2806 2806 0 0 0 36.977 24.936l.876-6.876c7.231-47.895 32.509-82.3 69.882-112.575 70.286-49.422 161.93-39.815 229.281 8.745z" }),
|
|
9
|
-
/* @__PURE__ */ jsx("path", { fill: "#6e1ce0", d: "M20.078 56.889c11.997 2.117 19.762 7.095 29.647 14.092l9.569 6.722 10.143 7.213q10.424 7.335 20.85 14.666l10.358 7.311c13.306 9.362 26.695 18.6 40.112 27.8l6.317 4.345a2796 2796 0 0 0 36.977 24.936l1.255-13.177c.706-7.412.706-7.412 2.091-13.595 10.437-5.219 18.557-4.294 30.118-3.346 17.552 6.399 28.767 16.411 36.81 33.464 2.294 16.696 1.129 28.598-6.693 43.504l10.706 7.137 7.146 4.764q7.974 5.315 15.95 10.627a15760 15760 0 0 1 45.257 30.255l9.403 6.299a9967 9967 0 0 1 18.05 12.121c12.151 8.132 24.244 16.104 37.017 23.227 27.212 15.589 44.403 39.745 53.909 69.543 4.356 28.334 2.286 57.639-10.039 83.66-10.039 3.346-10.039 3.346-18.392-.157-54.682-31.662-93.019-75.478-120.963-132.257l-3.416-6.566-2.871-5.81c-15.451-18.111-42.847-25.361-64.41-33.575l-10.495-4.051a14418 14418 0 0 0-33.151-12.721q-10.926-4.203-21.85-8.412l-10.806-4.16q-10.66-4.105-21.318-8.212c-16.117-6.204-32.244-12.371-48.423-18.411l-8.369-3.16a1530 1530 0 0 0-15.16-5.634c-25.035-9.507-37.074-21.382-48.715-44.666C-4.517 134.531 5.535 90.65 20.078 56.887z" }),
|
|
10
|
-
/* @__PURE__ */ jsx("path", { fill: "#fcfbfc", d: "M390.418 75.098c31.719 20.682 52.493 49.127 63.294 85.373 6.565 32.149.214 67.381-16.993 95.281a317 317 0 0 1-10.471 13.151c-5.171 5.835-5.171 5.835-9.83 14.915-6.202 9.437-11.079 13.079-21.543 17.36-22.272-.501-35.343-9.995-52.706-22.588q-8.372-5.904-16.745-11.804l-8.682-6.182c-14.753-10.434-29.704-20.577-44.639-30.746q-8.074-5.52-16.144-11.046l-6.845-4.684-4.827-3.303 3.276-6.244c5.81-12.147 5.244-24.099 3.417-37.26-6.035-12.533-11.134-18.543-22.588-26.353-13.483-4.667-23.451-4.499-37.647-3.764l3.346-20.078c24.876-1.12 44.168-.465 66.928 10.039l.837-9.83c2.805-18.162 7.099-36.873 22.183-48.602 33.34-16.819 74.365-10.93 106.379 6.366z" }),
|
|
11
|
-
/* @__PURE__ */ jsx("path", { fill: "#6119dc", d: "m0 237.595 21.415 6.374 19.227 5.72a27471 27471 0 0 1 53.37 15.932c31.727 9.5 63.448 18.959 95.361 27.816q6.948 1.962 13.894 3.929a1567 1567 0 0 0 24.918 6.803c22.725 6.48 37.431 13.017 49.567 33.818 4.577 8.868 9.017 17.799 13.385 26.771-24.584.341-49.168.575-73.754.736q-12.526.1-25.053.274c-12.054.163-24.106.238-36.161.298l-11.18.209c-40.31.012-75.058-13.387-104.624-41.046C18.676 302.044-.001 269.893-.001 237.595z" }),
|
|
12
|
-
/* @__PURE__ */ jsx("path", { fill: "#761de2", d: "M73.621 394.876c30.021-.7 60.039-1.234 90.066-1.56 13.946-.156 27.886-.369 41.828-.712 13.475-.329 26.945-.507 40.423-.586a722 722 0 0 0 15.364-.327c40.142-1.229 40.142-1.229 56.617 10.089 7.435 7.385 13.938 14.726 20.067 23.212-14.862 11.424-30.487 18.016-47.687 25.307l-9.294 4.046c-44.125 18.852-84.121 24.262-130.431 8.307-28.063-11.745-53.128-32.043-73.608-54.392-2.085-7.142-2.085-7.142-3.347-13.385z" }),
|
|
13
|
-
/* @__PURE__ */ jsx("path", { fill: "#251742", d: "M358.065 80.314c14.965 8.032 27.32 17.26 33.464 33.464 2.344 16.513 1.721 29.822-5.438 44.968-12.831 13.844-24.406 19.105-43.085 20.078-15.076-.583-23.67-4.715-35.137-14.85-11.353-13.145-15.624-23.254-14.68-40.314 3.628-18.324 16.832-29.641 31.412-40 10.973-5.487 21.652-5.556 33.464-3.347z" }),
|
|
14
|
-
/* @__PURE__ */ jsx("path", { fill: "#ea9924", d: "M331.294 16.732v6.693a2500 2500 0 0 1-20.079 13.386c-18.004 16.718-30.594 32.238-39.111 55.425l-4.222 11.307c-2.704 7.871-5.058 15.51-6.863 23.621-3.658-1.035-7.316-2.07-11.085-3.138-17.302-4.38-34.736-5.662-52.496-6.902 14.762-39.941 49.191-72.072 87.007-90.353 15.966-6.079 29.702-10.039 46.849-10.039" }),
|
|
15
|
-
/* @__PURE__ */ jsx("path", { fill: "#9122ea", d: "M368.104 455.111c8.222 4.719 8.222 4.719 16.104 10.248l8.013 5.555 6 4.274c-1.252 8.404-2.235 12.404-8.706 18.118-32.296 19.328-64.678 23.728-101.921 16.784-21.82-6.017-21.82-6.017-29.921-18.17a5012 5012 0 0 1 39.113-17.341q6.657-2.931 13.291-5.912c6.37-2.858 12.764-5.658 19.164-8.447l11.63-5.151c11.142-3.508 16.295-3.603 27.233.04z" }),
|
|
16
|
-
/* @__PURE__ */ jsx("path", { fill: "#faf9fa", d: "M358.065 100.392c10.248 6.902 10.248 6.902 16.732 16.732 2.314 14.399 1.726 20.78-6.274 33.046-9.077 9.077-12.005 10.254-24.889 11.713-12.34-1.255-12.34-1.255-22.17-7.738-9.244-13.726-10.026-24.268-6.902-40.366 9.49-16.918 25.949-16.947 43.504-13.385z" }),
|
|
17
|
-
/* @__PURE__ */ jsx("path", { fill: "#1f103c", d: "M281.098 170.667c16.177 1.387 23.075 7.958 33.464 20.078 3.154 9.461 3.797 15.5 3.764 25.307l.026 7.961c-.445 6.889-.445 6.889-3.791 13.582-14.794-3.441-24.179-8.311-33.543-20.575-5.966-11.312-7.557-23.63-6.615-36.314l6.693-10.039z" }),
|
|
18
|
-
/* @__PURE__ */ jsx("path", { fill: "#2b1d47", d: "M217.517 133.856c17.552 6.399 28.767 16.411 36.81 33.464 2.155 15.929 2.354 26.587-6.693 40.157-6.483-1.255-6.483-1.255-13.386-3.346-1.105-2.208-2.208-4.417-3.346-6.693 1.105-2.208 2.208-4.417 3.346-6.693 1.28-11.776 1.489-17.875-5.229-27.817-10.584-7.327-18.829-8.298-31.582-8.994l-10.039 3.346v-20.078c10.437-5.219 18.557-4.294 30.118-3.346z" }),
|
|
19
|
-
/* @__PURE__ */ jsx("path", { fill: "#f4f2f7", d: "M220.863 153.935c11.454 8.53 16.131 12.974 18.405 27.19-1.849 10.631-3.992 12.72-11.713 19.66a1520 1520 0 0 1-19.869-14.013l-5.719-3.928c-9.131-6.616-14.083-10.631-17.51-21.549l-.405-7.359c12.934-4.656 23.607-3.243 36.81 0z" })
|
|
20
|
-
] });
|
|
21
|
-
export {
|
|
22
|
-
SvgIconElea as default
|
|
23
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { GoogleDriveDocument } from '@edifice.io/client';
|
|
3
|
-
import { CardProps } from '../../../components/Card';
|
|
4
|
-
export interface GoogleDriveFileCardProps extends CardProps {
|
|
5
|
-
doc: GoogleDriveDocument;
|
|
6
|
-
/**
|
|
7
|
-
* Id of the user who owns the Google Drive 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 GoogleDriveFileCard: {
|
|
22
|
-
({ doc, userId, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: GoogleDriveFileCardProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
displayName: string;
|
|
24
|
-
};
|
|
25
|
-
export default GoogleDriveFileCard;
|
|
@@ -1,102 +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 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 GoogleDriveFileCard = ({
|
|
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.googledrive().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
|
-
GoogleDriveFileCard as default
|
|
102
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { GoogleDriveDocument, Role } from '@edifice.io/client';
|
|
2
|
-
/**
|
|
3
|
-
* GoogleDrive component properties
|
|
4
|
-
*/
|
|
5
|
-
export interface GoogleDriveProps {
|
|
6
|
-
/**
|
|
7
|
-
* Notify parent when media elements are successfully selected.
|
|
8
|
-
*/
|
|
9
|
-
onSelect: (result: GoogleDriveDocument[]) => 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 GoogleDrive: ({ onSelect, multiple, roles, className, }: GoogleDriveProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export default GoogleDrive;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect, useMemo, useCallback } 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 illuTrash from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-trash.svg";
|
|
12
|
-
import useUser from "../../../hooks/useUser/useUser.js";
|
|
13
|
-
import useGoogleDriveSearch from "../../../hooks/useGoogleDriveSearch/useGoogleDriveSearch.js";
|
|
14
|
-
import { Grid } from "../../../components/Grid/Grid.js";
|
|
15
|
-
import Tree from "../../../components/Tree/components/Tree.js";
|
|
16
|
-
import SearchBar from "../../../components/SearchBar/SearchBar.js";
|
|
17
|
-
import Flex from "../../../components/Flex/Flex.js";
|
|
18
|
-
import Dropdown from "../../../components/Dropdown/Dropdown.js";
|
|
19
|
-
import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
|
|
20
|
-
import Button from "../../../components/Button/Button.js";
|
|
21
|
-
import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
|
|
22
|
-
import GoogleDriveFileCard from "../FileCard/GoogleDriveFileCard.js";
|
|
23
|
-
const ROOT_ID = "root", SHARED_ROOT_ID = "shared";
|
|
24
|
-
function compare(a, b) {
|
|
25
|
-
return a === b ? 0 : a === void 0 ? -1 : b === void 0 ? 1 : a.localeCompare(b);
|
|
26
|
-
}
|
|
27
|
-
const GoogleDrive = ({
|
|
28
|
-
onSelect,
|
|
29
|
-
multiple = !0,
|
|
30
|
-
roles,
|
|
31
|
-
className
|
|
32
|
-
}) => {
|
|
33
|
-
const {
|
|
34
|
-
t
|
|
35
|
-
} = useTranslation(), {
|
|
36
|
-
user
|
|
37
|
-
} = useUser(), myDrive = useGoogleDriveSearch(ROOT_ID, t("google-drive.mydrive"), user == null ? void 0 : user.userId), sharedWithMe = useGoogleDriveSearch(SHARED_ROOT_ID, t("workspace.tree.shared"), user == null ? void 0 : user.userId, "shared"), [currentNodeId, setCurrentNodeId] = useState(ROOT_ID), sectionOf = (nodeId) => findNodeById(sharedWithMe.root, nodeId) ? sharedWithMe : myDrive, {
|
|
38
|
-
root,
|
|
39
|
-
loadContent,
|
|
40
|
-
loadError
|
|
41
|
-
} = sectionOf(currentNodeId), currentNode = findNodeById(root, currentNodeId) ?? root, [searchTerm, setSearchTerm] = useState(void 0), [sortOrder, setSortOrder] = useState(["modified", "desc"]), [selectedDocuments, setSelectedDocuments] = useState([]), handleTreeItemChange = (nodeId) => {
|
|
42
|
-
setCurrentNodeId(nodeId), sectionOf(nodeId).loadContent(nodeId);
|
|
43
|
-
}, loadMyDrive = myDrive.loadContent;
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
loadMyDrive(ROOT_ID);
|
|
46
|
-
}, [loadMyDrive]);
|
|
47
|
-
const documents = useMemo(() => {
|
|
48
|
-
if (!currentNode.files) return;
|
|
49
|
-
const matchesRole = (doc) => {
|
|
50
|
-
if (!roles) return !0;
|
|
51
|
-
const role = DocumentHelper.role(doc.contentType, !1);
|
|
52
|
-
return Array.isArray(roles) ? roles.includes(role) : roles === role;
|
|
53
|
-
}, normalizedSearchTerm = searchTerm == null ? void 0 : searchTerm.toLowerCase(), list = currentNode.files.filter((f) => (
|
|
54
|
-
// A document that can't leave Google Drive could never be added.
|
|
55
|
-
f.canCopyToWorkspace && (!normalizedSearchTerm || f.name.toLowerCase().includes(normalizedSearchTerm)) && matchesRole(f)
|
|
56
|
-
));
|
|
57
|
-
let sortFunction;
|
|
58
|
-
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);
|
|
59
|
-
}, [currentNode, searchTerm, sortOrder, roles]), selectedIds = useMemo(() => new Set(selectedDocuments.map((d) => d.id)), [selectedDocuments]), handleSearchChange = useCallback((e) => {
|
|
60
|
-
setSearchTerm(e.target.value);
|
|
61
|
-
}, [setSearchTerm]);
|
|
62
|
-
function getSortOrderLabel() {
|
|
63
|
-
return sortOrder[0] === "name" ? sortOrder[1] === "asc" ? t("sort.order.alpha.asc") : t("sort.order.alpha.desc") : t("sort.order.modify.desc");
|
|
64
|
-
}
|
|
65
|
-
function handleSelectDoc(doc) {
|
|
66
|
-
let currentDocuments = [...selectedDocuments];
|
|
67
|
-
multiple ? currentDocuments.some((selectedDocument) => selectedDocument.id === doc.id) ? currentDocuments = currentDocuments.filter((selectedDocument) => selectedDocument.id !== doc.id) : currentDocuments = [...currentDocuments, doc] : currentDocuments = [doc], setSelectedDocuments(currentDocuments), onSelect(currentDocuments);
|
|
68
|
-
}
|
|
69
|
-
const googleDrive = clsx("workspace flex-grow-1 gap-0", className);
|
|
70
|
-
return /* @__PURE__ */ jsxs(Grid, { className: googleDrive, children: [
|
|
71
|
-
/* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "3", xl: "4", className: "workspace-folders p-12 pt-0 gap-12", children: /* @__PURE__ */ jsx("div", { style: {
|
|
72
|
-
position: "sticky",
|
|
73
|
-
top: 0,
|
|
74
|
-
paddingTop: "1.2rem"
|
|
75
|
-
}, children: /* @__PURE__ */ jsx(Tree, { nodes: [myDrive.root, sharedWithMe.root], selectedNodeId: currentNodeId, showIcon: !0, onTreeItemClick: handleTreeItemChange, onTreeItemUnfold: handleTreeItemChange }) }) }),
|
|
76
|
-
/* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "5", xl: "8", children: /* @__PURE__ */ jsxs(Grid, { className: "flex-grow-1 gap-0", children: [
|
|
77
|
-
/* @__PURE__ */ jsxs(Grid.Col, { sm: "4", md: "8", xl: "12", children: [
|
|
78
|
-
/* @__PURE__ */ jsx("div", { className: "workspace-search px-16 py-8 ", children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, className: "gap-16", onChange: handleSearchChange }) }),
|
|
79
|
-
/* @__PURE__ */ jsxs(Flex, { className: "px-8 py-4", align: "center", justify: "end", children: [
|
|
80
|
-
/* @__PURE__ */ jsx("small", { className: "text-muted", children: t("workspace.search.order") }),
|
|
81
|
-
/* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
82
|
-
/* @__PURE__ */ jsx(Dropdown.Trigger, { size: "sm", label: getSortOrderLabel(), variant: "ghost" }),
|
|
83
|
-
/* @__PURE__ */ jsxs(Dropdown.Menu, { children: [
|
|
84
|
-
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortTime, {}), onClick: () => setSortOrder(["modified", "desc"]), children: t("sort.order.modify.desc") }),
|
|
85
|
-
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortAscendingLetters, {}), onClick: () => setSortOrder(["name", "asc"]), children: t("sort.order.alpha.asc") }),
|
|
86
|
-
/* @__PURE__ */ jsx(Dropdown.Item, { icon: /* @__PURE__ */ jsx(SvgIconSortDescendingLetters, {}), onClick: () => setSortOrder(["name", "desc"]), children: t("sort.order.alpha.desc") })
|
|
87
|
-
] })
|
|
88
|
-
] })
|
|
89
|
-
] })
|
|
90
|
-
] }),
|
|
91
|
-
/* @__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: [
|
|
92
|
-
/* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuError, title: t("google-drive.error.title"), text: t("google-drive.error.description") }),
|
|
93
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => loadContent(currentNodeId), children: t("retry") })
|
|
94
|
-
] }) : documents ? documents.length !== 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-workspace", children: documents.map((doc) => {
|
|
95
|
-
const isSelected = selectedIds.has(doc.id);
|
|
96
|
-
return /* @__PURE__ */ jsx(GoogleDriveFileCard, { doc, userId: user.userId, isSelected, onClick: () => handleSelectDoc(doc) }, doc.id);
|
|
97
|
-
}) }) : /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuTrash, text: t("workspace.empty.docSpace"), title: t("explorer.emptyScreen.trash.title") }) : /* @__PURE__ */ jsx(LoadingScreen, {}) })
|
|
98
|
-
] }) })
|
|
99
|
-
] });
|
|
100
|
-
};
|
|
101
|
-
export {
|
|
102
|
-
GoogleDrive as default
|
|
103
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const GoogleDrive: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { odeServices, GoogleDriveCopyError } from "@edifice.io/client";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { useMediaLibraryContext } from "../MediaLibraryContext.js";
|
|
5
|
-
import useUser from "../../../../hooks/useUser/useUser.js";
|
|
6
|
-
import useToast from "../../../../hooks/useToast/useToast.js";
|
|
7
|
-
import GoogleDrive$1 from "../../GoogleDrive/GoogleDrive.js";
|
|
8
|
-
const GoogleDrive = () => {
|
|
9
|
-
const {
|
|
10
|
-
appCode,
|
|
11
|
-
visibility,
|
|
12
|
-
type,
|
|
13
|
-
setResultCounter,
|
|
14
|
-
setResult,
|
|
15
|
-
setPreSuccess,
|
|
16
|
-
multiple
|
|
17
|
-
} = useMediaLibraryContext(), {
|
|
18
|
-
user
|
|
19
|
-
} = useUser(), {
|
|
20
|
-
t
|
|
21
|
-
} = useTranslation(), toast = useToast();
|
|
22
|
-
function getDocumentRoleFilter() {
|
|
23
|
-
switch (type) {
|
|
24
|
-
case "image":
|
|
25
|
-
return "img";
|
|
26
|
-
case "audio":
|
|
27
|
-
return "audio";
|
|
28
|
-
case "video":
|
|
29
|
-
return "video";
|
|
30
|
-
default:
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async function copyToWorkspace(userId, ids) {
|
|
35
|
-
try {
|
|
36
|
-
return await odeServices.googledrive().copyDocumentToWorkspace(
|
|
37
|
-
userId,
|
|
38
|
-
ids,
|
|
39
|
-
void 0,
|
|
40
|
-
// Copy the documents straight to their final place, the way an upload
|
|
41
|
-
// does, instead of leaving a copy in the user's own documents for the
|
|
42
|
-
// modal to transfer afterwards.
|
|
43
|
-
{
|
|
44
|
-
application: appCode,
|
|
45
|
-
visibility
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
} catch (error) {
|
|
49
|
-
if (error instanceof GoogleDriveCopyError && error.copied.length > 0)
|
|
50
|
-
return toast.warning(t("google-drive.transfer.error")), error.copied;
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function handleSelect(result) {
|
|
55
|
-
setResultCounter(result.length), result.length ? (setResult(result), setPreSuccess(() => () => user != null && user.userId ? copyToWorkspace(user.userId, result.map((doc) => doc.id)) : Promise.resolve([]))) : (setResult(), setPreSuccess(void 0));
|
|
56
|
-
}
|
|
57
|
-
return /* @__PURE__ */ jsx(GoogleDrive$1, { roles: getDocumentRoleFilter(), onSelect: handleSelect, multiple, className: "border rounded overflow-y-auto" });
|
|
58
|
-
};
|
|
59
|
-
export {
|
|
60
|
-
GoogleDrive
|
|
61
|
-
};
|