@burdenoff/microfe-files 2026.1111.2 → 2026.1111.3
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/FileInfoPanel.js +106 -104
- package/dist/files/components/FileInfoPanel.js.map +1 -1
- package/dist/files/components/FileVisibilityControl.d.ts +5 -0
- package/dist/files/components/FileVisibilityControl.js +99 -0
- package/dist/files/components/FileVisibilityControl.js.map +1 -0
- package/dist/files/components/UploadVisibilitySelect.d.ts +7 -0
- package/dist/files/components/UploadVisibilitySelect.js +45 -0
- package/dist/files/components/UploadVisibilitySelect.js.map +1 -0
- package/dist/files/hooks/useUploadFile.d.ts +5 -1
- package/dist/files/hooks/useUploadFile.js +47 -42
- package/dist/files/hooks/useUploadFile.js.map +1 -1
- package/dist/files/pages/BrowserPage.js +408 -395
- package/dist/files/pages/BrowserPage.js.map +1 -1
- package/dist/files/types.d.ts +3 -0
- package/dist/files/utils/uploadVisibility.d.ts +5 -0
- package/dist/files/utils/uploadVisibility.js +12 -0
- package/dist/files/utils/uploadVisibility.js.map +1 -0
- package/dist/translations/en.d.ts +13 -0
- package/dist/translations/en.js +13 -0
- package/dist/translations/en.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,226 +1,228 @@
|
|
|
1
1
|
import { tWithFallback as e } from "../utils/i18n.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { FileVisibilityControl as t } from "./FileVisibilityControl.js";
|
|
3
|
+
import { Suspense as n, lazy as r, useEffect as i, useEffectEvent as a, useState as o } from "react";
|
|
4
|
+
import { Calendar as s, Clock as c, FileText as l, HardDrive as u, Link as d, User as f, X as p } from "lucide-react";
|
|
5
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
6
|
+
import { useI18n as _ } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
7
|
+
import { GlassCard as v, ShowMore as y } from "@burdenoff/fe-libs/ui";
|
|
7
8
|
// src/files/components/FileInfoPanel.tsx
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let { t:
|
|
11
|
-
|
|
9
|
+
var b = r(() => import("./FileVersionPanel.js").then((e) => ({ default: e.FileVersionPanel })));
|
|
10
|
+
function x({ item: r, type: x, onClose: S }) {
|
|
11
|
+
let { t: C } = _(), w = x === "file", T = w ? r : null, E = w ? null : r, [D, O] = o(!1), k = a(() => {
|
|
12
|
+
D ? O(!1) : S();
|
|
12
13
|
});
|
|
13
|
-
|
|
14
|
+
i(() => {
|
|
14
15
|
let e = (e) => {
|
|
15
|
-
e.key === "Escape" &&
|
|
16
|
+
e.key === "Escape" && k();
|
|
16
17
|
};
|
|
17
18
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
18
19
|
}, []);
|
|
19
|
-
let
|
|
20
|
+
let A = (e) => new Date(e).toLocaleString("en-US", {
|
|
20
21
|
year: "numeric",
|
|
21
22
|
month: "long",
|
|
22
23
|
day: "numeric",
|
|
23
24
|
hour: "2-digit",
|
|
24
25
|
minute: "2-digit"
|
|
25
26
|
});
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ g("div", {
|
|
27
28
|
className: "fixed inset-y-0 right-0 z-[9999] w-full max-w-full overflow-y-auto border-l border-border-seam bg-bg-surface shadow-2xl animate-in slide-in-from-right duration-200 sm:w-96 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
|
|
28
29
|
role: "dialog",
|
|
29
30
|
"aria-modal": "false",
|
|
30
|
-
"aria-label":
|
|
31
|
+
"aria-label": w ? e(C, "files.info.fileInfo", "File information") : e(C, "files.info.folderInfo", "Folder information"),
|
|
31
32
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ g("div", {
|
|
33
34
|
className: "sticky top-0 z-10 bg-bg-surface border-b border-border-seam px-6 py-4 flex items-center justify-between",
|
|
34
|
-
children: [/* @__PURE__ */
|
|
35
|
+
children: [/* @__PURE__ */ h("h2", {
|
|
35
36
|
className: "text-lg font-semibold text-text-primary",
|
|
36
|
-
children:
|
|
37
|
-
}), /* @__PURE__ */
|
|
37
|
+
children: w ? e(C, "files.info.fileInfo", "File Information") : e(C, "files.info.folderInfo", "Folder Information")
|
|
38
|
+
}), /* @__PURE__ */ h("button", {
|
|
38
39
|
type: "button",
|
|
39
|
-
onClick:
|
|
40
|
+
onClick: S,
|
|
40
41
|
className: "p-1.5 rounded-md border border-border-default text-text-secondary bg-bg-elevated hover:bg-action-ghost-bg-hover hover:text-text-primary transition-colors shadow-sm",
|
|
41
|
-
"aria-label": e(
|
|
42
|
-
children: /* @__PURE__ */
|
|
42
|
+
"aria-label": e(C, "files.info.closePanel", "Close information panel"),
|
|
43
|
+
children: /* @__PURE__ */ h(p, { className: "size-5" })
|
|
43
44
|
})]
|
|
44
45
|
}),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ g("div", {
|
|
46
47
|
className: "p-6 space-y-6",
|
|
47
48
|
children: [
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ h(v, {
|
|
49
50
|
treatment: "metric",
|
|
50
51
|
className: "flex items-center justify-center py-8",
|
|
51
|
-
children:
|
|
52
|
-
src:
|
|
53
|
-
alt:
|
|
52
|
+
children: w && T?.mimeType.startsWith("image/") && (T.downloadUrl || T.url) ? /* @__PURE__ */ h("img", {
|
|
53
|
+
src: T.downloadUrl || T.url,
|
|
54
|
+
alt: r.name,
|
|
54
55
|
className: "max-w-full max-h-48 object-contain rounded"
|
|
55
|
-
}) : /* @__PURE__ */
|
|
56
|
+
}) : /* @__PURE__ */ h(l, { className: "size-20 text-text-muted" })
|
|
56
57
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("h3", {
|
|
58
59
|
className: "text-xl font-semibold text-text-primary break-words",
|
|
59
|
-
children:
|
|
60
|
-
}),
|
|
60
|
+
children: r.name
|
|
61
|
+
}), r.description && /* @__PURE__ */ h("p", {
|
|
61
62
|
className: "mt-2 text-sm text-text-secondary",
|
|
62
|
-
children:
|
|
63
|
+
children: r.description
|
|
63
64
|
})] }),
|
|
64
|
-
/* @__PURE__ */ h(
|
|
65
|
+
T && /* @__PURE__ */ h(t, { file: T }, `${T.id}:${T.visibility}`),
|
|
66
|
+
/* @__PURE__ */ g("div", {
|
|
65
67
|
className: "space-y-4",
|
|
66
68
|
children: [
|
|
67
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ g("div", {
|
|
68
70
|
className: "flex items-start gap-3",
|
|
69
|
-
children: [/* @__PURE__ */
|
|
71
|
+
children: [/* @__PURE__ */ h(l, { className: "size-5 text-text-muted mt-0.5" }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
70
72
|
className: "text-sm font-medium text-text-primary",
|
|
71
|
-
children: e(
|
|
72
|
-
}), /* @__PURE__ */
|
|
73
|
+
children: e(C, "files.info.type", "Type")
|
|
74
|
+
}), /* @__PURE__ */ h("p", {
|
|
73
75
|
className: "text-sm text-text-secondary",
|
|
74
|
-
children:
|
|
76
|
+
children: w ? T?.mimeType || e(C, "files.info.unknown", "Unknown") : e(C, "files.info.folder", "Folder")
|
|
75
77
|
})] })]
|
|
76
78
|
}),
|
|
77
|
-
|
|
79
|
+
w && T && /* @__PURE__ */ g("div", {
|
|
78
80
|
className: "flex items-start gap-3",
|
|
79
|
-
children: [/* @__PURE__ */
|
|
81
|
+
children: [/* @__PURE__ */ h(u, { className: "size-5 text-text-muted mt-0.5" }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
80
82
|
className: "text-sm font-medium text-text-primary",
|
|
81
|
-
children: e(
|
|
82
|
-
}), /* @__PURE__ */
|
|
83
|
+
children: e(C, "files.info.size", "Size")
|
|
84
|
+
}), /* @__PURE__ */ h("p", {
|
|
83
85
|
className: "text-sm text-text-secondary",
|
|
84
|
-
children: ((e) => e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(2)} KB` : e < 1073741824 ? `${(e / 1024 / 1024).toFixed(2)} MB` : `${(e / 1024 / 1024 / 1024).toFixed(2)} GB`)(
|
|
86
|
+
children: ((e) => e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(2)} KB` : e < 1073741824 ? `${(e / 1024 / 1024).toFixed(2)} MB` : `${(e / 1024 / 1024 / 1024).toFixed(2)} GB`)(T.size)
|
|
85
87
|
})] })]
|
|
86
88
|
}),
|
|
87
|
-
!
|
|
89
|
+
!w && E && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
|
|
88
90
|
className: "flex items-start gap-3",
|
|
89
|
-
children: [/* @__PURE__ */
|
|
91
|
+
children: [/* @__PURE__ */ h(l, { className: "size-5 text-text-muted mt-0.5" }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
90
92
|
className: "text-sm font-medium text-text-primary",
|
|
91
|
-
children: e(
|
|
92
|
-
}), /* @__PURE__ */
|
|
93
|
+
children: e(C, "files.info.contents", "Contents")
|
|
94
|
+
}), /* @__PURE__ */ g("p", {
|
|
93
95
|
className: "text-sm text-text-secondary",
|
|
94
96
|
children: [
|
|
95
|
-
|
|
97
|
+
E.filesCount,
|
|
96
98
|
" ",
|
|
97
|
-
e(
|
|
99
|
+
e(C, "files.info.files", "files"),
|
|
98
100
|
",",
|
|
99
101
|
" ",
|
|
100
|
-
|
|
102
|
+
E.subfoldersCount,
|
|
101
103
|
" ",
|
|
102
|
-
e(
|
|
104
|
+
e(C, "files.info.folders", "folders")
|
|
103
105
|
]
|
|
104
106
|
})] })]
|
|
105
|
-
}),
|
|
107
|
+
}), E.path && /* @__PURE__ */ g("div", {
|
|
106
108
|
className: "flex items-start gap-3",
|
|
107
|
-
children: [/* @__PURE__ */
|
|
109
|
+
children: [/* @__PURE__ */ h(d, { className: "size-5 text-text-muted mt-0.5" }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
108
110
|
className: "text-sm font-medium text-text-primary",
|
|
109
|
-
children: e(
|
|
110
|
-
}), /* @__PURE__ */
|
|
111
|
+
children: e(C, "files.info.path", "Path")
|
|
112
|
+
}), /* @__PURE__ */ h("p", {
|
|
111
113
|
className: "text-sm text-text-secondary break-all",
|
|
112
|
-
children:
|
|
114
|
+
children: E.path
|
|
113
115
|
})] })]
|
|
114
116
|
})] }),
|
|
115
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ g("div", {
|
|
116
118
|
className: "flex items-start gap-3",
|
|
117
|
-
children: [/* @__PURE__ */
|
|
119
|
+
children: [/* @__PURE__ */ h(s, { className: "size-5 text-text-muted mt-0.5" }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
118
120
|
className: "text-sm font-medium text-text-primary",
|
|
119
|
-
children: e(
|
|
120
|
-
}), /* @__PURE__ */
|
|
121
|
+
children: e(C, "files.info.created", "Created")
|
|
122
|
+
}), /* @__PURE__ */ h("p", {
|
|
121
123
|
className: "text-sm text-text-secondary",
|
|
122
|
-
children:
|
|
124
|
+
children: A(r.createdAt)
|
|
123
125
|
})] })]
|
|
124
126
|
}),
|
|
125
|
-
|
|
127
|
+
r.updatedAt && /* @__PURE__ */ g("div", {
|
|
126
128
|
className: "flex items-start gap-3",
|
|
127
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ h(s, { className: "size-5 text-text-muted mt-0.5" }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
128
130
|
className: "text-sm font-medium text-text-primary",
|
|
129
|
-
children: e(
|
|
130
|
-
}), /* @__PURE__ */
|
|
131
|
+
children: e(C, "files.info.modified", "Modified")
|
|
132
|
+
}), /* @__PURE__ */ h("p", {
|
|
131
133
|
className: "text-sm text-text-secondary",
|
|
132
|
-
children:
|
|
134
|
+
children: A(r.updatedAt)
|
|
133
135
|
})] })]
|
|
134
136
|
}),
|
|
135
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ g("div", {
|
|
136
138
|
className: "flex items-start gap-3",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
139
|
+
children: [/* @__PURE__ */ h(f, { className: "size-5 text-text-muted mt-0.5" }), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("p", {
|
|
138
140
|
className: "text-sm font-medium text-text-primary",
|
|
139
|
-
children: e(
|
|
140
|
-
}), /* @__PURE__ */
|
|
141
|
+
children: e(C, "files.info.owner", "Owner")
|
|
142
|
+
}), /* @__PURE__ */ h("p", {
|
|
141
143
|
className: "text-sm text-text-secondary",
|
|
142
|
-
children:
|
|
144
|
+
children: r.createdBy?.name || r.createdById || e(C, "files.info.unknown", "Unknown")
|
|
143
145
|
})] })]
|
|
144
146
|
})
|
|
145
147
|
]
|
|
146
148
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ g("div", {
|
|
148
150
|
className: "pt-6 border-t border-border-seam",
|
|
149
|
-
children: [/* @__PURE__ */
|
|
151
|
+
children: [/* @__PURE__ */ h("h4", {
|
|
150
152
|
className: "text-sm font-semibold text-text-primary mb-3",
|
|
151
|
-
children: e(
|
|
152
|
-
}), /* @__PURE__ */
|
|
153
|
+
children: e(C, "files.info.properties", "Properties")
|
|
154
|
+
}), /* @__PURE__ */ h(y, {
|
|
153
155
|
collapsedHeight: 56,
|
|
154
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ g("dl", {
|
|
155
157
|
className: "space-y-2",
|
|
156
158
|
children: [
|
|
157
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ g("div", {
|
|
158
160
|
className: "flex justify-between",
|
|
159
|
-
children: [/* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ h("dt", {
|
|
160
162
|
className: "text-sm text-text-secondary",
|
|
161
|
-
children: e(
|
|
162
|
-
}), /* @__PURE__ */
|
|
163
|
+
children: e(C, "files.info.status", "Status")
|
|
164
|
+
}), /* @__PURE__ */ h("dd", {
|
|
163
165
|
className: "text-sm font-medium text-text-primary",
|
|
164
|
-
children:
|
|
166
|
+
children: r.status
|
|
165
167
|
})]
|
|
166
168
|
}),
|
|
167
|
-
/* @__PURE__ */
|
|
169
|
+
!w && /* @__PURE__ */ g("div", {
|
|
168
170
|
className: "flex justify-between",
|
|
169
|
-
children: [/* @__PURE__ */
|
|
171
|
+
children: [/* @__PURE__ */ h("dt", {
|
|
170
172
|
className: "text-sm text-text-secondary",
|
|
171
|
-
children: e(
|
|
172
|
-
}), /* @__PURE__ */
|
|
173
|
+
children: e(C, "files.info.visibility", "Visibility")
|
|
174
|
+
}), /* @__PURE__ */ h("dd", {
|
|
173
175
|
className: "text-sm font-medium text-text-primary",
|
|
174
|
-
children:
|
|
176
|
+
children: r.visibility
|
|
175
177
|
})]
|
|
176
178
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ g("div", {
|
|
178
180
|
className: "flex justify-between",
|
|
179
|
-
children: [/* @__PURE__ */
|
|
181
|
+
children: [/* @__PURE__ */ h("dt", {
|
|
180
182
|
className: "text-sm text-text-secondary",
|
|
181
|
-
children: e(
|
|
182
|
-
}), /* @__PURE__ */
|
|
183
|
+
children: e(C, "files.info.starred", "Starred")
|
|
184
|
+
}), /* @__PURE__ */ h("dd", {
|
|
183
185
|
className: "text-sm font-medium text-text-primary",
|
|
184
|
-
children:
|
|
186
|
+
children: r.starred ? e(C, "files.info.yes", "Yes") : e(C, "files.info.no", "No")
|
|
185
187
|
})]
|
|
186
188
|
})
|
|
187
189
|
]
|
|
188
190
|
})
|
|
189
191
|
})]
|
|
190
192
|
}),
|
|
191
|
-
|
|
193
|
+
w && T && /* @__PURE__ */ h("div", {
|
|
192
194
|
className: "pt-6 border-t border-border-seam",
|
|
193
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ g("button", {
|
|
194
196
|
type: "button",
|
|
195
|
-
onClick: () =>
|
|
197
|
+
onClick: () => O(!0),
|
|
196
198
|
className: "w-full flex items-center justify-center gap-2 px-4 py-3 text-sm font-medium text-action-primary-text bg-action-primary-bg/10 hover:bg-action-primary-bg/20 rounded-lg transition-all duration-200",
|
|
197
|
-
children: [/* @__PURE__ */
|
|
199
|
+
children: [/* @__PURE__ */ h(c, { className: "size-4" }), e(C, "files.info.viewVersionHistory", "View Version History")]
|
|
198
200
|
})
|
|
199
201
|
})
|
|
200
202
|
]
|
|
201
203
|
}),
|
|
202
|
-
|
|
203
|
-
fallback: /* @__PURE__ */
|
|
204
|
+
w && T && D && /* @__PURE__ */ h(n, {
|
|
205
|
+
fallback: /* @__PURE__ */ h("div", {
|
|
204
206
|
className: "fixed inset-0 z-50 bg-bg-overlay flex items-center justify-center",
|
|
205
|
-
children: /* @__PURE__ */
|
|
207
|
+
children: /* @__PURE__ */ h("div", {
|
|
206
208
|
className: "bg-bg-surface rounded-lg p-8 animate-in fade-in zoom-in duration-200",
|
|
207
|
-
children: /* @__PURE__ */
|
|
209
|
+
children: /* @__PURE__ */ g("div", {
|
|
208
210
|
className: "flex items-center gap-3",
|
|
209
|
-
children: [/* @__PURE__ */
|
|
211
|
+
children: [/* @__PURE__ */ h(c, { className: "size-6 text-action-primary-bg animate-spin" }), /* @__PURE__ */ h("span", {
|
|
210
212
|
className: "text-text-primary",
|
|
211
|
-
children: e(
|
|
213
|
+
children: e(C, "files.info.loadingVersionHistory", "Loading version history...")
|
|
212
214
|
})]
|
|
213
215
|
})
|
|
214
216
|
})
|
|
215
217
|
}),
|
|
216
|
-
children: /* @__PURE__ */
|
|
217
|
-
file:
|
|
218
|
-
onClose: () =>
|
|
218
|
+
children: /* @__PURE__ */ h(b, {
|
|
219
|
+
file: T,
|
|
220
|
+
onClose: () => O(!1)
|
|
219
221
|
})
|
|
220
222
|
})
|
|
221
223
|
]
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
|
-
export {
|
|
226
|
+
export { x as FileInfoPanel };
|
|
225
227
|
|
|
226
228
|
//# sourceMappingURL=FileInfoPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInfoPanel.js","names":["_Fragment","LinkIcon","FileVersionPanel","lazy","m","FileInfoPanel","useI18n","isFile","type","file","item","folder","showVersionHistory","setShowVersionHistory","useState","onEscape","useEffectEvent","onClose","handleEscape","event","formatDate","date","tWithFallback","t","X","GlassCard","FileText","HardDrive","bytes","Fragment","Link","Calendar","User","ShowMore","Clock","Suspense"],"sources":["../../../src/files/components/FileInfoPanel.tsx"],"sourcesContent":["import { useEffect, useEffectEvent, useState, lazy, Suspense } from \"react\";\nimport {\n X,\n FileText,\n Calendar,\n User,\n HardDrive,\n Link as LinkIcon,\n Clock,\n} from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { GlassCard, ShowMore } from \"@burdenoff/fe-libs/ui\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { tWithFallback } from \"../utils/i18n\";\n\n// Lazy load FileVersionPanel to avoid loading heavy dependencies until needed\nconst FileVersionPanel = lazy(() =>\n import(\"./FileVersionPanel\").then((m) => ({ default: m.FileVersionPanel })),\n);\n\ninterface FileInfoPanelProps {\n item: FileItem | FolderItem;\n type: \"file\" | \"folder\";\n onClose: () => void;\n}\n\nexport function FileInfoPanel({ item, type, onClose }: FileInfoPanelProps) {\n const { t } = useI18n();\n const isFile = type === \"file\";\n const file = isFile ? (item as FileItem) : null;\n const folder = !isFile ? (item as FolderItem) : null;\n const [showVersionHistory, setShowVersionHistory] = useState(false);\n\n const onEscape = useEffectEvent(() => {\n if (showVersionHistory) {\n setShowVersionHistory(false);\n return;\n }\n onClose();\n });\n\n useEffect(() => {\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n onEscape();\n }\n };\n\n document.addEventListener(\"keydown\", handleEscape);\n return () => document.removeEventListener(\"keydown\", handleEscape);\n }, []);\n\n const formatDate = (date: string) => {\n return new Date(date).toLocaleString(\"en-US\", {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n };\n\n const formatSize = (bytes: number) => {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} KB`;\n if (bytes < 1024 * 1024 * 1024)\n return `${(bytes / 1024 / 1024).toFixed(2)} MB`;\n return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`;\n };\n\n return (\n <div\n className=\"fixed inset-y-0 right-0 z-[9999] w-full max-w-full overflow-y-auto border-l border-border-seam bg-bg-surface shadow-2xl animate-in slide-in-from-right duration-200 sm:w-96 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]\"\n role=\"dialog\"\n aria-modal=\"false\"\n aria-label={\n isFile\n ? tWithFallback(t, \"files.info.fileInfo\", \"File information\")\n : tWithFallback(t, \"files.info.folderInfo\", \"Folder information\")\n }\n >\n {/* Header */}\n <div className=\"sticky top-0 z-10 bg-bg-surface border-b border-border-seam px-6 py-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {isFile\n ? tWithFallback(t, \"files.info.fileInfo\", \"File Information\")\n : tWithFallback(t, \"files.info.folderInfo\", \"Folder Information\")}\n </h2>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1.5 rounded-md border border-border-default text-text-secondary bg-bg-elevated hover:bg-action-ghost-bg-hover hover:text-text-primary transition-colors shadow-sm\"\n aria-label={tWithFallback(\n t,\n \"files.info.closePanel\",\n \"Close information panel\",\n )}\n >\n <X className=\"size-5\" />\n </button>\n </div>\n\n {/* Content */}\n <div className=\"p-6 space-y-6\">\n {/* Preview/Icon */}\n <GlassCard\n treatment=\"metric\"\n className=\"flex items-center justify-center py-8\"\n >\n {isFile &&\n file?.mimeType.startsWith(\"image/\") &&\n (file.downloadUrl || file.url) ? (\n <img\n src={file.downloadUrl || file.url}\n alt={item.name}\n className=\"max-w-full max-h-48 object-contain rounded\"\n />\n ) : (\n <FileText className=\"size-20 text-text-muted\" />\n )}\n </GlassCard>\n\n {/* Name */}\n <div>\n <h3 className=\"text-xl font-semibold text-text-primary break-words\">\n {item.name}\n </h3>\n {item.description && (\n <p className=\"mt-2 text-sm text-text-secondary\">\n {item.description}\n </p>\n )}\n </div>\n\n {/* Details */}\n <div className=\"space-y-4\">\n <div className=\"flex items-start gap-3\">\n <FileText className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.type\", \"Type\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {isFile\n ? file?.mimeType ||\n tWithFallback(t, \"files.info.unknown\", \"Unknown\")\n : tWithFallback(t, \"files.info.folder\", \"Folder\")}\n </p>\n </div>\n </div>\n\n {isFile && file && (\n <div className=\"flex items-start gap-3\">\n <HardDrive className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.size\", \"Size\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {formatSize(file.size)}\n </p>\n </div>\n </div>\n )}\n\n {!isFile && folder && (\n <>\n <div className=\"flex items-start gap-3\">\n <FileText className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.contents\", \"Contents\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {folder.filesCount}{\" \"}\n {tWithFallback(t, \"files.info.files\", \"files\")},{\" \"}\n {folder.subfoldersCount}{\" \"}\n {tWithFallback(t, \"files.info.folders\", \"folders\")}\n </p>\n </div>\n </div>\n\n {folder.path && (\n <div className=\"flex items-start gap-3\">\n <LinkIcon className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.path\", \"Path\")}\n </p>\n <p className=\"text-sm text-text-secondary break-all\">\n {folder.path}\n </p>\n </div>\n </div>\n )}\n </>\n )}\n\n <div className=\"flex items-start gap-3\">\n <Calendar className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.created\", \"Created\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {formatDate(item.createdAt)}\n </p>\n </div>\n </div>\n\n {item.updatedAt && (\n <div className=\"flex items-start gap-3\">\n <Calendar className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.modified\", \"Modified\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {formatDate(item.updatedAt)}\n </p>\n </div>\n </div>\n )}\n\n <div className=\"flex items-start gap-3\">\n <User className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.owner\", \"Owner\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {item.createdBy?.name ||\n item.createdById ||\n tWithFallback(t, \"files.info.unknown\", \"Unknown\")}\n </p>\n </div>\n </div>\n </div>\n\n {/* Additional Info — secondary properties tucked behind progressive\n disclosure to keep the rail focused on the essentials. */}\n <div className=\"pt-6 border-t border-border-seam\">\n <h4 className=\"text-sm font-semibold text-text-primary mb-3\">\n {tWithFallback(t, \"files.info.properties\", \"Properties\")}\n </h4>\n <ShowMore collapsedHeight={56}>\n <dl className=\"space-y-2\">\n <div className=\"flex justify-between\">\n <dt className=\"text-sm text-text-secondary\">\n {tWithFallback(t, \"files.info.status\", \"Status\")}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {item.status}\n </dd>\n </div>\n <div className=\"flex justify-between\">\n <dt className=\"text-sm text-text-secondary\">\n {tWithFallback(t, \"files.info.visibility\", \"Visibility\")}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {item.visibility}\n </dd>\n </div>\n <div className=\"flex justify-between\">\n <dt className=\"text-sm text-text-secondary\">\n {tWithFallback(t, \"files.info.starred\", \"Starred\")}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {item.starred\n ? tWithFallback(t, \"files.info.yes\", \"Yes\")\n : tWithFallback(t, \"files.info.no\", \"No\")}\n </dd>\n </div>\n </dl>\n </ShowMore>\n </div>\n\n {/* Version History Button (Files only) */}\n {isFile && file && (\n <div className=\"pt-6 border-t border-border-seam\">\n <button\n type=\"button\"\n onClick={() => setShowVersionHistory(true)}\n className=\"w-full flex items-center justify-center gap-2 px-4 py-3 text-sm font-medium text-action-primary-text bg-action-primary-bg/10 hover:bg-action-primary-bg/20 rounded-lg transition-all duration-200\"\n >\n <Clock className=\"size-4\" />\n {tWithFallback(\n t,\n \"files.info.viewVersionHistory\",\n \"View Version History\",\n )}\n </button>\n </div>\n )}\n </div>\n\n {/* Version History Modal */}\n {isFile && file && showVersionHistory && (\n <Suspense\n fallback={\n <div className=\"fixed inset-0 z-50 bg-bg-overlay flex items-center justify-center\">\n <div className=\"bg-bg-surface rounded-lg p-8 animate-in fade-in zoom-in duration-200\">\n <div className=\"flex items-center gap-3\">\n <Clock className=\"size-6 text-action-primary-bg animate-spin\" />\n <span className=\"text-text-primary\">\n {tWithFallback(\n t,\n \"files.info.loadingVersionHistory\",\n \"Loading version history...\",\n )}\n </span>\n </div>\n </div>\n </div>\n }\n >\n <FileVersionPanel\n file={file}\n onClose={() => setShowVersionHistory(false)}\n />\n </Suspense>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAgBA,IAAME,IAAmBC,QACvB,OAAO,wBAAqB,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,iBAAiB,EAAE,CAC5E;AAQA,SAAgBC,EAAc,EAAE,SAAM,SAAM,cAA+B;CACzE,IAAM,EAAE,SAAMC,EAAQ,GAChBC,IAASC,MAAS,QAClBC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AI,WAAU;WACX,UAAAb,EAAK,UACFY,EAAcC,GAAG,kBAAkB,KAAK,IACxCD,EAAcC,GAAG,iBAAiB,IAAI;UACxC,CAAA,CACD;;QACH;;MACI,CAAA,CACP;;KAGJhB,KAAUE,KACT,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAAC,UAAD;OACE,MAAK;OACL,eAAeI,EAAsB,EAAI;OACzC,WAAU;OAHZ,UAAA,CAKE,kBAACqB,GAAD,EAAO,WAAU,SAAU,CAAA,GAC1BZ,EACCC,GACA,iCACA,sBACF,CACM;;KACL,CAAA;IAEJ;;GAGJhB,KAAUE,KAAQG,KACjB,kBAACuB,GAAD;IACE,UACE,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAACD,GAAD,EAAO,WAAU,6CAA8C,CAAA,GAC/D,kBAAC,QAAD;QAAM,WAAU;QACb,UAAAZ,EACCC,GACA,oCACA,4BACF;OACI,CAAA,CACH;;KACF,CAAA;IACF,CAAA;IAGP,UAAA,kBAACrB,GAAD;KACQ;KACN,eAAeW,EAAsB,EAAK;IAC3C,CAAA;GACO,CAAA;EAET;;AAET"}
|
|
1
|
+
{"version":3,"file":"FileInfoPanel.js","names":["_Fragment","LinkIcon","FileVersionPanel","lazy","m","FileInfoPanel","useI18n","isFile","type","file","item","folder","showVersionHistory","setShowVersionHistory","useState","onEscape","useEffectEvent","onClose","handleEscape","event","formatDate","date","tWithFallback","t","X","GlassCard","FileText","FileVisibilityControl","HardDrive","bytes","Fragment","Link","Calendar","User","ShowMore","Clock","Suspense"],"sources":["../../../src/files/components/FileInfoPanel.tsx"],"sourcesContent":["import { useEffect, useEffectEvent, useState, lazy, Suspense } from \"react\";\nimport {\n X,\n FileText,\n Calendar,\n User,\n HardDrive,\n Link as LinkIcon,\n Clock,\n} from \"lucide-react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { GlassCard, ShowMore } from \"@burdenoff/fe-libs/ui\";\nimport type { FileItem, FolderItem } from \"../types\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { FileVisibilityControl } from \"./FileVisibilityControl\";\n\n// Lazy load FileVersionPanel to avoid loading heavy dependencies until needed\nconst FileVersionPanel = lazy(() =>\n import(\"./FileVersionPanel\").then((m) => ({ default: m.FileVersionPanel })),\n);\n\ninterface FileInfoPanelProps {\n item: FileItem | FolderItem;\n type: \"file\" | \"folder\";\n onClose: () => void;\n}\n\nexport function FileInfoPanel({ item, type, onClose }: FileInfoPanelProps) {\n const { t } = useI18n();\n const isFile = type === \"file\";\n const file = isFile ? (item as FileItem) : null;\n const folder = !isFile ? (item as FolderItem) : null;\n const [showVersionHistory, setShowVersionHistory] = useState(false);\n\n const onEscape = useEffectEvent(() => {\n if (showVersionHistory) {\n setShowVersionHistory(false);\n return;\n }\n onClose();\n });\n\n useEffect(() => {\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n onEscape();\n }\n };\n\n document.addEventListener(\"keydown\", handleEscape);\n return () => document.removeEventListener(\"keydown\", handleEscape);\n }, []);\n\n const formatDate = (date: string) => {\n return new Date(date).toLocaleString(\"en-US\", {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n };\n\n const formatSize = (bytes: number) => {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(2)} KB`;\n if (bytes < 1024 * 1024 * 1024)\n return `${(bytes / 1024 / 1024).toFixed(2)} MB`;\n return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`;\n };\n\n return (\n <div\n className=\"fixed inset-y-0 right-0 z-[9999] w-full max-w-full overflow-y-auto border-l border-border-seam bg-bg-surface shadow-2xl animate-in slide-in-from-right duration-200 sm:w-96 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]\"\n role=\"dialog\"\n aria-modal=\"false\"\n aria-label={\n isFile\n ? tWithFallback(t, \"files.info.fileInfo\", \"File information\")\n : tWithFallback(t, \"files.info.folderInfo\", \"Folder information\")\n }\n >\n {/* Header */}\n <div className=\"sticky top-0 z-10 bg-bg-surface border-b border-border-seam px-6 py-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {isFile\n ? tWithFallback(t, \"files.info.fileInfo\", \"File Information\")\n : tWithFallback(t, \"files.info.folderInfo\", \"Folder Information\")}\n </h2>\n <button\n type=\"button\"\n onClick={onClose}\n className=\"p-1.5 rounded-md border border-border-default text-text-secondary bg-bg-elevated hover:bg-action-ghost-bg-hover hover:text-text-primary transition-colors shadow-sm\"\n aria-label={tWithFallback(\n t,\n \"files.info.closePanel\",\n \"Close information panel\",\n )}\n >\n <X className=\"size-5\" />\n </button>\n </div>\n\n {/* Content */}\n <div className=\"p-6 space-y-6\">\n {/* Preview/Icon */}\n <GlassCard\n treatment=\"metric\"\n className=\"flex items-center justify-center py-8\"\n >\n {isFile &&\n file?.mimeType.startsWith(\"image/\") &&\n (file.downloadUrl || file.url) ? (\n <img\n src={file.downloadUrl || file.url}\n alt={item.name}\n className=\"max-w-full max-h-48 object-contain rounded\"\n />\n ) : (\n <FileText className=\"size-20 text-text-muted\" />\n )}\n </GlassCard>\n\n {/* Name */}\n <div>\n <h3 className=\"text-xl font-semibold text-text-primary break-words\">\n {item.name}\n </h3>\n {item.description && (\n <p className=\"mt-2 text-sm text-text-secondary\">\n {item.description}\n </p>\n )}\n </div>\n\n {/* Details */}\n {file && (\n <FileVisibilityControl\n key={`${file.id}:${file.visibility}`}\n file={file}\n />\n )}\n <div className=\"space-y-4\">\n <div className=\"flex items-start gap-3\">\n <FileText className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.type\", \"Type\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {isFile\n ? file?.mimeType ||\n tWithFallback(t, \"files.info.unknown\", \"Unknown\")\n : tWithFallback(t, \"files.info.folder\", \"Folder\")}\n </p>\n </div>\n </div>\n\n {isFile && file && (\n <div className=\"flex items-start gap-3\">\n <HardDrive className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.size\", \"Size\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {formatSize(file.size)}\n </p>\n </div>\n </div>\n )}\n\n {!isFile && folder && (\n <>\n <div className=\"flex items-start gap-3\">\n <FileText className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.contents\", \"Contents\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {folder.filesCount}{\" \"}\n {tWithFallback(t, \"files.info.files\", \"files\")},{\" \"}\n {folder.subfoldersCount}{\" \"}\n {tWithFallback(t, \"files.info.folders\", \"folders\")}\n </p>\n </div>\n </div>\n\n {folder.path && (\n <div className=\"flex items-start gap-3\">\n <LinkIcon className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.path\", \"Path\")}\n </p>\n <p className=\"text-sm text-text-secondary break-all\">\n {folder.path}\n </p>\n </div>\n </div>\n )}\n </>\n )}\n\n <div className=\"flex items-start gap-3\">\n <Calendar className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.created\", \"Created\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {formatDate(item.createdAt)}\n </p>\n </div>\n </div>\n\n {item.updatedAt && (\n <div className=\"flex items-start gap-3\">\n <Calendar className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.modified\", \"Modified\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {formatDate(item.updatedAt)}\n </p>\n </div>\n </div>\n )}\n\n <div className=\"flex items-start gap-3\">\n <User className=\"size-5 text-text-muted mt-0.5\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, \"files.info.owner\", \"Owner\")}\n </p>\n <p className=\"text-sm text-text-secondary\">\n {item.createdBy?.name ||\n item.createdById ||\n tWithFallback(t, \"files.info.unknown\", \"Unknown\")}\n </p>\n </div>\n </div>\n </div>\n\n {/* Additional Info — secondary properties tucked behind progressive\n disclosure to keep the rail focused on the essentials. */}\n <div className=\"pt-6 border-t border-border-seam\">\n <h4 className=\"text-sm font-semibold text-text-primary mb-3\">\n {tWithFallback(t, \"files.info.properties\", \"Properties\")}\n </h4>\n <ShowMore collapsedHeight={56}>\n <dl className=\"space-y-2\">\n <div className=\"flex justify-between\">\n <dt className=\"text-sm text-text-secondary\">\n {tWithFallback(t, \"files.info.status\", \"Status\")}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {item.status}\n </dd>\n </div>\n {!isFile && (\n <div className=\"flex justify-between\">\n <dt className=\"text-sm text-text-secondary\">\n {tWithFallback(t, \"files.info.visibility\", \"Visibility\")}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {item.visibility}\n </dd>\n </div>\n )}\n <div className=\"flex justify-between\">\n <dt className=\"text-sm text-text-secondary\">\n {tWithFallback(t, \"files.info.starred\", \"Starred\")}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {item.starred\n ? tWithFallback(t, \"files.info.yes\", \"Yes\")\n : tWithFallback(t, \"files.info.no\", \"No\")}\n </dd>\n </div>\n </dl>\n </ShowMore>\n </div>\n\n {/* Version History Button (Files only) */}\n {isFile && file && (\n <div className=\"pt-6 border-t border-border-seam\">\n <button\n type=\"button\"\n onClick={() => setShowVersionHistory(true)}\n className=\"w-full flex items-center justify-center gap-2 px-4 py-3 text-sm font-medium text-action-primary-text bg-action-primary-bg/10 hover:bg-action-primary-bg/20 rounded-lg transition-all duration-200\"\n >\n <Clock className=\"size-4\" />\n {tWithFallback(\n t,\n \"files.info.viewVersionHistory\",\n \"View Version History\",\n )}\n </button>\n </div>\n )}\n </div>\n\n {/* Version History Modal */}\n {isFile && file && showVersionHistory && (\n <Suspense\n fallback={\n <div className=\"fixed inset-0 z-50 bg-bg-overlay flex items-center justify-center\">\n <div className=\"bg-bg-surface rounded-lg p-8 animate-in fade-in zoom-in duration-200\">\n <div className=\"flex items-center gap-3\">\n <Clock className=\"size-6 text-action-primary-bg animate-spin\" />\n <span className=\"text-text-primary\">\n {tWithFallback(\n t,\n \"files.info.loadingVersionHistory\",\n \"Loading version history...\",\n )}\n </span>\n </div>\n </div>\n </div>\n }\n >\n <FileVersionPanel\n file={file}\n onClose={() => setShowVersionHistory(false)}\n />\n </Suspense>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAiBA,IAAME,IAAmBC,QACvB,OAAO,wBAAqB,CAAC,MAAM,OAAO,EAAE,SAASC,EAAE,iBAAiB,EAAE,CAC5E;AAQA,SAAgBC,EAAc,EAAE,SAAM,SAAM,cAA+B;CACzE,IAAM,EAAE,SAAMC,EAAQ,GAChBC,IAASC,MAAS,QAClBC,IAAOF,IAAUG,IAAoB,MACrCC,IAAUJ,IAAgC,OAAtBG,GACpB,CAACE,GAAoBC,KAAyBC,EAAS,EAAK,GAE5DC,IAAWC,QAAqB;EACpC,AAAIJ,IACFC,EAAsB,EAAK,IAG7BI,EAAQ;CACV,CAAC;CAED,QAAgB;EACd,IAAMC,KAAgB,MAAyB;GAC7C,AAAIC,EAAM,QAAQ,YAChBJ,EAAS;EAEb;EAGA,OADA,SAAS,iBAAiB,WAAWG,CAAY,SACpC,SAAS,oBAAoB,WAAWA,CAAY;CACnE,GAAG,CAAC,CAAC;CAEL,IAAME,KAAc,MACX,IAAI,KAAKC,CAAI,CAAC,CAAC,eAAe,SAAS;EAC5C,MAAM;EACN,OAAO;EACP,KAAK;EACL,MAAM;EACN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B,KAAUE,KAAQG,KACjB,kBAACwB,GAAD;IACE,UACE,kBAAC,OAAD;KAAK,WAAU;KACb,UAAA,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAACD,GAAD,EAAO,WAAU,6CAA8C,CAAA,GAC/D,kBAAC,QAAD;QAAM,WAAU;QACb,UAAAb,EACCC,GACA,oCACA,4BACF;OACI,CAAA,CACH;;KACF,CAAA;IACF,CAAA;IAGP,UAAA,kBAACrB,GAAD;KACQ;KACN,eAAeW,EAAsB,EAAK;IAC3C,CAAA;GACO,CAAA;EAET;;AAET"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { UpdateFileDocument as e } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { tWithFallback as t } from "../utils/i18n.js";
|
|
3
|
+
import { isUploadVisibility as n } from "../utils/uploadVisibility.js";
|
|
4
|
+
import { UploadVisibilitySelect as r } from "./UploadVisibilitySelect.js";
|
|
5
|
+
import { useRef as i, useState as a } from "react";
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
8
|
+
import { useMutation as u } from "@apollo/client/react";
|
|
9
|
+
// src/files/components/FileVisibilityControl.tsx
|
|
10
|
+
function d({ file: e }) {
|
|
11
|
+
let { t: r } = l();
|
|
12
|
+
return e.canUpdate !== !0 || e.canShare !== !0 || !n(e.visibility) ? /* @__PURE__ */ c("p", {
|
|
13
|
+
className: "text-sm text-text-secondary",
|
|
14
|
+
role: "status",
|
|
15
|
+
children: [
|
|
16
|
+
t(r, "files.visibility.current", "Current visibility"),
|
|
17
|
+
":",
|
|
18
|
+
" ",
|
|
19
|
+
e.visibility ?? t(r, "files.info.unknown", "Unknown")
|
|
20
|
+
]
|
|
21
|
+
}) : /* @__PURE__ */ s(f, { file: e }, `${e.id}:${e.visibility}`);
|
|
22
|
+
}
|
|
23
|
+
function f({ file: d }) {
|
|
24
|
+
let { t: f } = l(), [p, m] = a(d.visibility), [h, g] = a(d.visibility), [_, v] = a(null), [y, b] = a(!1), x = i(!1), [S, { loading: C }] = u(e), w = d.canUpdate === !0 && d.canShare === !0, T = n(h), E = async () => {
|
|
25
|
+
if (w && T && h !== p && !x.current && !y) {
|
|
26
|
+
x.current = !0, v(null);
|
|
27
|
+
try {
|
|
28
|
+
let e = await S({
|
|
29
|
+
variables: {
|
|
30
|
+
id: d.id,
|
|
31
|
+
input: { visibility: h }
|
|
32
|
+
},
|
|
33
|
+
refetchQueries: [
|
|
34
|
+
"GetFilesRootBrowsePage",
|
|
35
|
+
"GetFilesFolderBrowsePage",
|
|
36
|
+
"GetFilesRecentPage",
|
|
37
|
+
"GetFiles"
|
|
38
|
+
],
|
|
39
|
+
onQueryUpdated: (e) => e.options.fetchPolicy !== "standby"
|
|
40
|
+
});
|
|
41
|
+
if (e.error) throw e.error;
|
|
42
|
+
let n = e.data?.updateFile;
|
|
43
|
+
if (n?.id !== d.id || n.visibility !== h) throw Error(t(f, "files.visibility.unconfirmed", "Visibility change was not confirmed. Reload before trying again."));
|
|
44
|
+
m(n.visibility);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
b(!0), v(e instanceof Error ? e.message : t(f, "files.visibility.failed", "Could not change file visibility."));
|
|
47
|
+
} finally {
|
|
48
|
+
x.current = !1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ c("div", {
|
|
53
|
+
className: "space-y-3",
|
|
54
|
+
"aria-busy": C,
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ c("p", {
|
|
57
|
+
className: "text-sm text-text-secondary",
|
|
58
|
+
role: "status",
|
|
59
|
+
children: [
|
|
60
|
+
t(f, "files.visibility.current", "Current visibility"),
|
|
61
|
+
":",
|
|
62
|
+
" ",
|
|
63
|
+
p ?? t(f, "files.info.unknown", "Unknown")
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
w && n(p) && T && /* @__PURE__ */ c(o, { children: [
|
|
67
|
+
/* @__PURE__ */ s(r, {
|
|
68
|
+
value: h,
|
|
69
|
+
onChange: g,
|
|
70
|
+
disabled: C || y,
|
|
71
|
+
label: t(f, "files.info.visibility", "Visibility")
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ s("p", {
|
|
74
|
+
className: "text-xs text-text-secondary",
|
|
75
|
+
children: t(f, "files.visibility.grantsUnchanged", "Changing to Private does not revoke existing file or folder grants. Previously issued download links may remain valid until they expire.")
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ s("button", {
|
|
78
|
+
type: "button",
|
|
79
|
+
disabled: C || y || h === p,
|
|
80
|
+
onClick: () => void E(),
|
|
81
|
+
className: "rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text disabled:opacity-50",
|
|
82
|
+
children: t(f, "files.visibility.save", "Save visibility")
|
|
83
|
+
})
|
|
84
|
+
] }),
|
|
85
|
+
_ && /* @__PURE__ */ s("p", {
|
|
86
|
+
role: "alert",
|
|
87
|
+
className: "text-sm text-status-error-text",
|
|
88
|
+
children: _
|
|
89
|
+
}),
|
|
90
|
+
y && /* @__PURE__ */ s("p", {
|
|
91
|
+
className: "text-sm text-text-secondary",
|
|
92
|
+
children: t(f, "files.visibility.reload", "Reload to check the current visibility before another change.")
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
export { d as FileVisibilityControl };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=FileVisibilityControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileVisibilityControl.js","names":["_Fragment","FileVisibilityControl","useI18n","file","isUploadVisibility","tWithFallback","t","EditableFileVisibility","saved","setSaved","useState","selected","setSelected","error","setError","requiresReload","setRequiresReload","inFlight","useRef","update","useMutation","UpdateFileDocument","canChange","editable","save","result","query","updated","cause","loading","Fragment","UploadVisibilitySelect"],"sources":["../../../src/files/components/FileVisibilityControl.tsx"],"sourcesContent":["import { useRef, useState } from \"react\";\nimport { useMutation } from \"@apollo/client/react\";\nimport { useI18n } from \"@burdenoff/fe-libs/shared/providers/shell/I18nProvider\";\nimport { UpdateFileDocument } from \"../../generated/wspace-operations\";\nimport type { FileItem } from \"../types\";\nimport { tWithFallback } from \"../utils/i18n\";\nimport { isUploadVisibility } from \"../utils/uploadVisibility\";\nimport { UploadVisibilitySelect } from \"./UploadVisibilitySelect\";\n\n/** Changing visibility requires both EDIT and SHARE; the server rechecks both. */\nexport function FileVisibilityControl({ file }: { file: FileItem }) {\n const { t } = useI18n();\n if (\n file.canUpdate !== true ||\n file.canShare !== true ||\n !isUploadVisibility(file.visibility)\n ) {\n return (\n <p className=\"text-sm text-text-secondary\" role=\"status\">\n {tWithFallback(t, \"files.visibility.current\", \"Current visibility\")}:{\" \"}\n {file.visibility ?? tWithFallback(t, \"files.info.unknown\", \"Unknown\")}\n </p>\n );\n }\n return (\n <EditableFileVisibility key={`${file.id}:${file.visibility}`} file={file} />\n );\n}\n\nfunction EditableFileVisibility({ file }: { file: FileItem }) {\n const { t } = useI18n();\n const [saved, setSaved] = useState(file.visibility);\n const [selected, setSelected] = useState(file.visibility);\n const [error, setError] = useState<string | null>(null);\n const [requiresReload, setRequiresReload] = useState(false);\n const inFlight = useRef(false);\n const [update, { loading }] = useMutation(UpdateFileDocument);\n const canChange = file.canUpdate === true && file.canShare === true;\n const editable = isUploadVisibility(selected);\n const save = async () => {\n if (\n !canChange ||\n !editable ||\n selected === saved ||\n inFlight.current ||\n requiresReload\n )\n return;\n inFlight.current = true;\n setError(null);\n try {\n const result = await update({\n variables: { id: file.id, input: { visibility: selected } },\n refetchQueries: [\n \"GetFilesRootBrowsePage\",\n \"GetFilesFolderBrowsePage\",\n \"GetFilesRecentPage\",\n \"GetFiles\",\n ],\n onQueryUpdated: (query) => query.options.fetchPolicy !== \"standby\",\n });\n if (result.error) throw result.error;\n const updated = result.data?.updateFile;\n if (updated?.id !== file.id || updated.visibility !== selected) {\n throw new Error(\n tWithFallback(\n t,\n \"files.visibility.unconfirmed\",\n \"Visibility change was not confirmed. Reload before trying again.\",\n ),\n );\n }\n setSaved(updated.visibility);\n } catch (cause) {\n // A failed response does not prove the server made no change. Never replay it.\n setRequiresReload(true);\n setError(\n cause instanceof Error\n ? cause.message\n : tWithFallback(\n t,\n \"files.visibility.failed\",\n \"Could not change file visibility.\",\n ),\n );\n } finally {\n inFlight.current = false;\n }\n };\n return (\n <div className=\"space-y-3\" aria-busy={loading}>\n <p className=\"text-sm text-text-secondary\" role=\"status\">\n {tWithFallback(t, \"files.visibility.current\", \"Current visibility\")}:{\" \"}\n {saved ?? tWithFallback(t, \"files.info.unknown\", \"Unknown\")}\n </p>\n {canChange && isUploadVisibility(saved) && editable && (\n <>\n <UploadVisibilitySelect\n value={selected}\n onChange={setSelected}\n disabled={loading || requiresReload}\n label={tWithFallback(t, \"files.info.visibility\", \"Visibility\")}\n />\n <p className=\"text-xs text-text-secondary\">\n {tWithFallback(\n t,\n \"files.visibility.grantsUnchanged\",\n \"Changing to Private does not revoke existing file or folder grants. Previously issued download links may remain valid until they expire.\",\n )}\n </p>\n <button\n type=\"button\"\n disabled={loading || requiresReload || selected === saved}\n onClick={() => void save()}\n className=\"rounded-md bg-action-primary-bg px-3 py-2 text-sm font-medium text-action-primary-text disabled:opacity-50\"\n >\n {tWithFallback(t, \"files.visibility.save\", \"Save visibility\")}\n </button>\n </>\n )}\n {error && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error}\n </p>\n )}\n {requiresReload && (\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(\n t,\n \"files.visibility.reload\",\n \"Reload to check the current visibility before another change.\",\n )}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgBC,EAAsB,EAAE,WAA4B;CAClE,IAAM,EAAE,SAA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,EAASqB,EAAQ,UAAU;GAC7B,SAASC,GAAO;IAGd,AADAZ,EAAkB,EAAI,GACtBF,EACEc,aAAiB,QACbA,EAAM,UACNvB,EACEC,GACA,2BACA,mCACF,CACN;GACF,UAAU;IACR,EAAS,UAAU;GACrB;EAvCmB;CAwCrB;CACA,OACE,kBAAC,OAAD;EAAK,WAAU;EAAY,aAAWuB;EAAtC,UAAA;GACE,kBAAC,KAAD;IAAG,WAAU;IAA8B,MAAK;IAAhD,UAAA;KACGxB,EAAcC,GAAG,4BAA4B,oBAAoB;KAAE;KAAE;KACrEE,KAASH,EAAcC,GAAG,sBAAsB,SAAS;IACzD;;GACFgB,KAAalB,EAAmBI,CAAK,KAAKe,KACzC,kBAAAvB,GAAA,EAAA,UAAA;IACE,kBAAC+B,GAAD;KACE,OAAOpB;KACP,UAAUC;KACV,UAAUiB,KAAWd;KACrB,OAAOV,EAAcC,GAAG,yBAAyB,YAAY;IAC9D,CAAA;IACD,kBAAC,KAAD;KAAG,WAAU;KACV,UAAAD,EACCC,GACA,oCACA,0IACF;IACC,CAAA;IACH,kBAAC,UAAD;KACE,MAAK;KACL,UAAUuB,KAAWd,KAAkBJ,MAAaH;KACpD,eAAe,KAAKgB,EAAK;KACzB,WAAU;KAET,UAAAnB,EAAcC,GAAG,yBAAyB,iBAAiB;IACtD,CAAA;GACR,EAAA,CAAA;GAEHO,KACC,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;IACvB,UAAAA;GACA,CAAA;GAEJE,KACC,kBAAC,KAAD;IAAG,WAAU;IACV,UAAAV,EACCC,GACA,2BACA,+DACF;GACC,CAAA;EAEF;;AAET"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UploadVisibility } from '../utils/uploadVisibility';
|
|
2
|
+
export declare function UploadVisibilitySelect({ value, onChange, disabled, label, }: {
|
|
3
|
+
value: UploadVisibility;
|
|
4
|
+
onChange: (value: UploadVisibility) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
label?: string;
|
|
7
|
+
}): import('react').JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FileVisibility as e } from "../../generated/wspace-types.js";
|
|
2
|
+
import { tWithFallback as t } from "../utils/i18n.js";
|
|
3
|
+
import { isUploadVisibility as n } from "../utils/uploadVisibility.js";
|
|
4
|
+
import { useId as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { useI18n as o } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
7
|
+
// src/files/components/UploadVisibilitySelect.tsx
|
|
8
|
+
function s({ value: s, onChange: c, disabled: l = !1, label: u }) {
|
|
9
|
+
let { t: d } = o(), f = r();
|
|
10
|
+
return /* @__PURE__ */ a("div", {
|
|
11
|
+
className: "min-w-0 space-y-1",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ i("label", {
|
|
14
|
+
htmlFor: f,
|
|
15
|
+
className: "block text-sm font-medium text-text-primary",
|
|
16
|
+
children: u ?? t(d, "files.visibility.uploadLabel", "Upload visibility")
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ a("select", {
|
|
19
|
+
id: f,
|
|
20
|
+
value: s,
|
|
21
|
+
disabled: l,
|
|
22
|
+
"aria-describedby": `${f}-hint`,
|
|
23
|
+
onChange: (e) => {
|
|
24
|
+
n(e.target.value) && c(e.target.value);
|
|
25
|
+
},
|
|
26
|
+
className: "w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:opacity-50",
|
|
27
|
+
children: [/* @__PURE__ */ i("option", {
|
|
28
|
+
value: e.Private,
|
|
29
|
+
children: t(d, "files.visibility.private", "Private")
|
|
30
|
+
}), /* @__PURE__ */ i("option", {
|
|
31
|
+
value: e.Workspace,
|
|
32
|
+
children: t(d, "files.visibility.workspace", "Workspace")
|
|
33
|
+
})]
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ i("p", {
|
|
36
|
+
id: `${f}-hint`,
|
|
37
|
+
className: "max-w-sm text-xs text-text-secondary",
|
|
38
|
+
children: s === e.Workspace ? t(d, "files.visibility.workspaceHint", "All workspace members can find and open this file.") : t(d, "files.visibility.privateHint", "Only the uploader and people with an existing file or folder grant can open this file.")
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export { s as UploadVisibilitySelect };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=UploadVisibilitySelect.js.map
|