@burdenoff/microfe-files 2026.1124.1 → 2026.1125.1
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/files/components/ConfirmDialog.js +20 -15
- package/dist/files/components/ConfirmDialog.js.map +1 -1
- package/dist/files/components/CopyDialog.js +99 -81
- package/dist/files/components/CopyDialog.js.map +1 -1
- package/dist/files/components/FileBrowser.js +124 -123
- package/dist/files/components/FileBrowser.js.map +1 -1
- package/dist/files/components/FileInfoPanel.js +109 -101
- package/dist/files/components/FileInfoPanel.js.map +1 -1
- package/dist/files/components/FileVersionPanel.js +113 -109
- package/dist/files/components/FileVersionPanel.js.map +1 -1
- package/dist/files/components/MoveDialog.js +75 -65
- package/dist/files/components/MoveDialog.js.map +1 -1
- package/dist/files/components/ShareAccessParts.js +8 -7
- package/dist/files/components/ShareAccessParts.js.map +1 -1
- package/dist/files/components/ShareDialog.js +17 -16
- package/dist/files/components/ShareDialog.js.map +1 -1
- package/dist/files/components/SharedFolderView.js +29 -26
- package/dist/files/components/SharedFolderView.js.map +1 -1
- package/dist/files/components/UploadQueue.js +1 -0
- package/dist/files/components/UploadQueue.js.map +1 -1
- package/dist/files/components/loadingSystem.d.ts +64 -0
- package/dist/files/components/loadingSystem.js +56 -0
- package/dist/files/components/loadingSystem.js.map +1 -0
- package/dist/files/pages/BrowserPage.js +495 -475
- package/dist/files/pages/BrowserPage.js.map +1 -1
- package/dist/files/v2/FilesPage.js +10 -9
- package/dist/files/v2/FilesPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,122 +1,132 @@
|
|
|
1
1
|
import { useFoldersQuery as e } from "../hooks/useFoldersQuery.js";
|
|
2
2
|
import { tWithFallback as t } from "../utils/i18n.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { SectionLoaderOr as n, SpinnerIcon as r } from "./loadingSystem.js";
|
|
4
|
+
import { useState as i } from "react";
|
|
5
|
+
import { ChevronRight as a, Folder as o, Home as s } from "lucide-react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import { Button as u, ResponsiveDialog as d, ResponsiveDialogContent as f, ResponsiveDialogFooter as p, ResponsiveDialogHeader as m, ResponsiveDialogTitle as h } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
import { useI18n as g } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
9
|
+
import { useLoadingSystem as _ } from "@burdenoff/fe-libs/ui/loading/LoadingSystemProvider";
|
|
8
10
|
// src/files/components/MoveDialog.tsx
|
|
9
|
-
var
|
|
10
|
-
let { t:
|
|
11
|
-
|
|
11
|
+
var v = ({ item: v, type: y, onClose: b, onMove: x, isLoading: S = !1 }) => {
|
|
12
|
+
let C = _(), { t: w } = g(), [T, E] = i(null), [D, O] = i([]), [k, A] = i(void 0), { data: j, loading: M } = e(T || void 0), N = j?.getFolders?.folders || [], P = (e) => {
|
|
13
|
+
E(e.id), O([...D, {
|
|
12
14
|
id: e.id,
|
|
13
15
|
name: e.name
|
|
14
|
-
}]),
|
|
15
|
-
},
|
|
16
|
-
if (e === -1)
|
|
16
|
+
}]), A(e.id);
|
|
17
|
+
}, F = (e) => {
|
|
18
|
+
if (e === -1) E(null), O([]), A(null);
|
|
17
19
|
else {
|
|
18
|
-
let t =
|
|
19
|
-
|
|
20
|
+
let t = D[e];
|
|
21
|
+
E(t.id), O(D.slice(0, e + 1)), A(t.id);
|
|
20
22
|
}
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
return /* @__PURE__ */
|
|
23
|
+
}, I = async () => {
|
|
24
|
+
k !== void 0 && k !== v.id && (await x(k), b());
|
|
25
|
+
}, L = N.filter((e) => y !== "folder" || e.id !== v.id);
|
|
26
|
+
return /* @__PURE__ */ c(d, {
|
|
25
27
|
open: !0,
|
|
26
28
|
onOpenChange: (e) => {
|
|
27
|
-
!e && !
|
|
29
|
+
!e && !S && b();
|
|
28
30
|
},
|
|
29
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ l(f, {
|
|
30
32
|
className: "flex max-h-[80vh] w-full max-w-md flex-col gap-0 p-0",
|
|
31
|
-
"aria-label": t(
|
|
32
|
-
type:
|
|
33
|
-
name:
|
|
33
|
+
"aria-label": t(w, "files.moveDialog.ariaLabel", "Move {{type}} {{name}}", {
|
|
34
|
+
type: y,
|
|
35
|
+
name: v.name
|
|
34
36
|
}),
|
|
35
37
|
children: [
|
|
36
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ c(m, {
|
|
37
39
|
className: "px-6 py-4 border-b border-border-default text-left",
|
|
38
|
-
children: /* @__PURE__ */
|
|
40
|
+
children: /* @__PURE__ */ c(h, {
|
|
39
41
|
className: "text-lg font-semibold text-text-primary",
|
|
40
|
-
children: t(
|
|
42
|
+
children: t(w, "files.moveDialog.title", "Move \"{{name}}\"", { name: v.name })
|
|
41
43
|
})
|
|
42
44
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ c("div", {
|
|
44
46
|
className: "px-6 py-3 border-b border-border-default bg-bg-sunken",
|
|
45
|
-
children: /* @__PURE__ */
|
|
47
|
+
children: /* @__PURE__ */ l("div", {
|
|
46
48
|
className: "flex items-center gap-2 text-sm overflow-x-auto",
|
|
47
|
-
children: [/* @__PURE__ */
|
|
49
|
+
children: [/* @__PURE__ */ l("button", {
|
|
48
50
|
type: "button",
|
|
49
|
-
onClick: () =>
|
|
51
|
+
onClick: () => F(-1),
|
|
50
52
|
className: "flex items-center gap-1.5 text-text-primary hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 whitespace-nowrap",
|
|
51
|
-
children: [/* @__PURE__ */ s
|
|
52
|
-
}),
|
|
53
|
+
children: [/* @__PURE__ */ c(s, { className: "size-4" }), /* @__PURE__ */ c("span", { children: t(w, "files.browser.rootLabel", "My Drive") })]
|
|
54
|
+
}), D.map((e, t) => /* @__PURE__ */ l("div", {
|
|
53
55
|
className: "flex items-center gap-2 whitespace-nowrap",
|
|
54
|
-
children: [/* @__PURE__ */
|
|
56
|
+
children: [/* @__PURE__ */ c(a, { className: "size-4 text-text-tertiary" }), /* @__PURE__ */ c("button", {
|
|
55
57
|
type: "button",
|
|
56
|
-
onClick: () =>
|
|
57
|
-
className: `hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 ${t ===
|
|
58
|
+
onClick: () => F(t),
|
|
59
|
+
className: `hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 ${t === D.length - 1 ? "text-text-primary font-medium" : "text-text-secondary"}`,
|
|
58
60
|
children: e.name
|
|
59
61
|
})]
|
|
60
62
|
}, e.id))]
|
|
61
63
|
})
|
|
62
64
|
}),
|
|
63
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ c("div", {
|
|
64
66
|
className: "flex-1 overflow-y-auto px-6 py-4",
|
|
65
|
-
children:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
children: M ? /* @__PURE__ */ c(n, {
|
|
68
|
+
minHeight: "6rem",
|
|
69
|
+
today: /* @__PURE__ */ c("div", {
|
|
70
|
+
className: "flex items-center justify-center py-8",
|
|
71
|
+
children: /* @__PURE__ */ c(r, { className: "size-6 text-text-tertiary animate-spin" })
|
|
72
|
+
})
|
|
73
|
+
}) : /* @__PURE__ */ l("div", {
|
|
69
74
|
className: "space-y-1",
|
|
70
|
-
children: [/* @__PURE__ */
|
|
75
|
+
children: [/* @__PURE__ */ l("button", {
|
|
71
76
|
type: "button",
|
|
72
|
-
onClick: () =>
|
|
73
|
-
className: `w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-all duration-200 ${
|
|
74
|
-
children: [/* @__PURE__ */
|
|
77
|
+
onClick: () => A(T),
|
|
78
|
+
className: `w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-all duration-200 ${k === T ? "bg-bg-accent border-2 border-action-primary-border" : "hover:bg-action-ghost-bg-hover border-2 border-transparent"}`,
|
|
79
|
+
children: [/* @__PURE__ */ c(o, { className: "size-5 text-text-link" }), /* @__PURE__ */ c("span", {
|
|
75
80
|
className: "font-medium text-text-primary",
|
|
76
|
-
children: t(
|
|
81
|
+
children: t(w, "files.moveDialog.actions.moveHere", "Move here")
|
|
77
82
|
})]
|
|
78
|
-
}),
|
|
83
|
+
}), L.length === 0 ? /* @__PURE__ */ c("p", {
|
|
79
84
|
className: "text-sm text-text-secondary text-center py-4",
|
|
80
|
-
children: t(
|
|
81
|
-
}) :
|
|
82
|
-
className: `flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 ${
|
|
83
|
-
children: [/* @__PURE__ */
|
|
85
|
+
children: t(w, "files.moveDialog.empty.noSubfolders", "No subfolders")
|
|
86
|
+
}) : L.map((e) => /* @__PURE__ */ l("div", {
|
|
87
|
+
className: `flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 ${k === e.id ? "bg-bg-accent border-2 border-action-primary-border" : "hover:bg-action-ghost-bg-hover border-2 border-transparent"}`,
|
|
88
|
+
children: [/* @__PURE__ */ l("button", {
|
|
84
89
|
type: "button",
|
|
85
|
-
onClick: () =>
|
|
90
|
+
onClick: () => A(e.id),
|
|
86
91
|
className: "flex items-center gap-3 flex-1 min-w-0",
|
|
87
|
-
children: [/* @__PURE__ */
|
|
92
|
+
children: [/* @__PURE__ */ c(o, { className: "size-5 text-text-link flex-shrink-0" }), /* @__PURE__ */ c("span", {
|
|
88
93
|
className: "font-medium text-text-primary truncate",
|
|
89
94
|
children: e.name
|
|
90
95
|
})]
|
|
91
|
-
}), /* @__PURE__ */
|
|
96
|
+
}), /* @__PURE__ */ c("button", {
|
|
92
97
|
type: "button",
|
|
93
|
-
onClick: () =>
|
|
98
|
+
onClick: () => P(e),
|
|
94
99
|
className: "p-1.5 text-text-tertiary hover:text-text-secondary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 flex-shrink-0",
|
|
95
|
-
title: t(
|
|
96
|
-
"aria-label": t(
|
|
97
|
-
children: /* @__PURE__ */
|
|
100
|
+
title: t(w, "files.moveDialog.actions.openFolder", "Open folder"),
|
|
101
|
+
"aria-label": t(w, "files.moveDialog.actions.openFolderNamed", "Open {{name}}", { name: e.name }),
|
|
102
|
+
children: /* @__PURE__ */ c(a, { className: "size-4" })
|
|
98
103
|
})]
|
|
99
104
|
}, e.id))]
|
|
100
105
|
})
|
|
101
106
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ l(p, {
|
|
103
108
|
className: "px-6 py-4 border-t border-border-default",
|
|
104
|
-
children: [/* @__PURE__ */
|
|
109
|
+
children: [/* @__PURE__ */ c(u, {
|
|
105
110
|
type: "button",
|
|
106
111
|
variant: "outline",
|
|
107
|
-
onClick:
|
|
108
|
-
children: t(
|
|
109
|
-
}), /* @__PURE__ */
|
|
112
|
+
onClick: b,
|
|
113
|
+
children: t(w, "files.common.actions.cancel", "Cancel")
|
|
114
|
+
}), /* @__PURE__ */ l(u, {
|
|
115
|
+
busy: C && S,
|
|
116
|
+
busyLabel: C ? t(w, "files.moveDialog.actions.moving", "Moving...") : void 0,
|
|
110
117
|
type: "button",
|
|
111
|
-
onClick:
|
|
112
|
-
disabled:
|
|
113
|
-
children: [
|
|
118
|
+
onClick: I,
|
|
119
|
+
disabled: !C && S || k === void 0,
|
|
120
|
+
children: [!C && S && /* @__PURE__ */ c(r, {
|
|
121
|
+
tone: "current",
|
|
122
|
+
className: "size-4 animate-spin"
|
|
123
|
+
}), !C && S ? t(w, "files.moveDialog.actions.moving", "Moving...") : t(w, "files.common.actions.move", "Move")]
|
|
114
124
|
})]
|
|
115
125
|
})
|
|
116
126
|
]
|
|
117
127
|
})
|
|
118
128
|
});
|
|
119
129
|
};
|
|
120
|
-
export {
|
|
130
|
+
export { v as MoveDialog };
|
|
121
131
|
|
|
122
132
|
//# sourceMappingURL=MoveDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoveDialog.js","names":["MoveDialog","useI18n","currentFolderId","setCurrentFolderId","useState","breadcrumbs","setBreadcrumbs","selectedDestination","setSelectedDestination","loadingFolders","useFoldersQuery","folders","data","handleFolderNavigate","folder","handleBreadcrumbClick","index","crumb","handleMove","item","onMove","onClose","filteredFolders","type","ResponsiveDialog","next","isLoading","ResponsiveDialogContent","tWithFallback","t","ResponsiveDialogHeader","ResponsiveDialogTitle","Home","ChevronRight","Loader2","Folder","ResponsiveDialogFooter","Button"],"sources":["../../../src/files/components/MoveDialog.tsx"],"sourcesContent":["import { type FC, useState } from \"react\";\nimport { Folder, Home, ChevronRight, Loader2 } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogFooter,\n Button,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { useFoldersQuery } from \"../hooks/useFoldersQuery\";\nimport { tWithFallback } from \"../utils/i18n\";\n\ninterface MoveDialogProps {\n item: FileItem | FolderItem;\n type: \"file\" | \"folder\";\n onClose: () => void;\n onMove: (destinationFolderId: string | null) => Promise<void>;\n isLoading?: boolean;\n}\n\nexport const MoveDialog: FC<MoveDialogProps> = ({\n item,\n type,\n onClose,\n onMove,\n isLoading = false,\n}) => {\n const { t } = useI18n();\n const [currentFolderId, setCurrentFolderId] = useState<string | null>(null);\n const [breadcrumbs, setBreadcrumbs] = useState<\n Array<{ id: string; name: string }>\n >([]);\n // undefined = nothing selected yet; null = root selected; string = folder id selected\n const [selectedDestination, setSelectedDestination] = useState<\n string | null | undefined\n >(undefined);\n\n // Fetch folders in current location\n const { data, loading: loadingFolders } = useFoldersQuery(\n currentFolderId || undefined,\n );\n const folders = (data?.getFolders?.folders || []) as FolderItem[];\n\n const handleFolderNavigate = (folder: FolderItem) => {\n setCurrentFolderId(folder.id);\n setBreadcrumbs([...breadcrumbs, { id: folder.id, name: folder.name }]);\n setSelectedDestination(folder.id);\n };\n\n const handleBreadcrumbClick = (index: number) => {\n if (index === -1) {\n setCurrentFolderId(null);\n setBreadcrumbs([]);\n setSelectedDestination(null);\n } else {\n const crumb = breadcrumbs[index];\n setCurrentFolderId(crumb.id);\n setBreadcrumbs(breadcrumbs.slice(0, index + 1));\n setSelectedDestination(crumb.id);\n }\n };\n\n const handleMove = async () => {\n if (selectedDestination === undefined || selectedDestination === item.id) {\n return;\n }\n await onMove(selectedDestination);\n onClose();\n };\n\n const filteredFolders = folders.filter((folder) => {\n // Don't show the item itself if it's a folder\n if (type === \"folder\" && folder.id === item.id) {\n return false;\n }\n return true;\n });\n\n return (\n <ResponsiveDialog\n open\n onOpenChange={(next: boolean) => {\n if (!next && !isLoading) {\n onClose();\n }\n }}\n >\n <ResponsiveDialogContent\n className=\"flex max-h-[80vh] w-full max-w-md flex-col gap-0 p-0\"\n aria-label={tWithFallback(\n t,\n \"files.moveDialog.ariaLabel\",\n \"Move {{type}} {{name}}\",\n { type, name: item.name },\n )}\n >\n {/* Header */}\n <ResponsiveDialogHeader className=\"px-6 py-4 border-b border-border-default text-left\">\n <ResponsiveDialogTitle className=\"text-lg font-semibold text-text-primary\">\n {tWithFallback(t, \"files.moveDialog.title\", 'Move \"{{name}}\"', {\n name: item.name,\n })}\n </ResponsiveDialogTitle>\n </ResponsiveDialogHeader>\n\n {/* Breadcrumb navigation */}\n <div className=\"px-6 py-3 border-b border-border-default bg-bg-sunken\">\n <div className=\"flex items-center gap-2 text-sm overflow-x-auto\">\n <button\n type=\"button\"\n onClick={() => handleBreadcrumbClick(-1)}\n className=\"flex items-center gap-1.5 text-text-primary hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 whitespace-nowrap\"\n >\n <Home className=\"size-4\" />\n <span>\n {tWithFallback(t, \"files.browser.rootLabel\", \"My Drive\")}\n </span>\n </button>\n {breadcrumbs.map((crumb, index) => (\n <div\n key={crumb.id}\n className=\"flex items-center gap-2 whitespace-nowrap\"\n >\n <ChevronRight className=\"size-4 text-text-tertiary\" />\n <button\n type=\"button\"\n onClick={() => handleBreadcrumbClick(index)}\n className={`hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 ${\n index === breadcrumbs.length - 1\n ? \"text-text-primary font-medium\"\n : \"text-text-secondary\"\n }`}\n >\n {crumb.name}\n </button>\n </div>\n ))}\n </div>\n </div>\n\n {/* Folder list */}\n <div className=\"flex-1 overflow-y-auto px-6 py-4\">\n {loadingFolders ? (\n <div className=\"flex items-center justify-center py-8\">\n <Loader2 className=\"size-6 text-text-tertiary animate-spin\" />\n </div>\n ) : (\n <div className=\"space-y-1\">\n {/* Option to move to current folder */}\n <button\n type=\"button\"\n onClick={() => setSelectedDestination(currentFolderId)}\n className={`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-all duration-200 ${\n selectedDestination === currentFolderId\n ? \"bg-bg-accent border-2 border-action-primary-border\"\n : \"hover:bg-action-ghost-bg-hover border-2 border-transparent\"\n }`}\n >\n <Folder className=\"size-5 text-text-link\" />\n <span className=\"font-medium text-text-primary\">\n {tWithFallback(\n t,\n \"files.moveDialog.actions.moveHere\",\n \"Move here\",\n )}\n </span>\n </button>\n\n {filteredFolders.length === 0 ? (\n <p className=\"text-sm text-text-secondary text-center py-4\">\n {tWithFallback(\n t,\n \"files.moveDialog.empty.noSubfolders\",\n \"No subfolders\",\n )}\n </p>\n ) : (\n /* List of subfolders — clicking name selects, ChevronRight navigates in */\n filteredFolders.map((folder) => (\n <div\n key={folder.id}\n className={`flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 ${\n selectedDestination === folder.id\n ? \"bg-bg-accent border-2 border-action-primary-border\"\n : \"hover:bg-action-ghost-bg-hover border-2 border-transparent\"\n }`}\n >\n <button\n type=\"button\"\n onClick={() => setSelectedDestination(folder.id)}\n className=\"flex items-center gap-3 flex-1 min-w-0\"\n >\n <Folder className=\"size-5 text-text-link flex-shrink-0\" />\n <span className=\"font-medium text-text-primary truncate\">\n {folder.name}\n </span>\n </button>\n <button\n type=\"button\"\n onClick={() => handleFolderNavigate(folder)}\n className=\"p-1.5 text-text-tertiary hover:text-text-secondary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 flex-shrink-0\"\n title={tWithFallback(\n t,\n \"files.moveDialog.actions.openFolder\",\n \"Open folder\",\n )}\n aria-label={tWithFallback(\n t,\n \"files.moveDialog.actions.openFolderNamed\",\n \"Open {{name}}\",\n { name: folder.name },\n )}\n >\n <ChevronRight className=\"size-4\" />\n </button>\n </div>\n ))\n )}\n </div>\n )}\n </div>\n\n {/* Footer */}\n <ResponsiveDialogFooter className=\"px-6 py-4 border-t border-border-default\">\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.cancel\", \"Cancel\")}\n </Button>\n <Button\n type=\"button\"\n onClick={handleMove}\n disabled={isLoading || selectedDestination === undefined}\n >\n {isLoading && <Loader2 className=\"size-4 animate-spin\" />}\n {isLoading\n ? tWithFallback(t, \"files.moveDialog.actions.moving\", \"Moving...\")\n : tWithFallback(t, \"files.common.actions.move\", \"Move\")}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n};\n"],"mappings":";;;;;;;;AAuBA,IAAaA,KAAmC,EAC9C,SACA,SACA,YACA,WACA,eAAY,SACR;CACJ,IAAM,EAAE,SAAMC,EAAQ,GAChB,CAACC,GAAiBC,KAAsBC,EAAwB,IAAI,GACpE,CAACC,GAAaC,KAAkBF,EAEpC,CAAC,CAAC,GAEE,CAACG,GAAqBC,KAA0BJ,EAEpD,KAAA,CAAS,GAGL,EAAE,SAAM,SAASK,MAAmBC,EACxCR,KAAmB,KAAA,CACrB,GACMS,IAAWC,GAAM,YAA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SACb,UAAArB,EAAO;QACJ,CAAA,CACA;OACR,CAAA,GAAA,kBAAC,UAAD;QACE,MAAK;QACL,eAAeD,EAAqBC,CAAM;QAC1C,WAAU;QACV,OAAOc,EACLC,GACA,uCACA,aACF;QACA,cAAYD,EACVC,GACA,4CACA,iBACA,EAAE,MAAMf,EAAO,KAAK,CACtB;QAEA,UAAA,kBAACmB,GAAD,EAAc,WAAU,SAAU,CAAA;OAC5B,CAAA,CACL;MAnCE,GAAAnB,EAAO,EAmCT,CACN,CAEA;;IAEJ,CAAA;IAGL,kBAACsB,GAAD;KAAwB,WAAU;KAAlC,UAAA,CACE,kBAACC,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,SAAShB;MAC9C,UAAAO,EAAcC,GAAG,+BAA+B,QAAQ;KACnD,CAAA,GACR,kBAACQ,GAAD;MACE,MAAK;MACL,SAASnB;MACT,UAAUQ,KAAanB,MAAwB,KAAA;MAHjD,UAAA,CAKGmB,KAAa,kBAACQ,GAAD,EAAS,WAAU,sBAAuB,CAAA,GACvDR,IACGE,EAAcC,GAAG,mCAAmC,WAAW,IAC/DD,EAAcC,GAAG,6BAA6B,MAAM,CAClD;KACc,CAAA,CAAA;;GACD;;CACT,CAAA;AAEtB"}
|
|
1
|
+
{"version":3,"file":"MoveDialog.js","names":["MoveDialog","loadingSystem","useLoadingSystem","useI18n","currentFolderId","setCurrentFolderId","useState","breadcrumbs","setBreadcrumbs","selectedDestination","setSelectedDestination","loadingFolders","useFoldersQuery","folders","data","handleFolderNavigate","folder","handleBreadcrumbClick","index","crumb","handleMove","item","onMove","onClose","filteredFolders","type","ResponsiveDialog","next","isLoading","ResponsiveDialogContent","tWithFallback","t","ResponsiveDialogHeader","ResponsiveDialogTitle","Home","ChevronRight","SectionLoaderOr","SpinnerIcon","Folder","ResponsiveDialogFooter","Button"],"sources":["../../../src/files/components/MoveDialog.tsx"],"sourcesContent":["import { type FC, useState } from \"react\";\nimport { Folder, Home, ChevronRight } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogFooter,\n Button,\n} from \"@burdenoff/fe-libs/ui\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { useFoldersQuery } from \"../hooks/useFoldersQuery\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { useLoadingSystem } from \"@burdenoff/fe-libs/ui/loading/LoadingSystemProvider\";\nimport { SectionLoaderOr, SpinnerIcon } from \"./loadingSystem\";\n\ninterface MoveDialogProps {\n item: FileItem | FolderItem;\n type: \"file\" | \"folder\";\n onClose: () => void;\n onMove: (destinationFolderId: string | null) => Promise<void>;\n isLoading?: boolean;\n}\n\nexport const MoveDialog: FC<MoveDialogProps> = ({\n item,\n type,\n onClose,\n onMove,\n isLoading = false,\n}) => {\n const loadingSystem = useLoadingSystem();\n const { t } = useI18n();\n const [currentFolderId, setCurrentFolderId] = useState<string | null>(null);\n const [breadcrumbs, setBreadcrumbs] = useState<\n Array<{ id: string; name: string }>\n >([]);\n // undefined = nothing selected yet; null = root selected; string = folder id selected\n const [selectedDestination, setSelectedDestination] = useState<\n string | null | undefined\n >(undefined);\n\n // Fetch folders in current location\n const { data, loading: loadingFolders } = useFoldersQuery(\n currentFolderId || undefined,\n );\n const folders = (data?.getFolders?.folders || []) as FolderItem[];\n\n const handleFolderNavigate = (folder: FolderItem) => {\n setCurrentFolderId(folder.id);\n setBreadcrumbs([...breadcrumbs, { id: folder.id, name: folder.name }]);\n setSelectedDestination(folder.id);\n };\n\n const handleBreadcrumbClick = (index: number) => {\n if (index === -1) {\n setCurrentFolderId(null);\n setBreadcrumbs([]);\n setSelectedDestination(null);\n } else {\n const crumb = breadcrumbs[index];\n setCurrentFolderId(crumb.id);\n setBreadcrumbs(breadcrumbs.slice(0, index + 1));\n setSelectedDestination(crumb.id);\n }\n };\n\n const handleMove = async () => {\n if (selectedDestination === undefined || selectedDestination === item.id) {\n return;\n }\n await onMove(selectedDestination);\n onClose();\n };\n\n const filteredFolders = folders.filter((folder) => {\n // Don't show the item itself if it's a folder\n if (type === \"folder\" && folder.id === item.id) {\n return false;\n }\n return true;\n });\n\n return (\n <ResponsiveDialog\n open\n onOpenChange={(next: boolean) => {\n if (!next && !isLoading) {\n onClose();\n }\n }}\n >\n <ResponsiveDialogContent\n className=\"flex max-h-[80vh] w-full max-w-md flex-col gap-0 p-0\"\n aria-label={tWithFallback(\n t,\n \"files.moveDialog.ariaLabel\",\n \"Move {{type}} {{name}}\",\n { type, name: item.name },\n )}\n >\n {/* Header */}\n <ResponsiveDialogHeader className=\"px-6 py-4 border-b border-border-default text-left\">\n <ResponsiveDialogTitle className=\"text-lg font-semibold text-text-primary\">\n {tWithFallback(t, \"files.moveDialog.title\", 'Move \"{{name}}\"', {\n name: item.name,\n })}\n </ResponsiveDialogTitle>\n </ResponsiveDialogHeader>\n\n {/* Breadcrumb navigation */}\n <div className=\"px-6 py-3 border-b border-border-default bg-bg-sunken\">\n <div className=\"flex items-center gap-2 text-sm overflow-x-auto\">\n <button\n type=\"button\"\n onClick={() => handleBreadcrumbClick(-1)}\n className=\"flex items-center gap-1.5 text-text-primary hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 whitespace-nowrap\"\n >\n <Home className=\"size-4\" />\n <span>\n {tWithFallback(t, \"files.browser.rootLabel\", \"My Drive\")}\n </span>\n </button>\n {breadcrumbs.map((crumb, index) => (\n <div\n key={crumb.id}\n className=\"flex items-center gap-2 whitespace-nowrap\"\n >\n <ChevronRight className=\"size-4 text-text-tertiary\" />\n <button\n type=\"button\"\n onClick={() => handleBreadcrumbClick(index)}\n className={`hover:bg-action-ghost-bg-hover px-2 py-1 rounded transition-colors duration-200 ${\n index === breadcrumbs.length - 1\n ? \"text-text-primary font-medium\"\n : \"text-text-secondary\"\n }`}\n >\n {crumb.name}\n </button>\n </div>\n ))}\n </div>\n </div>\n\n {/* Folder list */}\n <div className=\"flex-1 overflow-y-auto px-6 py-4\">\n {loadingFolders ? (\n <SectionLoaderOr\n minHeight=\"6rem\"\n today={\n <div className=\"flex items-center justify-center py-8\">\n <SpinnerIcon className=\"size-6 text-text-tertiary animate-spin\" />\n </div>\n }\n />\n ) : (\n <div className=\"space-y-1\">\n {/* Option to move to current folder */}\n <button\n type=\"button\"\n onClick={() => setSelectedDestination(currentFolderId)}\n className={`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-left transition-all duration-200 ${\n selectedDestination === currentFolderId\n ? \"bg-bg-accent border-2 border-action-primary-border\"\n : \"hover:bg-action-ghost-bg-hover border-2 border-transparent\"\n }`}\n >\n <Folder className=\"size-5 text-text-link\" />\n <span className=\"font-medium text-text-primary\">\n {tWithFallback(\n t,\n \"files.moveDialog.actions.moveHere\",\n \"Move here\",\n )}\n </span>\n </button>\n\n {filteredFolders.length === 0 ? (\n <p className=\"text-sm text-text-secondary text-center py-4\">\n {tWithFallback(\n t,\n \"files.moveDialog.empty.noSubfolders\",\n \"No subfolders\",\n )}\n </p>\n ) : (\n /* List of subfolders — clicking name selects, ChevronRight navigates in */\n filteredFolders.map((folder) => (\n <div\n key={folder.id}\n className={`flex items-center justify-between gap-3 px-3 py-2.5 rounded-lg transition-all duration-200 ${\n selectedDestination === folder.id\n ? \"bg-bg-accent border-2 border-action-primary-border\"\n : \"hover:bg-action-ghost-bg-hover border-2 border-transparent\"\n }`}\n >\n <button\n type=\"button\"\n onClick={() => setSelectedDestination(folder.id)}\n className=\"flex items-center gap-3 flex-1 min-w-0\"\n >\n <Folder className=\"size-5 text-text-link flex-shrink-0\" />\n <span className=\"font-medium text-text-primary truncate\">\n {folder.name}\n </span>\n </button>\n <button\n type=\"button\"\n onClick={() => handleFolderNavigate(folder)}\n className=\"p-1.5 text-text-tertiary hover:text-text-secondary hover:bg-action-ghost-bg-hover rounded transition-colors duration-200 flex-shrink-0\"\n title={tWithFallback(\n t,\n \"files.moveDialog.actions.openFolder\",\n \"Open folder\",\n )}\n aria-label={tWithFallback(\n t,\n \"files.moveDialog.actions.openFolderNamed\",\n \"Open {{name}}\",\n { name: folder.name },\n )}\n >\n <ChevronRight className=\"size-4\" />\n </button>\n </div>\n ))\n )}\n </div>\n )}\n </div>\n\n {/* Footer */}\n <ResponsiveDialogFooter className=\"px-6 py-4 border-t border-border-default\">\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, \"files.common.actions.cancel\", \"Cancel\")}\n </Button>\n <Button\n busy={loadingSystem && isLoading}\n busyLabel={\n loadingSystem\n ? tWithFallback(\n t,\n \"files.moveDialog.actions.moving\",\n \"Moving...\",\n )\n : undefined\n }\n type=\"button\"\n onClick={handleMove}\n disabled={\n (!loadingSystem && isLoading) || selectedDestination === undefined\n }\n >\n {!loadingSystem && isLoading && (\n <SpinnerIcon tone=\"current\" className=\"size-4 animate-spin\" />\n )}\n {!loadingSystem && isLoading\n ? tWithFallback(t, \"files.moveDialog.actions.moving\", \"Moving...\")\n : tWithFallback(t, \"files.common.actions.move\", \"Move\")}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n};\n"],"mappings":";;;;;;;;;;AAyBA,IAAaA,KAAmC,EAC9C,SACA,SACA,YACA,WACA,eAAY,SACR;CACJ,IAAMC,IAAgBC,EAAiB,GACjC,EAAE,SAAMC,EAAQ,GAChB,CAACC,GAAiBC,KAAsBC,EAAwB,IAAI,GACpE,CAACC,GAAaC,KAAkBF,EAEpC,CAAC,CAAC,GAEE,CAACG,GAAqBC,KAA0BJ,EAEpD,KAAA,CAAS,GAGL,EAAE,SAAM,SAASK,MAAmBC,EACxCR,KAAmB,KAAA,CACrB,GACMS,IAAWC,GAAM,YAAY,WAAW,CAAC,GAEzCC,KAAwB,MAAuB;EAGnD,AAFAV,EAAmBW,EAAO,EAAE,GAC5BR,EAAe,CAAC,GAAGD,GAAa;GAAE,IAAIS,EAAO;GAAI,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,EAAqBC,CAAM;QAC1C,WAAU;QACV,OAAOc,EACLC,GACA,uCACA,aACF;QACA,cAAYD,EACVC,GACA,4CACA,iBACA,EAAE,MAAMf,EAAO,KAAK,CACtB;QAEA,UAAA,kBAACmB,GAAD,EAAc,WAAU,SAAU,CAAA;OAC5B,CAAA,CACL;MAnCE,GAAAnB,EAAO,EAmCT,CACN,CAEA;;IAEJ,CAAA;IAGL,kBAACuB,GAAD;KAAwB,WAAU;KAAlC,UAAA,CACE,kBAACC,GAAD;MAAQ,MAAK;MAAS,SAAQ;MAAU,SAASjB;MAC9C,UAAAO,EAAcC,GAAG,+BAA+B,QAAQ;KACnD,CAAA,GACR,kBAACS,GAAD;MACE,MAAMvC,KAAiB2B;MACvB,WACE3B,IACI6B,EACEC,GACA,mCACA,WACF,IACA,KAAA;MAEN,MAAK;MACL,SAASX;MACT,UACG,CAACnB,KAAiB2B,KAAcnB,MAAwB,KAAA;MAd7D,UAAA,CAiBG,CAACR,KAAiB2B,KACjB,kBAACS,GAAD;OAAa,MAAK;OAAU,WAAU;MAAuB,CAAA,GAE9D,CAACpC,KAAiB2B,IACfE,EAAcC,GAAG,mCAAmC,WAAW,IAC/DD,EAAcC,GAAG,6BAA6B,MAAM,CAClD;KACc,CAAA,CAAA;;GACD;;CACT,CAAA;AAEtB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { tWithFallback as e } from "../utils/i18n.js";
|
|
2
2
|
import { formatFileSize as t } from "../utils/index.js";
|
|
3
3
|
import { SharedFolderView as n } from "./SharedFolderView.js";
|
|
4
|
-
import {
|
|
4
|
+
import { SpinnerIcon as r } from "./loadingSystem.js";
|
|
5
|
+
import { Download as i, Eye as a, FileText as o, Lock as s } from "lucide-react";
|
|
5
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
7
|
import { Button as u, PagePurpose as d, ShowTechnicalDetails as f } from "@burdenoff/fe-libs/ui";
|
|
7
8
|
import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
@@ -24,16 +25,16 @@ function h() {
|
|
|
24
25
|
return /* @__PURE__ */ l("div", {
|
|
25
26
|
role: "status",
|
|
26
27
|
className: "flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3 text-sm text-text-secondary",
|
|
27
|
-
children: [/* @__PURE__ */ c(
|
|
28
|
+
children: [/* @__PURE__ */ c(r, { className: "size-4 animate-spin text-action-primary-bg" }), e(t, "files.share.verifying", "Verifying share access…")]
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
function g({ file: n, canDownload:
|
|
31
|
+
function g({ file: n, canDownload: r, onPreview: s, onDownload: d }) {
|
|
31
32
|
let { t: f } = p();
|
|
32
33
|
return /* @__PURE__ */ l("div", {
|
|
33
34
|
className: "space-y-4",
|
|
34
35
|
children: [/* @__PURE__ */ l("div", {
|
|
35
36
|
className: "flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3",
|
|
36
|
-
children: [/* @__PURE__ */ c(
|
|
37
|
+
children: [/* @__PURE__ */ c(o, { className: "size-5 shrink-0 text-text-tertiary" }), /* @__PURE__ */ l("div", {
|
|
37
38
|
className: "min-w-0",
|
|
38
39
|
children: [/* @__PURE__ */ c("p", {
|
|
39
40
|
className: "truncate text-sm font-medium text-text-primary",
|
|
@@ -50,12 +51,12 @@ function g({ file: n, canDownload: o, onPreview: s, onDownload: d }) {
|
|
|
50
51
|
variant: "outline",
|
|
51
52
|
className: "flex-1",
|
|
52
53
|
onClick: s,
|
|
53
|
-
children: [/* @__PURE__ */ c(
|
|
54
|
-
}),
|
|
54
|
+
children: [/* @__PURE__ */ c(a, { className: "size-4" }), e(f, "files.share.openPreview", "Open preview")]
|
|
55
|
+
}), r && /* @__PURE__ */ l(u, {
|
|
55
56
|
type: "button",
|
|
56
57
|
className: "flex-1",
|
|
57
58
|
onClick: d,
|
|
58
|
-
children: [/* @__PURE__ */ c(
|
|
59
|
+
children: [/* @__PURE__ */ c(i, { className: "size-4" }), e(f, "files.share.download", "Download")]
|
|
59
60
|
})]
|
|
60
61
|
})]
|
|
61
62
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareAccessParts.js","names":["ShareAccessHeader","useI18n","isFolder","tWithFallback","t","PagePurpose","ShareAccessVerifying","Loader2","SharedFileSummary","FileText","file","formatFileSize","Button","onPreview","Eye","canDownload","onDownload","Download","SharePasswordForm","Lock","password","onPasswordChange","event","invalid","ShareUnavailable","unavailable","technicalDetails","ShowTechnicalDetails","onRetry","ShareAccessBody","props","loading","share","SharedFolderView","sharedFile","failure"],"sources":["../../../src/files/components/ShareAccessParts.tsx"],"sourcesContent":["/**\n * Pieces of the public share page (`/files/share/:token`, BOFF-11865), split\n * out so the page itself only decides which one to show.\n */\nimport type { FormEvent } from \"react\";\nimport { Download, Eye, FileText, Loader2, Lock } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n Button,\n PagePurpose,\n ShowTechnicalDetails,\n} from \"@burdenoff/fe-libs/ui\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { formatFileSize } from \"../utils\";\nimport type { ShareAccessFailure } from \"../utils/shareAccess\";\nimport type { PublicShareResult, SharedFolderFile } from \"../utils/publicShare\";\nimport { SharedFolderView } from \"./SharedFolderView\";\n\n/** The page title and purpose line, worded for a file or a folder link. */\nexport function ShareAccessHeader({ isFolder }: { isFolder: boolean }) {\n const { t } = useI18n();\n return (\n <div className=\"mb-6\">\n <h1 className=\"text-xl font-semibold text-text-primary\">\n {isFolder\n ? tWithFallback(t, \"files.share.folder.title\", \"Shared folder\")\n : tWithFallback(t, \"files.share.title\", \"Shared file access\")}\n </h1>\n <PagePurpose className=\"mt-2\">\n {isFolder\n ? tWithFallback(\n t,\n \"files.share.folder.subtitle\",\n \"Someone shared a folder with you via a link. Preview and download its files here — if the link is password-protected, enter the password the sender gave you to unlock it.\",\n )\n : tWithFallback(\n t,\n \"files.share.subtitle\",\n \"Someone shared a file with you via a link. Preview and download it here — if the link is password-protected, enter the password the sender gave you to unlock it.\",\n )}\n </PagePurpose>\n </div>\n );\n}\n\n/** Shown while the link is being checked. */\nexport function ShareAccessVerifying() {\n const { t } = useI18n();\n return (\n <div\n role=\"status\"\n className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3 text-sm text-text-secondary\"\n >\n <Loader2 className=\"size-4 animate-spin text-action-primary-bg\" />\n {tWithFallback(t, \"files.share.verifying\", \"Verifying share access…\")}\n </div>\n );\n}\n\n/** A shared file, with Open preview and (when allowed) Download. */\nexport function SharedFileSummary({\n file,\n canDownload,\n onPreview,\n onDownload,\n}: {\n file: { name: string; size: number };\n canDownload: boolean;\n onPreview: () => void;\n onDownload: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3\">\n <FileText className=\"size-5 shrink-0 text-text-tertiary\" />\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {file.name}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {formatFileSize(file.size)}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2 sm:flex-row\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"flex-1\"\n onClick={onPreview}\n >\n <Eye className=\"size-4\" />\n {tWithFallback(t, \"files.share.openPreview\", \"Open preview\")}\n </Button>\n {canDownload && (\n <Button type=\"button\" className=\"flex-1\" onClick={onDownload}>\n <Download className=\"size-4\" />\n {tWithFallback(t, \"files.share.download\", \"Download\")}\n </Button>\n )}\n </div>\n </div>\n );\n}\n\n/** Asks for the link's password; says so plainly when it was wrong. */\nexport function SharePasswordForm({\n isFolder,\n invalid,\n password,\n onPasswordChange,\n onSubmit,\n}: {\n isFolder: boolean;\n invalid: boolean;\n password: string;\n onPasswordChange: (value: string) => void;\n onSubmit: (event: FormEvent<HTMLFormElement>) => void;\n}) {\n const { t } = useI18n();\n return (\n <form className=\"space-y-4\" onSubmit={onSubmit}>\n <label className=\"block text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.share.password.label\", \"Share password\")}\n <div className=\"mt-2 flex items-center gap-2 rounded-lg border border-border-seam px-3 py-2\">\n <Lock className=\"size-4 text-text-tertiary\" />\n <input\n type=\"password\"\n value={password}\n onChange={(event) => onPasswordChange(event.target.value)}\n aria-label={tWithFallback(\n t,\n \"files.share.password.label\",\n \"Share password\",\n )}\n className=\"w-full bg-transparent text-sm text-text-primary outline-none\"\n placeholder={tWithFallback(\n t,\n \"files.share.password.placeholder\",\n \"Enter the share password\",\n )}\n />\n </div>\n </label>\n\n {invalid && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.errors.wrongPassword\",\n \"That password didn't work. Check it with the person who shared the link and try again.\",\n )}\n </div>\n )}\n\n <button\n type=\"submit\"\n disabled={!password.trim()}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover disabled:cursor-not-allowed disabled:bg-bg-sunken disabled:text-text-tertiary\"\n >\n {isFolder\n ? tWithFallback(\n t,\n \"files.share.folder.unlock\",\n \"Unlock shared folder\",\n )\n : tWithFallback(t, \"files.share.unlock\", \"Unlock shared file\")}\n </button>\n </form>\n );\n}\n\n/** One plain sentence when the link can't be opened, and a retry button. */\nexport function ShareUnavailable({\n unavailable,\n technicalDetails = null,\n onRetry,\n}: {\n unavailable: boolean;\n /** Raw failure text for \"Show technical details\" (Navigation v2 only). */\n technicalDetails?: string | null;\n onRetry: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n {unavailable && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.errors.unavailable\",\n \"This link has expired or is no longer available.\",\n )}\n </div>\n )}\n {unavailable && technicalDetails && (\n <ShowTechnicalDetails copyable>{technicalDetails}</ShowTechnicalDetails>\n )}\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover\"\n >\n {tWithFallback(t, \"files.share.retry\", \"Retry shared file access\")}\n </button>\n </div>\n );\n}\n\nexport interface ShareAccessBodyProps {\n loading: boolean;\n share: PublicShareResult | null;\n /** The shared file, once a file link opened. */\n sharedFile: {\n name: string;\n size: number;\n downloadUrl?: string;\n url: string;\n } | null;\n failure: ShareAccessFailure | null;\n /**\n * Raw text of the last failure, shown under \"Show technical details\" below\n * the plain sentence. Null keeps it out of the page (every app but\n * FluidGrids' Navigation v2).\n */\n failureDetail?: string | null;\n isFolder: boolean;\n password: string;\n busyFileId: string | null;\n failedFileId: string | null;\n onPasswordChange: (value: string) => void;\n onPasswordSubmit: (event: FormEvent<HTMLFormElement>) => void;\n onRetry: () => void;\n onOpenPreview: () => void;\n onDownload: () => void;\n onFolderPreview: (file: SharedFolderFile) => void;\n onFolderDownload: (file: SharedFolderFile) => void;\n}\n\n/** Picks what the share card shows: checking, folder, file, password or error. */\nexport function ShareAccessBody(props: ShareAccessBodyProps) {\n const { loading, share, sharedFile, failure } = props;\n if (loading) return <ShareAccessVerifying />;\n if (share?.kind === \"folder\") {\n return (\n <SharedFolderView\n folderName={share.folder.name}\n files={share.files}\n truncated={share.truncated}\n busyFileId={props.busyFileId}\n failedFileId={props.failedFileId}\n onPreview={props.onFolderPreview}\n onDownload={props.onFolderDownload}\n />\n );\n }\n if (sharedFile) {\n return (\n <SharedFileSummary\n file={sharedFile}\n canDownload={Boolean(sharedFile.downloadUrl || sharedFile.url)}\n onPreview={props.onOpenPreview}\n onDownload={props.onDownload}\n />\n );\n }\n if (failure === \"password-required\" || failure === \"password-invalid\") {\n return (\n <SharePasswordForm\n isFolder={props.isFolder}\n invalid={failure === \"password-invalid\"}\n password={props.password}\n onPasswordChange={props.onPasswordChange}\n onSubmit={props.onPasswordSubmit}\n />\n );\n }\n return (\n <ShareUnavailable\n unavailable={failure === \"unavailable\"}\n technicalDetails={props.failureDetail ?? null}\n onRetry={props.onRetry}\n />\n );\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgBA,EAAkB,EAAE,eAAmC;CACrE,IAAM,EAAE,SAAMC,EAAQ;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,MAAD;GAAI,WAAU;GACX,UAAAC,IACGC,EAAcC,GAAG,4BAA4B,eAAe,IAC5DD,EAAcC,GAAG,qBAAqB,oBAAoB;EAC5D,CAAA,GACJ,kBAACC,GAAD;GAAa,WAAU;GACpB,UAAAH,IACGC,EACEC,GACA,+BACA,4KACF,IACAD,EACEC,GACA,wBACA,mKACF;EACO,CAAA,CACV;;AAET;AAGA,SAAgBE,IAAuB;CACrC,IAAM,EAAE,MAAML,EAAQ;CACtB,OACE,kBAAC,OAAD;EACE,MAAK;EACL,WAAU;EAFZ,UAAA,CAIE,kBAACM,GAAD,EAAS,WAAU,6CAA8C,CAAA,GAChEJ,EAAc,GAAG,yBAAyB,yBAAyB,CACjE;;AAET;AAGA,SAAgBK,EAAkB,EAChC,SACA,gBACA,cACA,iBAMC;CACD,IAAM,EAAE,SAAMP,EAAQ;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACQ,GAAD,EAAU,WAAU,qCAAsC,CAAA,GAC1D,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAC,EAAK;IACL,CAAA,GACH,kBAAC,KAAD;KAAG,WAAU;KACV,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n","isFolder","tWithFallback","t","PagePurpose","ShareAccessVerifying","SpinnerIcon","SharedFileSummary","FileText","file","formatFileSize","Button","onPreview","Eye","canDownload","onDownload","Download","SharePasswordForm","Lock","password","onPasswordChange","event","invalid","ShareUnavailable","unavailable","technicalDetails","ShowTechnicalDetails","onRetry","ShareAccessBody","props","loading","share","SharedFolderView","sharedFile","failure"],"sources":["../../../src/files/components/ShareAccessParts.tsx"],"sourcesContent":["/**\n * Pieces of the public share page (`/files/share/:token`, BOFF-11865), split\n * out so the page itself only decides which one to show.\n */\nimport type { FormEvent } from \"react\";\nimport { Download, Eye, FileText, Lock } from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport {\n Button,\n PagePurpose,\n ShowTechnicalDetails,\n} from \"@burdenoff/fe-libs/ui\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { formatFileSize } from \"../utils\";\nimport type { ShareAccessFailure } from \"../utils/shareAccess\";\nimport type { PublicShareResult, SharedFolderFile } from \"../utils/publicShare\";\nimport { SharedFolderView } from \"./SharedFolderView\";\nimport { SpinnerIcon } from \"./loadingSystem\";\n\n/** The page title and purpose line, worded for a file or a folder link. */\nexport function ShareAccessHeader({ isFolder }: { isFolder: boolean }) {\n const { t } = useI18n();\n return (\n <div className=\"mb-6\">\n <h1 className=\"text-xl font-semibold text-text-primary\">\n {isFolder\n ? tWithFallback(t, \"files.share.folder.title\", \"Shared folder\")\n : tWithFallback(t, \"files.share.title\", \"Shared file access\")}\n </h1>\n <PagePurpose className=\"mt-2\">\n {isFolder\n ? tWithFallback(\n t,\n \"files.share.folder.subtitle\",\n \"Someone shared a folder with you via a link. Preview and download its files here — if the link is password-protected, enter the password the sender gave you to unlock it.\",\n )\n : tWithFallback(\n t,\n \"files.share.subtitle\",\n \"Someone shared a file with you via a link. Preview and download it here — if the link is password-protected, enter the password the sender gave you to unlock it.\",\n )}\n </PagePurpose>\n </div>\n );\n}\n\n/** Shown while the link is being checked. */\nexport function ShareAccessVerifying() {\n const { t } = useI18n();\n return (\n <div\n role=\"status\"\n className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3 text-sm text-text-secondary\"\n >\n <SpinnerIcon className=\"size-4 animate-spin text-action-primary-bg\" />\n {tWithFallback(t, \"files.share.verifying\", \"Verifying share access…\")}\n </div>\n );\n}\n\n/** A shared file, with Open preview and (when allowed) Download. */\nexport function SharedFileSummary({\n file,\n canDownload,\n onPreview,\n onDownload,\n}: {\n file: { name: string; size: number };\n canDownload: boolean;\n onPreview: () => void;\n onDownload: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n <div className=\"flex items-center gap-3 rounded-lg border border-border-seam bg-bg-sunken px-4 py-3\">\n <FileText className=\"size-5 shrink-0 text-text-tertiary\" />\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {file.name}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {formatFileSize(file.size)}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2 sm:flex-row\">\n <Button\n type=\"button\"\n variant=\"outline\"\n className=\"flex-1\"\n onClick={onPreview}\n >\n <Eye className=\"size-4\" />\n {tWithFallback(t, \"files.share.openPreview\", \"Open preview\")}\n </Button>\n {canDownload && (\n <Button type=\"button\" className=\"flex-1\" onClick={onDownload}>\n <Download className=\"size-4\" />\n {tWithFallback(t, \"files.share.download\", \"Download\")}\n </Button>\n )}\n </div>\n </div>\n );\n}\n\n/** Asks for the link's password; says so plainly when it was wrong. */\nexport function SharePasswordForm({\n isFolder,\n invalid,\n password,\n onPasswordChange,\n onSubmit,\n}: {\n isFolder: boolean;\n invalid: boolean;\n password: string;\n onPasswordChange: (value: string) => void;\n onSubmit: (event: FormEvent<HTMLFormElement>) => void;\n}) {\n const { t } = useI18n();\n return (\n <form className=\"space-y-4\" onSubmit={onSubmit}>\n <label className=\"block text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.share.password.label\", \"Share password\")}\n <div className=\"mt-2 flex items-center gap-2 rounded-lg border border-border-seam px-3 py-2\">\n <Lock className=\"size-4 text-text-tertiary\" />\n <input\n type=\"password\"\n value={password}\n onChange={(event) => onPasswordChange(event.target.value)}\n aria-label={tWithFallback(\n t,\n \"files.share.password.label\",\n \"Share password\",\n )}\n className=\"w-full bg-transparent text-sm text-text-primary outline-none\"\n placeholder={tWithFallback(\n t,\n \"files.share.password.placeholder\",\n \"Enter the share password\",\n )}\n />\n </div>\n </label>\n\n {invalid && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.errors.wrongPassword\",\n \"That password didn't work. Check it with the person who shared the link and try again.\",\n )}\n </div>\n )}\n\n <button\n type=\"submit\"\n disabled={!password.trim()}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover disabled:cursor-not-allowed disabled:bg-bg-sunken disabled:text-text-tertiary\"\n >\n {isFolder\n ? tWithFallback(\n t,\n \"files.share.folder.unlock\",\n \"Unlock shared folder\",\n )\n : tWithFallback(t, \"files.share.unlock\", \"Unlock shared file\")}\n </button>\n </form>\n );\n}\n\n/** One plain sentence when the link can't be opened, and a retry button. */\nexport function ShareUnavailable({\n unavailable,\n technicalDetails = null,\n onRetry,\n}: {\n unavailable: boolean;\n /** Raw failure text for \"Show technical details\" (Navigation v2 only). */\n technicalDetails?: string | null;\n onRetry: () => void;\n}) {\n const { t } = useI18n();\n return (\n <div className=\"space-y-4\">\n {unavailable && (\n <div\n role=\"alert\"\n className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {tWithFallback(\n t,\n \"files.share.errors.unavailable\",\n \"This link has expired or is no longer available.\",\n )}\n </div>\n )}\n {unavailable && technicalDetails && (\n <ShowTechnicalDetails copyable>{technicalDetails}</ShowTechnicalDetails>\n )}\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover\"\n >\n {tWithFallback(t, \"files.share.retry\", \"Retry shared file access\")}\n </button>\n </div>\n );\n}\n\nexport interface ShareAccessBodyProps {\n loading: boolean;\n share: PublicShareResult | null;\n /** The shared file, once a file link opened. */\n sharedFile: {\n name: string;\n size: number;\n downloadUrl?: string;\n url: string;\n } | null;\n failure: ShareAccessFailure | null;\n /**\n * Raw text of the last failure, shown under \"Show technical details\" below\n * the plain sentence. Null keeps it out of the page (every app but\n * FluidGrids' Navigation v2).\n */\n failureDetail?: string | null;\n isFolder: boolean;\n password: string;\n busyFileId: string | null;\n failedFileId: string | null;\n onPasswordChange: (value: string) => void;\n onPasswordSubmit: (event: FormEvent<HTMLFormElement>) => void;\n onRetry: () => void;\n onOpenPreview: () => void;\n onDownload: () => void;\n onFolderPreview: (file: SharedFolderFile) => void;\n onFolderDownload: (file: SharedFolderFile) => void;\n}\n\n/** Picks what the share card shows: checking, folder, file, password or error. */\nexport function ShareAccessBody(props: ShareAccessBodyProps) {\n const { loading, share, sharedFile, failure } = props;\n if (loading) return <ShareAccessVerifying />;\n if (share?.kind === \"folder\") {\n return (\n <SharedFolderView\n folderName={share.folder.name}\n files={share.files}\n truncated={share.truncated}\n busyFileId={props.busyFileId}\n failedFileId={props.failedFileId}\n onPreview={props.onFolderPreview}\n onDownload={props.onFolderDownload}\n />\n );\n }\n if (sharedFile) {\n return (\n <SharedFileSummary\n file={sharedFile}\n canDownload={Boolean(sharedFile.downloadUrl || sharedFile.url)}\n onPreview={props.onOpenPreview}\n onDownload={props.onDownload}\n />\n );\n }\n if (failure === \"password-required\" || failure === \"password-invalid\") {\n return (\n <SharePasswordForm\n isFolder={props.isFolder}\n invalid={failure === \"password-invalid\"}\n password={props.password}\n onPasswordChange={props.onPasswordChange}\n onSubmit={props.onPasswordSubmit}\n />\n );\n }\n return (\n <ShareUnavailable\n unavailable={failure === \"unavailable\"}\n technicalDetails={props.failureDetail ?? null}\n onRetry={props.onRetry}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAgBA,EAAkB,EAAE,eAAmC;CACrE,IAAM,EAAE,SAAMC,EAAQ;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,MAAD;GAAI,WAAU;GACX,UAAAC,IACGC,EAAcC,GAAG,4BAA4B,eAAe,IAC5DD,EAAcC,GAAG,qBAAqB,oBAAoB;EAC5D,CAAA,GACJ,kBAACC,GAAD;GAAa,WAAU;GACpB,UAAAH,IACGC,EACEC,GACA,+BACA,4KACF,IACAD,EACEC,GACA,wBACA,mKACF;EACO,CAAA,CACV;;AAET;AAGA,SAAgBE,IAAuB;CACrC,IAAM,EAAE,MAAML,EAAQ;CACtB,OACE,kBAAC,OAAD;EACE,MAAK;EACL,WAAU;EAFZ,UAAA,CAIE,kBAACM,GAAD,EAAa,WAAU,6CAA8C,CAAA,GACpEJ,EAAc,GAAG,yBAAyB,yBAAyB,CACjE;;AAET;AAGA,SAAgBK,EAAkB,EAChC,SACA,gBACA,cACA,iBAMC;CACD,IAAM,EAAE,SAAMP,EAAQ;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAACQ,GAAD,EAAU,WAAU,qCAAsC,CAAA,GAC1D,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAC,EAAK;IACL,CAAA,GACH,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAC,EAAeD,EAAK,IAAI;IACxB,CAAA,CACA;GACF,CAAA,CAAA;EACL,CAAA,GAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBA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Q;CACtB,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACGwB,KACC,kBAAC,OAAD;IACE,MAAK;IACL,WAAU;IAET,UAAAtB,EACCC,GACA,kCACA,kDACF;GACG,CAAA;GAENqB,KAAeC,KACd,kBAACC,GAAD;IAAsB,UAAA;IAAU,UAAAD;GAAuC,CAAA;GAEzE,kBAAC,UAAD;IACE,MAAK;IACL,SAASE;IACT,WAAU;IAET,UAAAzB,EAAcC,GAAG,qBAAqB,0BAA0B;GAC3D,CAAA;EACL;;AAET;AAiCA,SAAgByB,EAAgB,GAA6B;CAC3D,IAAM,EAAE,YAAS,UAAO,eAAY,eAAYC;CAoChD,OAnCIC,IAAgB,kBAACzB,GAAD,CAAuB,CAAA,IACvC0B,GAAO,SAAS,WAEhB,kBAACC,GAAD;EACE,YAAYD,EAAM,OAAO;EACzB,OAAOA,EAAM;EACb,WAAWA,EAAM;EACjB,YAAYF,EAAM;EAClB,cAAcA,EAAM;EACpB,WAAWA,EAAM;EACjB,YAAYA,EAAM;CACnB,CAAA,IAGDI,IAEA,kBAAC1B,GAAD;EACE,MAAM0B;EACN,aAAa,GAAQA,EAAW,eAAeA,EAAW;EAC1D,WAAWJ,EAAM;EACjB,YAAYA,EAAM;CACnB,CAAA,IAGDK,MAAY,uBAAuBA,MAAY,qBAE/C,kBAACjB,GAAD;EACE,UAAUY,EAAM;EAChB,SAASK,MAAY;EACrB,UAAUL,EAAM;EAChB,kBAAkBA,EAAM;EACxB,UAAUA,EAAM;CACjB,CAAA,IAIH,kBAACN,GAAD;EACE,aAAaW,MAAY;EACzB,kBAAkBL,EAAM,iBAAiB;EACzC,SAASA,EAAM;CAChB,CAAA;AAEL"}
|
|
@@ -2,14 +2,15 @@ import { tWithFallback as e } from "../utils/i18n.js";
|
|
|
2
2
|
import { DEFAULT_SHARE_FORM_VALUES as t, buildShareInput as n } from "../utils/shareForm.js";
|
|
3
3
|
import { useShareDialogPermission as r } from "../hooks/useShareDialogPermission.js";
|
|
4
4
|
import { classifyShareRefusal as i, shareDenialCopy as a, sharePermissionMessages as o } from "../utils/sharePermission.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { SpinnerIcon as s } from "./loadingSystem.js";
|
|
6
|
+
import { useEffect as c, useState as l } from "react";
|
|
7
|
+
import { Calendar as u, Check as d, Copy as f, Download as p, Link as m, Lock as h, Mail as g, ShieldAlert as _ } from "lucide-react";
|
|
7
8
|
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
8
9
|
import { Button as x, OptionalFields as S, ResponsiveDialog as C, ResponsiveDialogContent as w, ResponsiveDialogDescription as T, ResponsiveDialogFooter as E, ResponsiveDialogHeader as D, ResponsiveDialogTitle as O, ThemedSelect as k } from "@burdenoff/fe-libs/ui";
|
|
9
10
|
import { useI18n as A } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
10
11
|
// src/files/components/ShareDialog.tsx
|
|
11
|
-
function j({ item: t, itemType: n, onClose: i, onCreateShare: a, isLoading: o, knownPermission: s, navigationV2:
|
|
12
|
-
let { t: u } = A(), [d, f] =
|
|
12
|
+
function j({ item: t, itemType: n, onClose: i, onCreateShare: a, isLoading: o, knownPermission: s, navigationV2: c = !1 }) {
|
|
13
|
+
let { t: u } = A(), [d, f] = l(null), { permission: p, denialCause: m, recordRefusal: h } = r({
|
|
13
14
|
item: t,
|
|
14
15
|
itemType: n,
|
|
15
16
|
knownPermission: s
|
|
@@ -22,7 +23,7 @@ function j({ item: t, itemType: n, onClose: i, onCreateShare: a, isLoading: o, k
|
|
|
22
23
|
children: /* @__PURE__ */ b(w, { children: [/* @__PURE__ */ b(D, { children: [/* @__PURE__ */ y(O, { children: e(u, "files.shareDialog.title", "Share {{itemType}} \"{{name}}\"", {
|
|
23
24
|
itemType: g,
|
|
24
25
|
name: t.name
|
|
25
|
-
}) }),
|
|
26
|
+
}) }), c && d === null && /* @__PURE__ */ y(T, { children: e(u, "files.shareDialog.reach", "Anyone with the link can view and download until it expires.") })] }), /* @__PURE__ */ y(M, {
|
|
26
27
|
item: t,
|
|
27
28
|
itemType: n,
|
|
28
29
|
itemTypeLabel: g,
|
|
@@ -34,7 +35,7 @@ function j({ item: t, itemType: n, onClose: i, onCreateShare: a, isLoading: o, k
|
|
|
34
35
|
onCreateShare: a,
|
|
35
36
|
onCreated: f,
|
|
36
37
|
onRefused: h,
|
|
37
|
-
navigationV2:
|
|
38
|
+
navigationV2: c
|
|
38
39
|
})] })
|
|
39
40
|
});
|
|
40
41
|
}
|
|
@@ -84,7 +85,7 @@ function P({ onClose: t }) {
|
|
|
84
85
|
role: "status",
|
|
85
86
|
"aria-live": "polite",
|
|
86
87
|
className: "flex items-center gap-3 py-6 text-sm text-text-secondary",
|
|
87
|
-
children: [/* @__PURE__ */ y(
|
|
88
|
+
children: [/* @__PURE__ */ y(s, { className: "size-4 animate-spin" }), o(n).checking]
|
|
88
89
|
}), /* @__PURE__ */ y(E, { children: /* @__PURE__ */ y(x, {
|
|
89
90
|
type: "button",
|
|
90
91
|
variant: "outline",
|
|
@@ -95,8 +96,8 @@ function P({ onClose: t }) {
|
|
|
95
96
|
function F(t, n) {
|
|
96
97
|
return n instanceof Error ? n.message : e(t, "files.shareDialog.errors.createFailed", "Failed to create share");
|
|
97
98
|
}
|
|
98
|
-
function I({ item: r, itemType: a, isLoading: o, onClose: s, onCreateShare:
|
|
99
|
-
let { t: p } = A(), [m, h] =
|
|
99
|
+
function I({ item: r, itemType: a, isLoading: o, onClose: s, onCreateShare: c, onCreated: u, onRefused: d, navigationV2: f }) {
|
|
100
|
+
let { t: p } = A(), [m, h] = l(t), [g, _] = l(null), S = (e) => h((t) => ({
|
|
100
101
|
...t,
|
|
101
102
|
...e
|
|
102
103
|
}));
|
|
@@ -134,7 +135,7 @@ function I({ item: r, itemType: a, isLoading: o, onClose: s, onCreateShare: l, o
|
|
|
134
135
|
_(null);
|
|
135
136
|
let e = n(r.id, a, m);
|
|
136
137
|
try {
|
|
137
|
-
let t = await
|
|
138
|
+
let t = await c(e);
|
|
138
139
|
u({
|
|
139
140
|
shareType: e.shareType,
|
|
140
141
|
shareUrl: t.publicUrl || "",
|
|
@@ -156,7 +157,7 @@ function I({ item: r, itemType: a, isLoading: o, onClose: s, onCreateShare: l, o
|
|
|
156
157
|
}
|
|
157
158
|
function L({ isLoading: t }) {
|
|
158
159
|
let { t: n } = A();
|
|
159
|
-
return t ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(
|
|
160
|
+
return t ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(s, { className: "size-4 animate-spin" }), e(n, "files.shareDialog.actions.creating", "Creating...")] }) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(m, { className: "size-4" }), e(n, "files.shareDialog.actions.createLink", "Create share link")] });
|
|
160
161
|
}
|
|
161
162
|
var R = [
|
|
162
163
|
{
|
|
@@ -190,7 +191,7 @@ function z({ value: t, onChange: n }) {
|
|
|
190
191
|
return /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
191
192
|
htmlFor: "share-dialog-expiry-select",
|
|
192
193
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary mb-2",
|
|
193
|
-
children: [/* @__PURE__ */ y(
|
|
194
|
+
children: [/* @__PURE__ */ y(u, { className: "size-4" }), i]
|
|
194
195
|
}), /* @__PURE__ */ y(k, {
|
|
195
196
|
id: "share-dialog-expiry-select",
|
|
196
197
|
"aria-label": i,
|
|
@@ -237,7 +238,7 @@ function V({ values: t, onChange: n, navigationV2: r }) {
|
|
|
237
238
|
children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("label", {
|
|
238
239
|
htmlFor: "share-dialog-max-downloads",
|
|
239
240
|
className: "flex items-center gap-2 text-sm font-medium text-text-primary mb-2",
|
|
240
|
-
children: [/* @__PURE__ */ y(
|
|
241
|
+
children: [/* @__PURE__ */ y(p, { className: "size-4" }), a]
|
|
241
242
|
}), /* @__PURE__ */ y("input", {
|
|
242
243
|
id: "share-dialog-max-downloads",
|
|
243
244
|
type: "number",
|
|
@@ -314,8 +315,8 @@ function U({ created: t, onClose: n }) {
|
|
|
314
315
|
});
|
|
315
316
|
}
|
|
316
317
|
function W({ shareUrl: t }) {
|
|
317
|
-
let { t: n } = A(), [r, i] =
|
|
318
|
-
return
|
|
318
|
+
let { t: n } = A(), [r, i] = l(!1);
|
|
319
|
+
return c(() => {
|
|
319
320
|
if (r) {
|
|
320
321
|
let e = setTimeout(() => i(!1), 2e3);
|
|
321
322
|
return () => clearTimeout(e);
|
|
@@ -336,7 +337,7 @@ function W({ shareUrl: t }) {
|
|
|
336
337
|
onClick: async () => {
|
|
337
338
|
t && (await navigator.clipboard.writeText(t), i(!0));
|
|
338
339
|
},
|
|
339
|
-
children: r ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(
|
|
340
|
+
children: r ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(d, { className: "size-4" }), e(n, "files.shareDialog.actions.copied", "Copied!")] }) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(f, { className: "size-4" }), e(n, "files.common.actions.copy", "Copy")] })
|
|
340
341
|
})]
|
|
341
342
|
})] });
|
|
342
343
|
}
|