@oxy.so/services 11.8.0 → 11.9.0
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/lib/commonjs/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/icons/manifest.json +5 -4
- package/lib/commonjs/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/commonjs/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/commonjs/assets/fonts/icons/manifest.json +5 -4
- package/lib/commonjs/ui/components/fileManagement/FileViewer.js +2 -1
- package/lib/commonjs/ui/components/fileManagement/FileViewer.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +3 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js +39 -17
- package/lib/commonjs/ui/hooks/queries/useFileQueries.js.map +1 -1
- package/lib/commonjs/ui/icons/subsetGlyphMaps.js +1 -0
- package/lib/commonjs/ui/icons/subsetGlyphMaps.js.map +1 -1
- package/lib/commonjs/ui/navigation/routes.js +1 -0
- package/lib/commonjs/ui/navigation/routes.js.map +1 -1
- package/lib/commonjs/ui/navigation/surfaceRegistry.js +2 -2
- package/lib/commonjs/ui/navigation/surfaceRegistry.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +102 -44
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileTrashScreen.js +235 -0
- package/lib/commonjs/ui/screens/FileTrashScreen.js.map +1 -0
- package/lib/commonjs/ui/screens/fileManagement/trashActions.js +147 -0
- package/lib/commonjs/ui/screens/fileManagement/trashActions.js.map +1 -0
- package/lib/commonjs/ui/stores/assetStore.js +22 -7
- package/lib/commonjs/ui/stores/assetStore.js.map +1 -1
- package/lib/module/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/module/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/module/assets/assets/fonts/icons/manifest.json +5 -4
- package/lib/module/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/module/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/module/assets/fonts/icons/manifest.json +5 -4
- package/lib/module/ui/components/fileManagement/FileViewer.js +2 -1
- package/lib/module/ui/components/fileManagement/FileViewer.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +3 -1
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useFileQueries.js +38 -17
- package/lib/module/ui/hooks/queries/useFileQueries.js.map +1 -1
- package/lib/module/ui/icons/subsetGlyphMaps.js +1 -0
- package/lib/module/ui/icons/subsetGlyphMaps.js.map +1 -1
- package/lib/module/ui/navigation/routes.js +1 -0
- package/lib/module/ui/navigation/routes.js.map +1 -1
- package/lib/module/ui/navigation/surfaceRegistry.js +2 -2
- package/lib/module/ui/navigation/surfaceRegistry.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +102 -44
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/FileTrashScreen.js +232 -0
- package/lib/module/ui/screens/FileTrashScreen.js.map +1 -0
- package/lib/module/ui/screens/fileManagement/trashActions.js +138 -0
- package/lib/module/ui/screens/fileManagement/trashActions.js.map +1 -0
- package/lib/module/ui/stores/assetStore.js +22 -7
- package/lib/module/ui/stores/assetStore.js.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/FileViewer.d.ts +3 -0
- package/lib/typescript/commonjs/ui/components/fileManagement/FileViewer.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +2 -0
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts +22 -6
- package/lib/typescript/commonjs/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/icons/Ionicons.d.ts +1 -1
- package/lib/typescript/commonjs/ui/icons/Ionicons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts +1 -0
- package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts +2 -0
- package/lib/typescript/commonjs/ui/navigation/surfaceRegistry.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FileTrashScreen.d.ts +14 -0
- package/lib/typescript/commonjs/ui/screens/FileTrashScreen.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/fileManagement/trashActions.d.ts +66 -0
- package/lib/typescript/commonjs/ui/screens/fileManagement/trashActions.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/stores/assetStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/FileViewer.d.ts +3 -0
- package/lib/typescript/module/ui/components/fileManagement/FileViewer.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +2 -0
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts +22 -6
- package/lib/typescript/module/ui/hooks/queries/useFileQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/Ionicons.d.ts +1 -1
- package/lib/typescript/module/ui/icons/Ionicons.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts +1 -0
- package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
- package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts +2 -0
- package/lib/typescript/module/ui/navigation/surfaceRegistry.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileTrashScreen.d.ts +14 -0
- package/lib/typescript/module/ui/screens/FileTrashScreen.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/fileManagement/trashActions.d.ts +66 -0
- package/lib/typescript/module/ui/screens/fileManagement/trashActions.d.ts.map +1 -0
- package/lib/typescript/module/ui/stores/assetStore.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/src/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/src/assets/fonts/icons/manifest.json +5 -4
- package/src/ui/components/fileManagement/FileViewer.tsx +5 -1
- package/src/ui/hooks/queries/__tests__/fileQueries.test.ts +70 -0
- package/src/ui/hooks/queries/queryKeys.ts +2 -0
- package/src/ui/hooks/queries/useFileQueries.ts +45 -16
- package/src/ui/icons/subsetGlyphMaps.ts +1 -0
- package/src/ui/navigation/__tests__/getSurfaceConfig.test.ts +9 -0
- package/src/ui/navigation/routes.ts +2 -0
- package/src/ui/navigation/surfaceRegistry.ts +4 -1
- package/src/ui/screens/FileManagementScreen.tsx +142 -49
- package/src/ui/screens/FileTrashScreen.tsx +228 -0
- package/src/ui/screens/fileManagement/__tests__/trashActions.test.ts +177 -0
- package/src/ui/screens/fileManagement/trashActions.ts +161 -0
- package/src/ui/stores/assetStore.ts +24 -13
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _button = require("@oxy.so/bloom/button");
|
|
10
|
+
var _typography = require("@oxy.so/bloom/typography");
|
|
11
|
+
var _toast = require("@oxy.so/bloom/toast");
|
|
12
|
+
var _surfaces = require("@oxy.so/bloom/surfaces");
|
|
13
|
+
var _theme = require("@oxy.so/bloom/theme");
|
|
14
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
15
|
+
var _Ionicons = _interopRequireDefault(require("../icons/Ionicons.js"));
|
|
16
|
+
var _OxyContext = require("../context/OxyContext.js");
|
|
17
|
+
var _useI18n = require("../hooks/useI18n.js");
|
|
18
|
+
var _useSurfaceHeader = require("../hooks/useSurfaceHeader.js");
|
|
19
|
+
var _queryKeys = require("../hooks/queries/queryKeys.js");
|
|
20
|
+
var _useFileQueries = require("../hooks/queries/useFileQueries.js");
|
|
21
|
+
var _fileManagement = require("../utils/fileManagement.js");
|
|
22
|
+
var _FileListSection = _interopRequireDefault(require("./fileManagement/FileListSection.js"));
|
|
23
|
+
var _FileLibraryError = _interopRequireDefault(require("./fileManagement/FileLibraryError.js"));
|
|
24
|
+
var _shared = require("./fileManagement/shared.js");
|
|
25
|
+
var _trashActions = require("./fileManagement/trashActions.js");
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
|
+
/**
|
|
29
|
+
* The person's Trash (ADR 0043 D5): the files they moved to trash, most
|
|
30
|
+
* recently trashed first. Each can be restored — served again, back in the
|
|
31
|
+
* library — or deleted permanently, after a confirmation (and a second one when
|
|
32
|
+
* an app still uses it). An account's trash never expires, so nothing here
|
|
33
|
+
* disappears on its own; it still counts toward the account's storage.
|
|
34
|
+
*/const FileTrashScreen = ({
|
|
35
|
+
userId
|
|
36
|
+
}) => {
|
|
37
|
+
const {
|
|
38
|
+
user,
|
|
39
|
+
oxyServices
|
|
40
|
+
} = (0, _OxyContext.useOxy)();
|
|
41
|
+
const {
|
|
42
|
+
t
|
|
43
|
+
} = (0, _useI18n.useI18n)();
|
|
44
|
+
const {
|
|
45
|
+
colors
|
|
46
|
+
} = (0, _theme.useTheme)();
|
|
47
|
+
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
48
|
+
const ownerId = userId || user?.id;
|
|
49
|
+
const trashQuery = (0, _useFileQueries.useUserFilesInfinite)(ownerId, 'trash');
|
|
50
|
+
const files = (0, _react.useMemo)(() => trashQuery.data?.pages.flatMap(page => page.files) ?? [], [trashQuery.data]);
|
|
51
|
+
const scrollViewRef = (0, _react.useRef)(null);
|
|
52
|
+
// The file an action is in flight for: its buttons show progress.
|
|
53
|
+
const [busy, setBusy] = (0, _react.useState)(null);
|
|
54
|
+
|
|
55
|
+
// Both lists change: a restored file returns to the library, a deleted one
|
|
56
|
+
// leaves the trash. `files.all` covers both keys.
|
|
57
|
+
const refreshFiles = (0, _react.useCallback)(() => {
|
|
58
|
+
queryClient.invalidateQueries({
|
|
59
|
+
queryKey: _queryKeys.queryKeys.files.all
|
|
60
|
+
});
|
|
61
|
+
}, [queryClient]);
|
|
62
|
+
const handleRestore = (0, _react.useCallback)(async fileId => {
|
|
63
|
+
setBusy({
|
|
64
|
+
id: fileId,
|
|
65
|
+
restoring: true
|
|
66
|
+
});
|
|
67
|
+
try {
|
|
68
|
+
const outcome = await (0, _trashActions.restoreFromTrash)(oxyServices.assets, fileId);
|
|
69
|
+
if (outcome === 'restored') {
|
|
70
|
+
_toast.toast.success(t('fileManagement.toasts.restored'));
|
|
71
|
+
} else {
|
|
72
|
+
_toast.toast.error(t('fileManagement.toasts.notInTrash'));
|
|
73
|
+
}
|
|
74
|
+
(0, _useFileQueries.removeFileFromCache)(queryClient, ownerId, fileId, 'trash');
|
|
75
|
+
refreshFiles();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
_toast.toast.error((0, _shared.getErrorMessage)(error) || t('fileManagement.toasts.restoreFailed'));
|
|
78
|
+
} finally {
|
|
79
|
+
setBusy(null);
|
|
80
|
+
}
|
|
81
|
+
}, [oxyServices, queryClient, ownerId, refreshFiles, t]);
|
|
82
|
+
const handleDeleteForever = (0, _react.useCallback)(async (fileId, filename) => {
|
|
83
|
+
const confirmed = await _surfaces.surfaces.confirm({
|
|
84
|
+
title: t('fileManagement.trashView.deleteForever'),
|
|
85
|
+
description: t('fileManagement.confirms.deleteForever', {
|
|
86
|
+
filename
|
|
87
|
+
}),
|
|
88
|
+
confirmLabel: t('fileManagement.trashView.deleteForever'),
|
|
89
|
+
cancelLabel: t('common.cancel') || 'Cancel',
|
|
90
|
+
destructive: true
|
|
91
|
+
});
|
|
92
|
+
if (!confirmed) return;
|
|
93
|
+
setBusy({
|
|
94
|
+
id: fileId,
|
|
95
|
+
restoring: false
|
|
96
|
+
});
|
|
97
|
+
try {
|
|
98
|
+
const outcome = await (0, _trashActions.deletePermanently)(oxyServices.assets, fileId, uses => _surfaces.surfaces.confirm({
|
|
99
|
+
title: t('fileManagement.trashView.deleteForever'),
|
|
100
|
+
description: t('fileManagement.confirms.deleteForeverInUse', {
|
|
101
|
+
filename,
|
|
102
|
+
count: uses
|
|
103
|
+
}),
|
|
104
|
+
confirmLabel: t('fileManagement.trashView.deleteForever'),
|
|
105
|
+
cancelLabel: t('common.cancel') || 'Cancel',
|
|
106
|
+
destructive: true
|
|
107
|
+
}));
|
|
108
|
+
if (outcome === 'cancelled') return;
|
|
109
|
+
if (outcome === 'deleted') _toast.toast.success(t('fileManagement.toasts.deletedForever'));
|
|
110
|
+
(0, _useFileQueries.removeFileFromCache)(queryClient, ownerId, fileId, 'trash');
|
|
111
|
+
refreshFiles();
|
|
112
|
+
} catch (error) {
|
|
113
|
+
_toast.toast.error((0, _shared.getErrorMessage)(error) || t('fileManagement.toasts.deleteFailed'));
|
|
114
|
+
} finally {
|
|
115
|
+
setBusy(null);
|
|
116
|
+
}
|
|
117
|
+
}, [oxyServices, queryClient, ownerId, refreshFiles, t]);
|
|
118
|
+
const items = (0, _react.useMemo)(() => files.map(file => {
|
|
119
|
+
const trashedOn = file.trashedAt ? new Date(file.trashedAt).toLocaleDateString() : null;
|
|
120
|
+
return {
|
|
121
|
+
id: file.id,
|
|
122
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Ionicons.default, {
|
|
123
|
+
name: (0, _fileManagement.getFileIcon)(file.contentType),
|
|
124
|
+
size: 20,
|
|
125
|
+
color: colors.primary
|
|
126
|
+
}),
|
|
127
|
+
title: file.filename,
|
|
128
|
+
description: trashedOn ? `${(0, _fileManagement.formatFileSize)(file.length)} • ${t('fileManagement.trashView.trashedOn', {
|
|
129
|
+
date: trashedOn
|
|
130
|
+
})}` : (0, _fileManagement.formatFileSize)(file.length),
|
|
131
|
+
// A trashed file is not served, so there is nothing to open.
|
|
132
|
+
onPress: () => {},
|
|
133
|
+
rightElement: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
134
|
+
className: "flex-row items-center gap-1.5 ml-3",
|
|
135
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
|
|
136
|
+
appearance: "subtle",
|
|
137
|
+
tone: "neutral",
|
|
138
|
+
size: "sm",
|
|
139
|
+
iconOnly: true,
|
|
140
|
+
stopPropagation: true,
|
|
141
|
+
disabled: busy !== null && busy.id !== file.id,
|
|
142
|
+
loading: busy?.id === file.id && busy.restoring,
|
|
143
|
+
accessibilityLabel: t('fileManagement.trashView.a11y.restore', {
|
|
144
|
+
name: file.filename
|
|
145
|
+
}),
|
|
146
|
+
onPress: () => handleRestore(file.id),
|
|
147
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Ionicons.default, {
|
|
148
|
+
name: "arrow-undo",
|
|
149
|
+
size: 18,
|
|
150
|
+
color: colors.text
|
|
151
|
+
})
|
|
152
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
|
|
153
|
+
appearance: "subtle",
|
|
154
|
+
tone: "danger",
|
|
155
|
+
size: "sm",
|
|
156
|
+
iconOnly: true,
|
|
157
|
+
stopPropagation: true,
|
|
158
|
+
disabled: busy !== null && busy.id !== file.id,
|
|
159
|
+
loading: busy?.id === file.id && !busy.restoring,
|
|
160
|
+
accessibilityLabel: t('fileManagement.trashView.a11y.deleteForever', {
|
|
161
|
+
name: file.filename
|
|
162
|
+
}),
|
|
163
|
+
onPress: () => handleDeleteForever(file.id, file.filename),
|
|
164
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Ionicons.default, {
|
|
165
|
+
name: "trash",
|
|
166
|
+
size: 18,
|
|
167
|
+
color: colors.error
|
|
168
|
+
})
|
|
169
|
+
})]
|
|
170
|
+
})
|
|
171
|
+
};
|
|
172
|
+
}), [files, colors, busy, handleRestore, handleDeleteForever, t]);
|
|
173
|
+
(0, _useSurfaceHeader.useSurfaceHeader)({
|
|
174
|
+
title: t('fileManagement.trashView.title'),
|
|
175
|
+
subtitle: t('fileManagement.trashView.subtitle'),
|
|
176
|
+
largeTitle: false
|
|
177
|
+
});
|
|
178
|
+
const hasLoadError = trashQuery.isError && files.length === 0;
|
|
179
|
+
const renderEmptyState = () => hasLoadError ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_FileLibraryError.default, {
|
|
180
|
+
title: t('fileManagement.trashView.loadError'),
|
|
181
|
+
description: t('fileManagement.loadError.description'),
|
|
182
|
+
retryLabel: t('fileManagement.retry'),
|
|
183
|
+
onRetry: () => trashQuery.refetch(),
|
|
184
|
+
iconColor: colors.error,
|
|
185
|
+
titleColor: colors.text,
|
|
186
|
+
descriptionColor: colors.textSecondary
|
|
187
|
+
}) : trashQuery.isLoading || !ownerId ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
188
|
+
className: "items-center py-[40px] px-[24px]",
|
|
189
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Ionicons.default, {
|
|
190
|
+
name: "trash-outline",
|
|
191
|
+
size: 64,
|
|
192
|
+
color: colors.textTertiary
|
|
193
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
194
|
+
className: "text-[24px] font-bold mt-[16px] mb-[8px] text-center",
|
|
195
|
+
style: {
|
|
196
|
+
color: colors.text
|
|
197
|
+
},
|
|
198
|
+
children: t('fileManagement.trashView.emptyTitle')
|
|
199
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
200
|
+
className: "text-[16px] text-center leading-[24px]",
|
|
201
|
+
style: {
|
|
202
|
+
color: colors.textSecondary
|
|
203
|
+
},
|
|
204
|
+
children: t('fileManagement.trashView.emptyDescription')
|
|
205
|
+
})]
|
|
206
|
+
});
|
|
207
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
208
|
+
className: "flex-1",
|
|
209
|
+
children: [files.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
|
|
210
|
+
className: "text-[13px] leading-[18px] mx-[16px] mt-[4px] mb-[12px]",
|
|
211
|
+
style: {
|
|
212
|
+
color: colors.textSecondary
|
|
213
|
+
},
|
|
214
|
+
children: t('fileManagement.trashView.notice')
|
|
215
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FileListSection.default, {
|
|
216
|
+
scrollViewRef: scrollViewRef,
|
|
217
|
+
filteredFiles: files,
|
|
218
|
+
searchQuery: "",
|
|
219
|
+
items: items,
|
|
220
|
+
paging: {
|
|
221
|
+
loadingMore: trashQuery.isFetchingNextPage,
|
|
222
|
+
hasMore: trashQuery.hasNextPage ?? false
|
|
223
|
+
},
|
|
224
|
+
refreshing: trashQuery.isRefetching,
|
|
225
|
+
colors: colors,
|
|
226
|
+
t: t,
|
|
227
|
+
onRefresh: () => trashQuery.refetch(),
|
|
228
|
+
onLoadMore: () => trashQuery.fetchNextPage(),
|
|
229
|
+
onClearSearch: () => {},
|
|
230
|
+
renderEmptyState: renderEmptyState
|
|
231
|
+
})]
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
var _default = exports.default = FileTrashScreen;
|
|
235
|
+
//# sourceMappingURL=FileTrashScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_button","_typography","_toast","_surfaces","_theme","_reactQuery","_Ionicons","_interopRequireDefault","_OxyContext","_useI18n","_useSurfaceHeader","_queryKeys","_useFileQueries","_fileManagement","_FileListSection","_FileLibraryError","_shared","_trashActions","_jsxRuntime","e","__esModule","default","FileTrashScreen","userId","user","oxyServices","useOxy","t","useI18n","colors","useTheme","queryClient","useQueryClient","ownerId","id","trashQuery","useUserFilesInfinite","files","useMemo","data","pages","flatMap","page","scrollViewRef","useRef","busy","setBusy","useState","refreshFiles","useCallback","invalidateQueries","queryKey","queryKeys","all","handleRestore","fileId","restoring","outcome","restoreFromTrash","assets","toast","success","error","removeFileFromCache","getErrorMessage","handleDeleteForever","filename","confirmed","surfaces","confirm","title","description","confirmLabel","cancelLabel","destructive","deletePermanently","uses","count","items","map","file","trashedOn","trashedAt","Date","toLocaleDateString","icon","jsx","name","getFileIcon","contentType","size","color","primary","formatFileSize","length","date","onPress","rightElement","jsxs","View","className","children","Button","appearance","tone","iconOnly","stopPropagation","disabled","loading","accessibilityLabel","text","useSurfaceHeader","subtitle","largeTitle","hasLoadError","isError","renderEmptyState","retryLabel","onRetry","refetch","iconColor","titleColor","descriptionColor","textSecondary","isLoading","textTertiary","Text","style","filteredFiles","searchQuery","paging","loadingMore","isFetchingNextPage","hasMore","hasNextPage","refreshing","isRefetching","onRefresh","onLoadMore","fetchNextPage","onClearSearch","_default","exports"],"sourceRoot":"../../../../src","sources":["ui/screens/FileTrashScreen.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,G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QACNC,WAAW,EAAEhG,UAAU,CAACiG,kBAAkB;QAC1CC,OAAO,EAAElG,UAAU,CAACmG,WAAW,IAAI;MACrC,CAAE;MACFC,UAAU,EAAEpG,UAAU,CAACqG,YAAa;MACpC3G,MAAM,EAAEA,MAAO;MACfF,CAAC,EAAEA,CAAE;MACL8G,SAAS,EAAEA,CAAA,KAAMtG,UAAU,CAACoF,OAAO,CAAC,CAAE;MACtCmB,UAAU,EAAEA,CAAA,KAAMvG,UAAU,CAACwG,aAAa,CAAC,CAAE;MAC7CC,aAAa,EAAEA,CAAA,KAAM,CAAC,CAAE;MACxBxB,gBAAgB,EAAEA;IAAiB,CACpC,CAAC;EAAA,CACE,CAAC;AAEX,CAAC;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAAzH,OAAA,GAEaC,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deletePermanently = deletePermanently;
|
|
7
|
+
exports.errorStatus = errorStatus;
|
|
8
|
+
exports.libraryRemovalFor = libraryRemovalFor;
|
|
9
|
+
exports.remainingUses = remainingUses;
|
|
10
|
+
exports.removeFromLibrary = removeFromLibrary;
|
|
11
|
+
exports.restoreFromTrash = restoreFromTrash;
|
|
12
|
+
/**
|
|
13
|
+
* What the file manager does when the person removes, restores or deletes a
|
|
14
|
+
* file (ADR 0043 D5). Pure of React and of the UI: every call takes the asset
|
|
15
|
+
* API and the confirmation it may need, so the decisions are testable on their
|
|
16
|
+
* own and the screens only render.
|
|
17
|
+
*
|
|
18
|
+
* - "Delete" in the library MOVES TO TRASH: the file stops being served, is
|
|
19
|
+
* kept, and can be restored from Trash. A `blocked` file (taken down after a
|
|
20
|
+
* content claim, D10) cannot be trashed — it is already served to nobody —
|
|
21
|
+
* so removing it is the permanent delete, which is its owner's to make.
|
|
22
|
+
* - Permanent deletion happens only from Trash (or for a blocked file). The
|
|
23
|
+
* API refuses to delete a file an application still uses (409, with the
|
|
24
|
+
* number of uses); the person is told and decides, and only then is the
|
|
25
|
+
* delete forced.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** The part of `oxyServices.assets` these actions use. */
|
|
29
|
+
|
|
30
|
+
/** What removing a file from the library does to it. */
|
|
31
|
+
|
|
32
|
+
/** A `blocked` file is deleted (it cannot go to trash); every other is trashed. */
|
|
33
|
+
function libraryRemovalFor(file) {
|
|
34
|
+
return file.status === 'blocked' ? 'delete' : 'trash';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The HTTP status of a failed asset call, when it carries one. */
|
|
38
|
+
function errorStatus(error) {
|
|
39
|
+
if (error && typeof error === 'object') {
|
|
40
|
+
const status = error.status;
|
|
41
|
+
if (typeof status === 'number') return status;
|
|
42
|
+
const response = error.response;
|
|
43
|
+
if (response && typeof response.status === 'number') return response.status;
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The API's machine code of a failed asset call, when it carries one. */
|
|
49
|
+
function errorCode(error) {
|
|
50
|
+
if (error && typeof error === 'object') {
|
|
51
|
+
const code = error.code;
|
|
52
|
+
if (typeof code === 'string') return code;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* How many uses an application still has of a file the API refused to delete
|
|
59
|
+
* (409, `details.summary.remainingLinks`), or `null` when the refusal is not
|
|
60
|
+
* that one.
|
|
61
|
+
*/
|
|
62
|
+
function remainingUses(error) {
|
|
63
|
+
if (errorStatus(error) !== 409 || !error || typeof error !== 'object') return null;
|
|
64
|
+
const details = error.details;
|
|
65
|
+
const summary = details && typeof details === 'object' ? details.summary : undefined;
|
|
66
|
+
const remaining = summary && typeof summary === 'object' ? summary.remainingLinks : undefined;
|
|
67
|
+
return typeof remaining === 'number' && remaining > 0 ? remaining : null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Outcome of {@link deletePermanently}. */
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Delete a file for good. When applications still use it the API refuses;
|
|
74
|
+
* `confirmStillUsed(count)` asks the person, and only a yes forces the delete.
|
|
75
|
+
* A file already gone (404) is `gone` — the caller just refreshes. Any other
|
|
76
|
+
* failure is thrown.
|
|
77
|
+
*/
|
|
78
|
+
async function deletePermanently(assets, fileId, confirmStillUsed) {
|
|
79
|
+
try {
|
|
80
|
+
await assets.delete(fileId);
|
|
81
|
+
return 'deleted';
|
|
82
|
+
} catch (error) {
|
|
83
|
+
if (errorStatus(error) === 404) return 'gone';
|
|
84
|
+
const uses = remainingUses(error);
|
|
85
|
+
if (uses === null) throw error;
|
|
86
|
+
if (!(await confirmStillUsed(uses))) return 'cancelled';
|
|
87
|
+
await assets.delete(fileId, {
|
|
88
|
+
force: true
|
|
89
|
+
});
|
|
90
|
+
return 'deleted';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Outcome of {@link restoreFromTrash}. */
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Bring a file back from trash. One that is no longer in trash — restored
|
|
98
|
+
* elsewhere, or blocked after a claim (409 `FILE_NOT_IN_TRASH`) — or no longer
|
|
99
|
+
* exists (404) is reported, not thrown: the trash list is just stale.
|
|
100
|
+
*/
|
|
101
|
+
async function restoreFromTrash(assets, fileId) {
|
|
102
|
+
try {
|
|
103
|
+
await assets.restore(fileId);
|
|
104
|
+
return 'restored';
|
|
105
|
+
} catch (error) {
|
|
106
|
+
if (errorStatus(error) === 404) return 'gone';
|
|
107
|
+
if (errorStatus(error) === 409 && errorCode(error) === 'FILE_NOT_IN_TRASH') {
|
|
108
|
+
return 'not_in_trash';
|
|
109
|
+
}
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Per-file outcome of removing several files from the library. */
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Remove several files from the library at once: each goes to trash, except a
|
|
118
|
+
* blocked one, which is deleted (asking about remaining uses as
|
|
119
|
+
* {@link deletePermanently} does). One failure never stops the others.
|
|
120
|
+
*/
|
|
121
|
+
async function removeFromLibrary(assets, files, confirmStillUsed) {
|
|
122
|
+
const result = {
|
|
123
|
+
trashed: [],
|
|
124
|
+
deleted: [],
|
|
125
|
+
failed: []
|
|
126
|
+
};
|
|
127
|
+
const toTrash = files.filter(file => libraryRemovalFor(file) === 'trash');
|
|
128
|
+
const toDelete = files.filter(file => libraryRemovalFor(file) === 'delete');
|
|
129
|
+
const trashed = await Promise.allSettled(toTrash.map(file => assets.trash(file.id)));
|
|
130
|
+
trashed.forEach((settled, index) => {
|
|
131
|
+
(settled.status === 'fulfilled' ? result.trashed : result.failed).push(toTrash[index].id);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// One at a time: each may ask the person a question, and two questions at
|
|
135
|
+
// once would stack.
|
|
136
|
+
for (const file of toDelete) {
|
|
137
|
+
try {
|
|
138
|
+
const outcome = await deletePermanently(assets, file.id, uses => confirmStillUsed(uses, file.filename));
|
|
139
|
+
// `cancelled`: the person kept it; nothing to report.
|
|
140
|
+
if (outcome !== 'cancelled') result.deleted.push(file.id);
|
|
141
|
+
} catch {
|
|
142
|
+
result.failed.push(file.id);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return result;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=trashActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["libraryRemovalFor","file","status","errorStatus","error","response","undefined","errorCode","code","remainingUses","details","summary","remaining","remainingLinks","deletePermanently","assets","fileId","confirmStillUsed","delete","uses","force","restoreFromTrash","restore","removeFromLibrary","files","result","trashed","deleted","failed","toTrash","filter","toDelete","Promise","allSettled","map","trash","id","forEach","settled","index","push","outcome","filename"],"sourceRoot":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IAAI,CAACmC,EAAE,CAAC;IAC7B;EACF;EACA,OAAOX,MAAM;AACf","ignoreList":[]}
|
|
@@ -5,6 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useUploadProgress = exports.useIsAssetLinked = exports.useAssetsByEntity = exports.useAssetsByApp = exports.useAssets = exports.useAssetUsageCount = exports.useAssetStore = exports.useAssetLoading = exports.useAssetErrors = exports.useAsset = void 0;
|
|
7
7
|
var _zustand = require("zustand");
|
|
8
|
+
/**
|
|
9
|
+
* Whether a link is the given application's use. The Oxy API names the using
|
|
10
|
+
* application by ID (`applicationId`, mirrored in `app` since ADR 0043 D4);
|
|
11
|
+
* a link added locally before the server answered may still carry the name
|
|
12
|
+
* the caller passed in `app`. Either matches.
|
|
13
|
+
*/
|
|
14
|
+
function linkIsApp(link, app) {
|
|
15
|
+
return (link.applicationId ?? link.app) === app || link.app === app;
|
|
16
|
+
}
|
|
17
|
+
function sameLink(link, app, entityType, entityId) {
|
|
18
|
+
return linkIsApp(link, app) && link.entityType === entityType && link.entityId === entityId;
|
|
19
|
+
}
|
|
8
20
|
const initialState = {
|
|
9
21
|
assets: {},
|
|
10
22
|
uploadProgress: {},
|
|
@@ -90,12 +102,13 @@ const useAssetStore = exports.useAssetStore = (0, _zustand.create)((set, get) =>
|
|
|
90
102
|
if (!asset) return state;
|
|
91
103
|
|
|
92
104
|
// Check if link already exists
|
|
93
|
-
const existingLink = asset.links.find(l => l.
|
|
105
|
+
const existingLink = asset.links.find(l => sameLink(l, link.applicationId ?? link.app, link.entityType, link.entityId) || sameLink(l, link.app, link.entityType, link.entityId));
|
|
94
106
|
if (existingLink) return state;
|
|
95
107
|
const updatedAsset = {
|
|
96
108
|
...asset,
|
|
97
109
|
links: [...asset.links, link],
|
|
98
|
-
usageCount: asset.links.length + 1
|
|
110
|
+
usageCount: asset.links.length + 1,
|
|
111
|
+
inUse: true
|
|
99
112
|
};
|
|
100
113
|
return {
|
|
101
114
|
assets: {
|
|
@@ -109,12 +122,14 @@ const useAssetStore = exports.useAssetStore = (0, _zustand.create)((set, get) =>
|
|
|
109
122
|
set(state => {
|
|
110
123
|
const asset = state.assets[assetId];
|
|
111
124
|
if (!asset) return state;
|
|
112
|
-
const filteredLinks = asset.links.filter(link => !(link
|
|
125
|
+
const filteredLinks = asset.links.filter(link => !sameLink(link, app, entityType, entityId));
|
|
113
126
|
const updatedAsset = {
|
|
114
127
|
...asset,
|
|
115
128
|
links: filteredLinks,
|
|
116
129
|
usageCount: filteredLinks.length,
|
|
117
|
-
|
|
130
|
+
// The last link going never trashes the file (ADR 0043 D5): it stays
|
|
131
|
+
// where it is and is only no longer in use.
|
|
132
|
+
inUse: filteredLinks.length > 0
|
|
118
133
|
};
|
|
119
134
|
return {
|
|
120
135
|
assets: {
|
|
@@ -184,13 +199,13 @@ const useAssetStore = exports.useAssetStore = (0, _zustand.create)((set, get) =>
|
|
|
184
199
|
const {
|
|
185
200
|
assets
|
|
186
201
|
} = get();
|
|
187
|
-
return Object.values(assets).filter(asset => asset.links.some(link => link
|
|
202
|
+
return Object.values(assets).filter(asset => asset.links.some(link => linkIsApp(link, app)));
|
|
188
203
|
},
|
|
189
204
|
getAssetsByEntity: (app, entityType, entityId) => {
|
|
190
205
|
const {
|
|
191
206
|
assets
|
|
192
207
|
} = get();
|
|
193
|
-
return Object.values(assets).filter(asset => asset.links.some(link => link
|
|
208
|
+
return Object.values(assets).filter(asset => asset.links.some(link => sameLink(link, app, entityType, entityId)));
|
|
194
209
|
},
|
|
195
210
|
getAssetUsageCount: assetId => {
|
|
196
211
|
const {
|
|
@@ -205,7 +220,7 @@ const useAssetStore = exports.useAssetStore = (0, _zustand.create)((set, get) =>
|
|
|
205
220
|
} = get();
|
|
206
221
|
const asset = assets[assetId];
|
|
207
222
|
if (!asset) return false;
|
|
208
|
-
return asset.links.some(link => link
|
|
223
|
+
return asset.links.some(link => sameLink(link, app, entityType, entityId));
|
|
209
224
|
},
|
|
210
225
|
// Reset store
|
|
211
226
|
reset: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_zustand","require","initialState","assets","uploadProgress","loading","uploading","linking","deleting","errors","useAssetStore","exports","create","set","get","setAsset","asset","state","id","mergeAsset","patch","setAssets","assetMap","reduce","acc","removeAsset","assetId","removed","rest","setUploadProgress","fileId","progress","removeUploadProgress","addLink","
|
|
1
|
+
{"version":3,"names":["_zustand","require","linkIsApp","link","app","applicationId","sameLink","entityType","entityId","initialState","assets","uploadProgress","loading","uploading","linking","deleting","errors","useAssetStore","exports","create","set","get","setAsset","asset","state","id","mergeAsset","patch","setAssets","assetMap","reduce","acc","removeAsset","assetId","removed","rest","setUploadProgress","fileId","progress","removeUploadProgress","addLink","existingLink","links","find","l","updatedAsset","usageCount","length","inUse","removeLink","filteredLinks","filter","setUploading","setLinking","setDeleting","setUploadError","error","upload","setLinkError","setDeleteError","delete","clearErrors","getAssetsByApp","Object","values","some","getAssetsByEntity","getAssetUsageCount","isAssetLinked","reset","useAssets","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked"],"sourceRoot":"../../../../src","sources":["ui/stores/assetStore.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAACC,IAAe,EAAEC,GAAW,EAAW;EACxD,OAAO,CAACD,IAAI,CAACE,aAAa,IAAIF,IAAI,CAACC,GAAG,MAAMA,GAAG,IAAID,IAAI,CAACC,GAAG,KAAKA,GAAG;AACrE;AAEA,SAASE,QAAQA,CAACH,IAAe,EAAEC,GAAW,EAAEG,UAAkB,EAAEC,QAAgB,EAAW;EAC7F,OAAON,SAAS,CAACC,IAAI,EAAEC,GAAG,CAAC,IAAID,IAAI,CAACI,UAAU,KAAKA,UAAU,IAAIJ,IAAI,CAACK,QAAQ,KAAKA,QAAQ;AAC7F;AA4DA,MA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,CAAC4C,aAAa,CAACnC,OAAO,EAAE7B,GAAG,EAAEG,UAAU,EAAEC,QAAQ,CAAC,CAAC;AAACU,OAAA,CAAA4D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
Binary file
|
|
Binary file
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"ionicons": {
|
|
6
6
|
"fontFamily": "OxyServicesIonicons",
|
|
7
7
|
"file": "src/assets/fonts/icons/OxyServicesIonicons.ttf",
|
|
8
|
-
"bytes":
|
|
9
|
-
"sha256": "
|
|
8
|
+
"bytes": 43160,
|
|
9
|
+
"sha256": "c062679623ae08f1fb0231729c1f9efae97044e35ffe51f7c0544f866cb2f959",
|
|
10
10
|
"names": [
|
|
11
11
|
"add",
|
|
12
12
|
"add-circle-outline",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"arrow-back",
|
|
19
19
|
"arrow-down",
|
|
20
20
|
"arrow-forward",
|
|
21
|
+
"arrow-undo",
|
|
21
22
|
"arrow-up",
|
|
22
23
|
"at",
|
|
23
24
|
"briefcase-outline",
|
|
@@ -152,7 +153,7 @@
|
|
|
152
153
|
"fontFamily": "OxyServicesMaterialCommunityIcons",
|
|
153
154
|
"file": "src/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf",
|
|
154
155
|
"bytes": 29224,
|
|
155
|
-
"sha256": "
|
|
156
|
+
"sha256": "c7fdc975626c395ee2b1d0c462ae8dab6f800935bb64739d2d07ea4a30da51d0",
|
|
156
157
|
"names": [
|
|
157
158
|
"account",
|
|
158
159
|
"account-circle",
|
|
@@ -351,5 +352,5 @@
|
|
|
351
352
|
}
|
|
352
353
|
},
|
|
353
354
|
"glyphMapsFile": "src/ui/icons/subsetGlyphMaps.ts",
|
|
354
|
-
"glyphMapsSha256": "
|
|
355
|
+
"glyphMapsSha256": "1f2e6005461383abb6c5443981341e8ae716110eb6de6590f8a3caa4cfe614b0"
|
|
355
356
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"ionicons": {
|
|
6
6
|
"fontFamily": "OxyServicesIonicons",
|
|
7
7
|
"file": "src/assets/fonts/icons/OxyServicesIonicons.ttf",
|
|
8
|
-
"bytes":
|
|
9
|
-
"sha256": "
|
|
8
|
+
"bytes": 43160,
|
|
9
|
+
"sha256": "c062679623ae08f1fb0231729c1f9efae97044e35ffe51f7c0544f866cb2f959",
|
|
10
10
|
"names": [
|
|
11
11
|
"add",
|
|
12
12
|
"add-circle-outline",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"arrow-back",
|
|
19
19
|
"arrow-down",
|
|
20
20
|
"arrow-forward",
|
|
21
|
+
"arrow-undo",
|
|
21
22
|
"arrow-up",
|
|
22
23
|
"at",
|
|
23
24
|
"briefcase-outline",
|
|
@@ -152,7 +153,7 @@
|
|
|
152
153
|
"fontFamily": "OxyServicesMaterialCommunityIcons",
|
|
153
154
|
"file": "src/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf",
|
|
154
155
|
"bytes": 29224,
|
|
155
|
-
"sha256": "
|
|
156
|
+
"sha256": "c7fdc975626c395ee2b1d0c462ae8dab6f800935bb64739d2d07ea4a30da51d0",
|
|
156
157
|
"names": [
|
|
157
158
|
"account",
|
|
158
159
|
"account-circle",
|
|
@@ -351,5 +352,5 @@
|
|
|
351
352
|
}
|
|
352
353
|
},
|
|
353
354
|
"glyphMapsFile": "src/ui/icons/subsetGlyphMaps.ts",
|
|
354
|
-
"glyphMapsSha256": "
|
|
355
|
+
"glyphMapsSha256": "1f2e6005461383abb6c5443981341e8ae716110eb6de6590f8a3caa4cfe614b0"
|
|
355
356
|
}
|
|
@@ -42,6 +42,7 @@ export const FileViewer = ({
|
|
|
42
42
|
onClose,
|
|
43
43
|
onDownload,
|
|
44
44
|
onDelete,
|
|
45
|
+
deleteLabel,
|
|
45
46
|
isOwner
|
|
46
47
|
}) => {
|
|
47
48
|
const {
|
|
@@ -378,7 +379,7 @@ export const FileViewer = ({
|
|
|
378
379
|
onClose();
|
|
379
380
|
onDelete(file.id, file.filename);
|
|
380
381
|
},
|
|
381
|
-
children:
|
|
382
|
+
children: deleteLabel
|
|
382
383
|
})
|
|
383
384
|
})]
|
|
384
385
|
})]
|