remove(i)}
+ onRestore={() => restore(i)}
+ />
));
return (
diff --git a/frontend/src/i18n/translations/en-US.ts b/frontend/src/i18n/translations/en-US.ts
index df90a399..36eefcc4 100644
--- a/frontend/src/i18n/translations/en-US.ts
+++ b/frontend/src/i18n/translations/en-US.ts
@@ -358,6 +358,13 @@ export default {
// END /share/[id]
+ // /share/[id]/edit
+ "share.edit.title": "Edit {shareId}",
+ "share.edit.append-upload": "Append file",
+ "share.edit.notify.generic-error": "An error occurred while finishing your share.",
+ "share.edit.notify.save-success": "Share updated successfully",
+ // END /share/[id]/edit
+
// /admin/config
"admin.config.title": "Configuration",
"admin.config.category.general": "General",
diff --git a/frontend/src/i18n/translations/zh-CN.ts b/frontend/src/i18n/translations/zh-CN.ts
index 421fbc01..9762829a 100644
--- a/frontend/src/i18n/translations/zh-CN.ts
+++ b/frontend/src/i18n/translations/zh-CN.ts
@@ -264,6 +264,12 @@ export default {
"share.modal.file-preview.error.not-supported.title": "该文件类型不支持预览",
"share.modal.file-preview.error.not-supported.description": "该文件类型不支持预览,请下载后打开查看",
// END /share/[id]
+ // /share/[id]/edit
+ "share.edit.title": "编辑 {shareId}",
+ "share.edit.append-upload": "追加文件",
+ "share.edit.notify.generic-error": "保存共享的过程中发生了错误",
+ "share.edit.notify.save-success": "共享已更新成功",
+ // END /share/[id]/edit
// /admin/config
"admin.config.title": "配置管理",
"admin.config.category.general": "通用",
diff --git a/frontend/src/pages/account/shares.tsx b/frontend/src/pages/account/shares.tsx
index 230498d5..9edb2286 100644
--- a/frontend/src/pages/account/shares.tsx
+++ b/frontend/src/pages/account/shares.tsx
@@ -16,7 +16,7 @@ import { useModals } from "@mantine/modals";
import moment from "moment";
import Link from "next/link";
import { useEffect, useState } from "react";
-import { TbInfoCircle, TbLink, TbTrash } from "react-icons/tb";
+import { TbEdit, TbInfoCircle, TbLink, TbTrash } from "react-icons/tb";
import { FormattedMessage } from "react-intl";
import Meta from "../../components/Meta";
import showShareInformationsModal from "../../components/account/showShareInformationsModal";
@@ -110,6 +110,11 @@ const MyShares = () => {
+
+
+
+
+
{
+ const t = useTranslate();
+ const modals = useModals();
+ const [isLoading, setIsLoading] = useState(true);
+ const [share, setShare] = useState();
+
+ useEffect(() => {
+ shareService
+ .getFromOwner(shareId)
+ .then((share) => {
+ setShare(share);
+ })
+ .catch((e) => {
+ const { error } = e.response.data;
+ if (e.response.status == 404) {
+ if (error == "share_removed") {
+ showErrorModal(
+ modals,
+ t("share.error.removed.title"),
+ e.response.data.message,
+ );
+ } else {
+ showErrorModal(
+ modals,
+ t("share.error.not-found.title"),
+ t("share.error.not-found.description"),
+ );
+ }
+ } else {
+ showErrorModal(modals, t("common.error"), t("common.error.unknown"));
+ }
+ })
+ .finally(() => {
+ setIsLoading(false);
+ });
+ }, []);
+
+ if (isLoading) return ;
+
+ return (
+ <>
+
+
+ >
+ );
+};
+
+export default Share;
diff --git a/frontend/src/pages/upload/index.tsx b/frontend/src/pages/upload/index.tsx
index 1b688528..4ab894d1 100644
--- a/frontend/src/pages/upload/index.tsx
+++ b/frontend/src/pages/upload/index.tsx
@@ -202,7 +202,9 @@ const Upload = ({
showCreateUploadModalCallback={showCreateUploadModalCallback}
isUploading={isUploading}
/>
- {files.length > 0 && }
+ {files.length > 0 && (
+ files={files} setFiles={setFiles} />
+ )}
>
);
};
diff --git a/frontend/src/services/share.service.ts b/frontend/src/services/share.service.ts
index a256b808..e7ea73a5 100644
--- a/frontend/src/services/share.service.ts
+++ b/frontend/src/services/share.service.ts
@@ -19,10 +19,18 @@ const completeShare = async (id: string) => {
return (await api.post(`shares/${id}/complete`)).data;
};
+const revertComplete = async (id: string) => {
+ return (await api.delete(`shares/${id}/complete`)).data;
+};
+
const get = async (id: string): Promise => {
return (await api.get(`shares/${id}`)).data;
};
+const getFromOwner = async (id: string): Promise => {
+ return (await api.get(`shares/${id}/from-owner`)).data;
+};
+
const getMetaData = async (id: string): Promise => {
return (await api.get(`shares/${id}/metaData`)).data;
};
@@ -63,6 +71,10 @@ const downloadFile = async (shareId: string, fileId: string) => {
window.location.href = `${window.location.origin}/api/shares/${shareId}/files/${fileId}`;
};
+const removeFile = async (shareId: string, fileId: string) => {
+ await api.delete(`shares/${shareId}/files/${fileId}`);
+};
+
const uploadFile = async (
shareId: string,
readerEvent: ProgressEvent,
@@ -121,14 +133,17 @@ const removeReverseShare = async (id: string) => {
export default {
create,
completeShare,
+ revertComplete,
getShareToken,
get,
+ getFromOwner,
remove,
getMetaData,
doesFileSupportPreview,
getMyShares,
isShareIdAvailable,
downloadFile,
+ removeFile,
uploadFile,
setReverseShare,
createReverseShare,
diff --git a/frontend/src/types/File.type.ts b/frontend/src/types/File.type.ts
index 7c0927af..f50cd9db 100644
--- a/frontend/src/types/File.type.ts
+++ b/frontend/src/types/File.type.ts
@@ -7,3 +7,5 @@ export type FileMetaData = {
name: string;
size: string;
};
+
+export type FileListItem = FileUpload | (FileMetaData & { deleted?: boolean });
|