@powerhousedao/common 4.1.0-dev.82 → 4.1.0-dev.84
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/editors/generic-drive-explorer/components/create-document.d.ts +1 -7
- package/dist/editors/generic-drive-explorer/components/create-document.d.ts.map +1 -1
- package/dist/editors/generic-drive-explorer/components/create-document.js +10 -4
- package/dist/editors/generic-drive-explorer/components/create-document.js.map +1 -1
- package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts +1 -12
- package/dist/editors/generic-drive-explorer/components/file-content-view.d.ts.map +1 -1
- package/dist/editors/generic-drive-explorer/components/file-content-view.js +6 -8
- package/dist/editors/generic-drive-explorer/components/file-content-view.js.map +1 -1
- package/dist/editors/generic-drive-explorer/components/folder-view.d.ts +3 -12
- package/dist/editors/generic-drive-explorer/components/folder-view.d.ts.map +1 -1
- package/dist/editors/generic-drive-explorer/components/folder-view.js +5 -16
- package/dist/editors/generic-drive-explorer/components/folder-view.js.map +1 -1
- package/dist/editors/generic-drive-explorer/editor.d.ts.map +1 -1
- package/dist/editors/generic-drive-explorer/editor.js +4 -30
- package/dist/editors/generic-drive-explorer/editor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
interface CreateDocumentProps {
|
|
3
|
-
documentModels?: DocumentModelModule[];
|
|
4
|
-
createDocument: (doc: DocumentModelModule) => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const CreateDocument: React.FC<CreateDocumentProps>;
|
|
7
|
-
export {};
|
|
1
|
+
export declare function CreateDocument(): import("react/jsx-runtime").JSX.Element | null;
|
|
8
2
|
//# sourceMappingURL=create-document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-document.d.ts","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/create-document.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-document.d.ts","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/create-document.tsx"],"names":[],"mappings":"AAeA,wBAAgB,cAAc,mDA4B7B"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { PowerhouseButton } from "@powerhousedao/design-system";
|
|
3
|
+
import { showCreateDocumentModal, useDocumentModelModules, useUserPermissions, } from "@powerhousedao/reactor-browser";
|
|
3
4
|
function getDocumentSpec(doc) {
|
|
4
5
|
return doc.documentModel.global;
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
-
|
|
7
|
+
export function CreateDocument() {
|
|
8
|
+
const { isAllowedToCreateDocuments } = useUserPermissions();
|
|
9
|
+
const documentModelModules = useDocumentModelModules();
|
|
10
|
+
const nonDriveDocumentModelModules = documentModelModules?.filter((module) => module.documentModel.global.id !== "powerhouse/document-drive");
|
|
11
|
+
if (!isAllowedToCreateDocuments)
|
|
12
|
+
return null;
|
|
13
|
+
return (_jsxs("div", { className: "px-6 py-4", children: [_jsx("h3", { className: "mb-3 text-xl font-bold text-gray-600", children: "New document" }), _jsx("div", { className: "flex w-full flex-wrap gap-4", children: nonDriveDocumentModelModules?.map((doc) => {
|
|
8
14
|
const spec = getDocumentSpec(doc);
|
|
9
|
-
return (_jsx(PowerhouseButton, { color: "light", title: spec.name, "aria-description": spec.description, onClick: () =>
|
|
15
|
+
return (_jsx(PowerhouseButton, { color: "light", title: spec.name, "aria-description": spec.description, onClick: () => showCreateDocumentModal(spec.id), children: _jsx("span", { className: "text-sm", children: spec.name }) }, spec.id));
|
|
10
16
|
}) })] }));
|
|
11
|
-
}
|
|
17
|
+
}
|
|
12
18
|
//# sourceMappingURL=create-document.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-document.js","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/create-document.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"create-document.js","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/create-document.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AAMxC,SAAS,eAAe,CAAC,GAAwB;IAC/C,OAAO,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,EAAE,0BAA0B,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAC5D,MAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAC;IACvD,MAAM,4BAA4B,GAAG,oBAAoB,EAAE,MAAM,CAC/D,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,KAAK,2BAA2B,CAC3E,CAAC;IACF,IAAI,CAAC,0BAA0B;QAAE,OAAO,IAAI,CAAC;IAC7C,OAAO,CACL,eAAK,SAAS,EAAC,WAAW,aACxB,aAAI,SAAS,EAAC,sCAAsC,6BAAkB,EACtE,cAAK,SAAS,EAAC,6BAA6B,YACzC,4BAA4B,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBACzC,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;oBAClC,OAAO,CACL,KAAC,gBAAgB,IAEf,KAAK,EAAC,OAAO,EACb,KAAK,EAAE,IAAI,CAAC,IAAI,sBACE,IAAI,CAAC,WAAW,EAClC,OAAO,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,YAE/C,eAAM,SAAS,EAAC,SAAS,YAAE,IAAI,CAAC,IAAI,GAAQ,IANvC,IAAI,CAAC,EAAE,CAOK,CACpB,CAAC;gBACJ,CAAC,CAAC,GACE,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { FileNode, Node, SharingType, SyncStatus } from "document-drive";
|
|
3
|
-
type Props = TNodeActions & {
|
|
4
|
-
fileNodes: FileNode[];
|
|
5
|
-
isAllowedToCreateDocuments: boolean;
|
|
6
|
-
sharingType: SharingType;
|
|
7
|
-
getSyncStatusSync: (syncId: string, sharingType: SharingType) => SyncStatus | undefined;
|
|
8
|
-
setSelectedNode: (id: Node | string | undefined) => void;
|
|
9
|
-
showDeleteNodeModal: (node: Node) => void;
|
|
10
|
-
};
|
|
11
|
-
export declare function FileContentView(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
1
|
+
export declare function FileContentView(): import("react/jsx-runtime").JSX.Element;
|
|
13
2
|
//# sourceMappingURL=file-content-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-content-view.d.ts","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/file-content-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-content-view.d.ts","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/file-content-view.tsx"],"names":[],"mappings":"AAeA,wBAAgB,eAAe,4CAwG9B"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { FileItem, useWindowSize } from "@powerhousedao/design-system";
|
|
3
|
+
import { isFileNodeKind, useNodesInSelectedDriveOrFolder, } from "@powerhousedao/reactor-browser";
|
|
3
4
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4
5
|
import React, { useRef } from "react";
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
6
6
|
const GAP = 8;
|
|
7
7
|
const ITEM_WIDTH = 256;
|
|
8
8
|
const ITEM_HEIGHT = 48;
|
|
9
9
|
const USED_SPACE = 420;
|
|
10
|
-
export function FileContentView(
|
|
10
|
+
export function FileContentView() {
|
|
11
11
|
const parentRef = useRef(null);
|
|
12
|
-
const { t } = useTranslation();
|
|
13
12
|
const windowSize = useWindowSize();
|
|
14
|
-
const { fileNodes } = props;
|
|
15
13
|
const availableWidth = windowSize.innerWidth - USED_SPACE;
|
|
14
|
+
const nodes = useNodesInSelectedDriveOrFolder();
|
|
15
|
+
const fileNodes = nodes.filter((n) => isFileNodeKind(n));
|
|
16
16
|
const columnCount = Math.floor(availableWidth / (ITEM_WIDTH + GAP)) || 1;
|
|
17
17
|
const rowCount = Math.ceil(fileNodes.length / columnCount);
|
|
18
18
|
const rowVirtualizer = useVirtualizer({
|
|
@@ -44,9 +44,7 @@ export function FileContentView(props) {
|
|
|
44
44
|
return fileNodes[index] || null;
|
|
45
45
|
};
|
|
46
46
|
if (fileNodes.length === 0) {
|
|
47
|
-
return (_jsx("div", { className: "mb-8 text-sm text-gray-400", children:
|
|
48
|
-
defaultValue: "No documents or files 📄",
|
|
49
|
-
}) }));
|
|
47
|
+
return (_jsx("div", { className: "mb-8 text-sm text-gray-400", children: "No documents or files \uD83D\uDCC4" }));
|
|
50
48
|
}
|
|
51
49
|
const renderItem = (rowIndex, columnIndex) => {
|
|
52
50
|
const fileNode = getItem(rowIndex, columnIndex);
|
|
@@ -55,7 +53,7 @@ export function FileContentView(props) {
|
|
|
55
53
|
}
|
|
56
54
|
return (_jsx("div", { style: {
|
|
57
55
|
marginLeft: columnIndex === 0 ? 0 : GAP,
|
|
58
|
-
}, children: _jsx(FileItem, { fileNode: fileNode
|
|
56
|
+
}, children: _jsx(FileItem, { fileNode: fileNode }, fileNode.id) }));
|
|
59
57
|
};
|
|
60
58
|
return (_jsx("div", { ref: parentRef, style: {
|
|
61
59
|
width: `100%`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-content-view.js","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/file-content-view.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"file-content-view.js","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/file-content-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,cAAc,EACd,+BAA+B,GAChC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,GAAG,GAAG,CAAC,CAAC;AACd,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,MAAM,UAAU,eAAe;IAC7B,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;IAC1D,MAAM,KAAK,GAAG,+BAA+B,EAAE,CAAC;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;IACzE,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC;IAE3D,MAAM,cAAc,GAAG,cAAc,CAAC;QACpC,KAAK,EAAE,QAAQ;QACf,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,OAAO;QACzC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YACtB,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACd,O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
4
|
-
type IFolderViewProps = BaseProps & TNodeActions & {
|
|
5
|
-
node: FolderNode | undefined;
|
|
6
|
-
sharingType: SharingType;
|
|
7
|
-
isAllowedToCreateDocuments: boolean;
|
|
8
|
-
setSelectedNode: (id: Node | string | undefined) => void;
|
|
9
|
-
showDeleteNodeModal: (node: Node) => void;
|
|
10
|
-
getSyncStatusSync: (syncId: string, sharingType: SharingType) => SyncStatus | undefined;
|
|
11
|
-
};
|
|
12
|
-
export declare function FolderView(props: IFolderViewProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare function FolderView(props: {
|
|
2
|
+
className?: string;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
4
|
export default FolderView;
|
|
14
5
|
//# sourceMappingURL=folder-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-view.d.ts","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/folder-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"folder-view.d.ts","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/folder-view.tsx"],"names":[],"mappings":"AASA,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAmCvD;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DriveLayout, FileContentView } from "@powerhousedao/common";
|
|
3
3
|
import { FolderItem, useDrop } from "@powerhousedao/design-system";
|
|
4
|
-
import {
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { isFolderNodeKind, useNodesInSelectedDriveOrFolder, useSelectedFolder, } from "@powerhousedao/reactor-browser";
|
|
6
5
|
import { twMerge } from "tailwind-merge";
|
|
7
6
|
export function FolderView(props) {
|
|
8
|
-
const {
|
|
9
|
-
const { t } = useTranslation();
|
|
7
|
+
const { className } = props;
|
|
10
8
|
const nodes = useNodesInSelectedDriveOrFolder();
|
|
11
|
-
const
|
|
9
|
+
const selectedFolder = useSelectedFolder();
|
|
12
10
|
const folderNodes = nodes.filter((n) => isFolderNodeKind(n));
|
|
13
11
|
const { isDropTarget, dropProps } = useDrop({
|
|
14
|
-
|
|
15
|
-
onAddFile,
|
|
16
|
-
onCopyNode,
|
|
17
|
-
onMoveNode,
|
|
12
|
+
target: selectedFolder,
|
|
18
13
|
});
|
|
19
|
-
return (_jsxs("div", { className: twMerge("rounded-md border-2 border-transparent p-2", isDropTarget && "border-dashed border-blue-100", className), ...
|
|
20
|
-
defaultValue: "Folders",
|
|
21
|
-
}), className: "mb-4", children: folderNodes.length > 0 ? (folderNodes.map((folderNode) => (_jsx(FolderItem, { folderNode: folderNode, isAllowedToCreateDocuments: isAllowedToCreateDocuments, sharingType: sharingType, getSyncStatusSync: getSyncStatusSync, setSelectedNode: setSelectedNode, onAddFile: onAddFile, onCopyNode: onCopyNode, onMoveNode: onMoveNode, onRenameNode: onRenameNode, onDuplicateNode: onDuplicateNode, onAddFolder: onAddFolder, onAddAndSelectNewFolder: onAddAndSelectNewFolder, showDeleteNodeModal: showDeleteNodeModal }, folderNode.id)))) : (_jsx("div", { className: "mb-8 text-sm text-gray-400", children: t("folderView.sections.folders.empty", {
|
|
22
|
-
defaultValue: "No documents or files 📄",
|
|
23
|
-
}) })) }), _jsx(DriveLayout.ContentSection, { title: t("folderView.sections.documents.title", {
|
|
24
|
-
defaultValue: "Documents and files",
|
|
25
|
-
}), children: _jsx("div", { className: "w-full", children: _jsx(FileContentView, { fileNodes: fileNodes, isAllowedToCreateDocuments: isAllowedToCreateDocuments, sharingType: sharingType, getSyncStatusSync: getSyncStatusSync, setSelectedNode: setSelectedNode, showDeleteNodeModal: showDeleteNodeModal, onAddFile: onAddFile, onCopyNode: onCopyNode, onMoveNode: onMoveNode, onRenameNode: onRenameNode, onDuplicateNode: onDuplicateNode, onAddFolder: onAddFolder, onAddAndSelectNewFolder: onAddAndSelectNewFolder }) }) })] }));
|
|
14
|
+
return (_jsxs("div", { className: twMerge("rounded-md border-2 border-transparent p-2", isDropTarget && "border-dashed border-blue-100", className), ...dropProps, children: [_jsx(DriveLayout.ContentSection, { title: "Folders", className: "mb-4", children: folderNodes.length > 0 ? (folderNodes.map((folderNode) => (_jsx(FolderItem, { folderNode: folderNode }, folderNode.id)))) : (_jsx("div", { className: "mb-8 text-sm text-gray-400", children: "No documents or files \uD83D\uDCC4" })) }), _jsx(DriveLayout.ContentSection, { title: "Documents and files", children: _jsx("div", { className: "w-full", children: _jsx(FileContentView, {}) }) })] }));
|
|
26
15
|
}
|
|
27
16
|
export default FolderView;
|
|
28
17
|
//# sourceMappingURL=folder-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder-view.js","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/folder-view.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"folder-view.js","sourceRoot":"","sources":["../../../../editors/generic-drive-explorer/components/folder-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,UAAU,CAAC,KAA6B;IACtD,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5B,MAAM,KAAK,GAAG,+BAA+B,EAAE,CAAC;IAChD,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;QAC1C,MAAM,EAAE,cAAc;KACvB,CAAC,CAAC;IACH,OAAO,CACL,eACE,SAAS,EAAE,OAAO,CAChB,4CAA4C,EAC5C,YAAY,IAAI,+BAA+B,EAC/C,SAAS,CACV,KACG,SAAS,aAEb,KAAC,WAAW,CAAC,cAAc,IAAC,KAAK,EAAC,SAAS,EAAC,SAAS,EAAC,MAAM,YACzD,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACxB,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAC9B,KAAC,UAAU,IAAqB,UAAU,EAAE,UAAU,IAArC,UAAU,CAAC,EAAE,CAA4B,CAC3D,CAAC,CACH,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,4BAA4B,mDAErC,CACP,GAC0B,EAC7B,KAAC,WAAW,CAAC,cAAc,IAAC,KAAK,EAAC,qBAAqB,YACrD,cAAK,SAAS,EAAC,QAAQ,YACrB,KAAC,eAAe,KAAG,GACf,GACqB,IACzB,CACP,CAAC;AACJ,CAAC;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/generic-drive-explorer/editor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/generic-drive-explorer/editor.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CA8BxC"}
|
|
@@ -1,39 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { CreateDocument, DriveLayout, FolderView } from "@powerhousedao/common";
|
|
3
|
-
import { Breadcrumbs,
|
|
4
|
-
import {
|
|
5
|
-
import { getDriveSharingType } from "document-drive";
|
|
3
|
+
import { Breadcrumbs, useDrop } from "@powerhousedao/design-system";
|
|
4
|
+
import { useSetPHDriveEditorConfig } from "@powerhousedao/reactor-browser";
|
|
6
5
|
import { editorConfig } from "./config.js";
|
|
7
6
|
export function Editor(props) {
|
|
8
7
|
useSetPHDriveEditorConfig(editorConfig);
|
|
9
8
|
const { className, children } = props;
|
|
10
|
-
const
|
|
11
|
-
const { onRenameNode, onDuplicateNode, onAddFolder, onAddFile, onCopyNode, onMoveNode, } = useNodeActions();
|
|
12
|
-
const selectedFolder = useSelectedFolder();
|
|
13
|
-
const selectedDriveAsFolderNode = makeFolderNodeFromDrive(selectedDrive);
|
|
14
|
-
const documentModels = useDocumentModelModules();
|
|
15
|
-
const selectedNodePath = useSelectedNodePath();
|
|
16
|
-
const { isAllowedToCreateDocuments } = useUserPermissions();
|
|
17
|
-
const onCreateDocument = (documentModel) => {
|
|
18
|
-
showCreateDocumentModal(documentModel.documentModel.global.id);
|
|
19
|
-
};
|
|
20
|
-
const { isDropTarget, dropProps } = useDrop({
|
|
21
|
-
node: selectedDriveAsFolderNode,
|
|
22
|
-
onAddFile,
|
|
23
|
-
onCopyNode,
|
|
24
|
-
onMoveNode,
|
|
25
|
-
});
|
|
26
|
-
const { breadcrumbs, onBreadcrumbSelected } = useBreadcrumbs({
|
|
27
|
-
selectedNodePath,
|
|
28
|
-
setSelectedNode,
|
|
29
|
-
});
|
|
30
|
-
const sharingType = getDriveSharingType(selectedDrive);
|
|
31
|
-
async function onAddAndSelectNewFolder(name) {
|
|
32
|
-
await onAddFolder(name, selectedFolder);
|
|
33
|
-
setSelectedNode(selectedFolder);
|
|
34
|
-
}
|
|
9
|
+
const { isDropTarget, dropProps } = useDrop();
|
|
35
10
|
const showDocumentEditor = !!children;
|
|
36
|
-
return (_jsxs(DriveLayout, { className: className, children: [!showDocumentEditor && (_jsx(DriveLayout.Header, { children: _jsx(Breadcrumbs, {
|
|
37
|
-
"powerhouse/document-drive"), createDocument: onCreateDocument })) }))] }));
|
|
11
|
+
return (_jsxs(DriveLayout, { className: className, children: [!showDocumentEditor && (_jsx(DriveLayout.Header, { children: _jsx(Breadcrumbs, {}) })), showDocumentEditor ? (children) : (_jsx(DriveLayout.Content, { ...dropProps, className: isDropTarget ? "rounded-xl bg-blue-100" : "", children: _jsx(FolderView, {}) })), !showDocumentEditor && (_jsx(DriveLayout.Footer, { children: _jsx(CreateDocument, {}) }))] }));
|
|
38
12
|
}
|
|
39
13
|
//# sourceMappingURL=editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../editors/generic-drive-explorer/editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../editors/generic-drive-explorer/editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACxC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC;IAC9C,MAAM,kBAAkB,GAAG,CAAC,CAAC,QAAQ,CAAC;IAEtC,OAAO,CACL,MAAC,WAAW,IAAC,SAAS,EAAE,SAAS,aAC9B,CAAC,kBAAkB,IAAI,CACtB,KAAC,WAAW,CAAC,MAAM,cACjB,KAAC,WAAW,KAAG,GACI,CACtB,EACA,kBAAkB,CAAC,CAAC,CAAC,CACpB,QAAQ,CACT,CAAC,CAAC,CAAC,CACF,KAAC,WAAW,CAAC,OAAO,OACd,SAAS,EACb,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,YAEvD,KAAC,UAAU,KAAG,GACM,CACvB,EACA,CAAC,kBAAkB,IAAI,CACtB,KAAC,WAAW,CAAC,MAAM,cACjB,KAAC,cAAc,KAAG,GACC,CACtB,IACW,CACf,CAAC;AACJ,CAAC"}
|