diff --git a/packages/common-components/src/TagsInput/TagsInput.tsx b/packages/common-components/src/TagsInput/TagsInput.tsx index 33789a39da..a7a4b06867 100644 --- a/packages/common-components/src/TagsInput/TagsInput.tsx +++ b/packages/common-components/src/TagsInput/TagsInput.tsx @@ -7,7 +7,7 @@ import { } from "@chainsafe/common-theme" import clsx from "clsx" import AsyncSelect from "react-select/async" -import { Typography } from ".." +import { Typography } from "../Typography" import { Styles, ValueType, ActionMeta, ActionTypes } from "react-select" const useStyles = makeStyles( diff --git a/packages/files-ui/src/Components/Modules/FileBrowsers/CSFFileBrowser.tsx b/packages/files-ui/src/Components/Modules/FileBrowsers/CSFFileBrowser.tsx index b5fbbac8d5..c87cb38f2e 100644 --- a/packages/files-ui/src/Components/Modules/FileBrowsers/CSFFileBrowser.tsx +++ b/packages/files-ui/src/Components/Modules/FileBrowsers/CSFFileBrowser.tsx @@ -76,7 +76,7 @@ const CSFFileBrowser: React.FC = () => { refreshContents(true) }, [bucket, refreshContents]) - const moveItemsToBin = useCallback(async (cids: string[]) => { + const moveItemsToBin = useCallback(async (cids: string[], hideToast?: boolean) => { if (!bucket) return await Promise.all( cids.map(async (cid: string) => { @@ -92,13 +92,15 @@ const CSFFileBrowser: React.FC = () => { new_path: getPathWithFile("/", itemToDelete.name), destination: buckets.find(b => b.type === "trash")?.id }) - const message = `${ - itemToDelete.isFolder ? t`Folder` : t`File` - } ${t`deleted successfully`}` - addToastMessage({ - message: message, - appearance: "success" - }) + if (!hideToast) { + const message = `${ + itemToDelete.isFolder ? t`Folder` : t`File` + } ${t`deleted successfully`}` + addToastMessage({ + message: message, + appearance: "success" + }) + } return Promise.resolve() } catch (error) { const message = `${t`There was an error deleting this`} ${ diff --git a/packages/files-ui/src/Components/Modules/FileBrowsers/CopyToSharedFolderModal.tsx b/packages/files-ui/src/Components/Modules/FileBrowsers/ShareToSharedFolderModal.tsx similarity index 94% rename from packages/files-ui/src/Components/Modules/FileBrowsers/CopyToSharedFolderModal.tsx rename to packages/files-ui/src/Components/Modules/FileBrowsers/ShareToSharedFolderModal.tsx index 6bde63894f..d8eb8fa1c0 100644 --- a/packages/files-ui/src/Components/Modules/FileBrowsers/CopyToSharedFolderModal.tsx +++ b/packages/files-ui/src/Components/Modules/FileBrowsers/ShareToSharedFolderModal.tsx @@ -4,6 +4,7 @@ import CustomModal from "../../Elements/CustomModal" import { t, Trans } from "@lingui/macro" import { Button, + CheckboxInput, CheckCircleIcon, Link, Loading, @@ -96,11 +97,16 @@ const useStyles = makeStyles( justifyContent: "center", flexDirection: "column" }, - buttonsContainer: { + checkboxContainer: { display: "flex", justifyContent: "center", marginTop: constants.generalUnit * 4 }, + buttonsContainer: { + display: "flex", + justifyContent: "center", + marginTop: constants.generalUnit * 2 + }, mainButton: { width: "100%" }, @@ -199,10 +205,11 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) => const [sharedFolderName, setSharedFolderName] = useState("") const { sharedFolderReaders, sharedFolderWriters, handleLookupUser, onNewUsers, usersError } = useLookupSharedFolderUser() const [isUsingCurrentBucket, setIsUsingCurrentBucket] = useState(true) + const [keepOriginalFile, setKeepOriginalFile] = useState(true) const [currentStep, setCurrentStep] = useState("1_SHARED_FOLDER_SELECTION_CREATION") const [destinationBucket, setDestinationBucket] = useState() const { buckets, uploadFiles } = useFiles() - const { bucket } = useFileBrowser() + const { bucket, deleteItems } = useFileBrowser() const { profile } = useUser() const { getFile, error: downloadError, isDownloading } = useGetFile() const [error, setError] = useState("") @@ -294,6 +301,11 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) => setIsUploading(true) uploadFiles(bucketToUpload.id, [new File([fileContent], file.name)], UPLOAD_PATH, bucketToUpload.encryptionKey) + .then(() => { + if (!keepOriginalFile) { + deleteItems && deleteItems([file.cid], true) + } + }) .catch((e) => { setError(t`Error while uploading ${file.name}`) console.error(e) @@ -315,7 +327,9 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) => sharedFolderName, uploadFiles, sharedFolderReaders, - sharedFolderWriters + sharedFolderWriters, + deleteItems, + keepOriginalFile ]) @@ -432,7 +446,7 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) =>
- Copy to shared folder + Share file
{(error || downloadError) && ( @@ -477,6 +491,13 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) => {usersError} )} +
+ setKeepOriginalFile(!keepOriginalFile)} + label={t`Keep original file`} + /> +
@@ -515,7 +539,7 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) => variant="h4" component="p" > - File added successfully! + File shared successfully! diff --git a/packages/files-ui/src/Components/Modules/FileBrowsers/views/FileSystemItem/FileSystemItem.tsx b/packages/files-ui/src/Components/Modules/FileBrowsers/views/FileSystemItem/FileSystemItem.tsx index 40a43cc3d6..741ed2cf76 100644 --- a/packages/files-ui/src/Components/Modules/FileBrowsers/views/FileSystemItem/FileSystemItem.tsx +++ b/packages/files-ui/src/Components/Modules/FileBrowsers/views/FileSystemItem/FileSystemItem.tsx @@ -233,7 +233,7 @@ const FileSystemItem = ({ <> - Copy to shared folder + Share ), diff --git a/packages/files-ui/src/Components/Modules/FileBrowsers/views/FilesList.tsx b/packages/files-ui/src/Components/Modules/FileBrowsers/views/FilesList.tsx index 56a8665bf9..ed3e60ed27 100644 --- a/packages/files-ui/src/Components/Modules/FileBrowsers/views/FilesList.tsx +++ b/packages/files-ui/src/Components/Modules/FileBrowsers/views/FilesList.tsx @@ -50,7 +50,7 @@ import SurveyBanner from "../../../SurveyBanner" import { DragPreviewLayer } from "./DragPreviewLayer" import { useFileBrowser } from "../../../../Contexts/FileBrowserContext" import ReportFileModal from "../ReportFileModal" -import CopyToSharedFolderModal from "../CopyToSharedFolderModal" +import ShareToSharedFolderModal from "../ShareToSharedFolderModal" import SharedUsers from "../../../Elements/SharedUsers" const baseOperations: FileOperation[] = ["download", "info", "preview"] @@ -1097,7 +1097,7 @@ const FilesList = ({ isShared = false }: Props) => { /> } { isCopyToSharedFolerModalOpen && filePath && fileIndex !== undefined && - { setIsCopyToSharedFolerModalOpen(false) diff --git a/packages/files-ui/src/Contexts/FileBrowserContext.tsx b/packages/files-ui/src/Contexts/FileBrowserContext.tsx index b60005a501..4252705ebb 100644 --- a/packages/files-ui/src/Contexts/FileBrowserContext.tsx +++ b/packages/files-ui/src/Contexts/FileBrowserContext.tsx @@ -11,7 +11,7 @@ interface FileBrowserContext extends IFileBrowserModuleProps { renameItem?: (cid: string, newName: string) => Promise moveItems?: (cids: string[], newPath: string) => Promise downloadFile?: (cid: string) => Promise - deleteItems?: (cid: string[]) => Promise + deleteItems?: (cid: string[], hideToast?: boolean) => Promise recoverItems?: (cid: string[], newPath: string) => Promise viewFolder?: (cid: string) => void allowDropUpload?: boolean diff --git a/packages/files-ui/src/locales/de/messages.po b/packages/files-ui/src/locales/de/messages.po index d37caaa1e7..5805473843 100644 --- a/packages/files-ui/src/locales/de/messages.po +++ b/packages/files-ui/src/locales/de/messages.po @@ -130,9 +130,6 @@ msgstr "" msgid "Copy over" msgstr "" -msgid "Copy to shared folder" -msgstr "" - msgid "Create" msgstr "Erstellen" @@ -241,15 +238,15 @@ msgstr "Datei" msgid "File Info" msgstr "Dateiinfos" -msgid "File added successfully!" -msgstr "" - msgid "File format not supported." msgstr "Dateiformat wird nicht unterstützt." msgid "File path" msgstr "" +msgid "File shared successfully!" +msgstr "" + msgid "File size" msgstr "Dateigröße" @@ -325,6 +322,9 @@ msgstr "Infos" msgid "I’m done saving my backup secret phrase" msgstr "Ich bin fertig mit dem Speichern meines Sixherungsgeheimsatzes" +msgid "Keep original file" +msgstr "" + msgid "Language" msgstr "Sprache" @@ -364,6 +364,9 @@ msgstr "" msgid "Move" msgstr "Verschieben" +msgid "Move over" +msgstr "" + msgid "Move selected" msgstr "Ausgewählte verschieben" @@ -577,6 +580,12 @@ msgstr "Benutzername wird eingestellt" msgid "Settings" msgstr "Einstellungen" +msgid "Share" +msgstr "" + +msgid "Share file" +msgstr "" + msgid "Shared" msgstr "Geteilt" diff --git a/packages/files-ui/src/locales/en/messages.po b/packages/files-ui/src/locales/en/messages.po index b35cf0668d..93b23a2bae 100644 --- a/packages/files-ui/src/locales/en/messages.po +++ b/packages/files-ui/src/locales/en/messages.po @@ -130,9 +130,6 @@ msgstr "Copy info" msgid "Copy over" msgstr "Copy over" -msgid "Copy to shared folder" -msgstr "Copy to shared folder" - msgid "Create" msgstr "Create" @@ -244,15 +241,15 @@ msgstr "File" msgid "File Info" msgstr "File Info" -msgid "File added successfully!" -msgstr "File added successfully!" - msgid "File format not supported." msgstr "File format not supported." msgid "File path" msgstr "File path" +msgid "File shared successfully!" +msgstr "File shared successfully!" + msgid "File size" msgstr "File size" @@ -328,6 +325,9 @@ msgstr "Info" msgid "I’m done saving my backup secret phrase" msgstr "I’m done saving my backup secret phrase" +msgid "Keep original file" +msgstr "Keep original file" + msgid "Language" msgstr "Language" @@ -367,6 +367,9 @@ msgstr "Manage Access" msgid "Move" msgstr "Move" +msgid "Move over" +msgstr "Move over" + msgid "Move selected" msgstr "Move selected" @@ -580,6 +583,12 @@ msgstr "Setting Username" msgid "Settings" msgstr "Settings" +msgid "Share" +msgstr "Share" + +msgid "Share file" +msgstr "Share file" + msgid "Shared" msgstr "Shared" diff --git a/packages/files-ui/src/locales/es/messages.po b/packages/files-ui/src/locales/es/messages.po index fb01b89dea..3fcb73ad52 100644 --- a/packages/files-ui/src/locales/es/messages.po +++ b/packages/files-ui/src/locales/es/messages.po @@ -131,9 +131,6 @@ msgstr "" msgid "Copy over" msgstr "" -msgid "Copy to shared folder" -msgstr "" - msgid "Create" msgstr "Crear" @@ -245,15 +242,15 @@ msgstr "Archivo" msgid "File Info" msgstr "Información del archivo" -msgid "File added successfully!" -msgstr "" - msgid "File format not supported." msgstr "Formato de archivo no soportado." msgid "File path" msgstr "" +msgid "File shared successfully!" +msgstr "" + msgid "File size" msgstr "Tamaño del archivo" @@ -329,6 +326,9 @@ msgstr "Info" msgid "I’m done saving my backup secret phrase" msgstr "" +msgid "Keep original file" +msgstr "" + msgid "Language" msgstr "Idioma" @@ -368,6 +368,9 @@ msgstr "" msgid "Move" msgstr "Moverse" +msgid "Move over" +msgstr "" + msgid "Move selected" msgstr "Mover seleccionado" @@ -581,6 +584,12 @@ msgstr "" msgid "Settings" msgstr "Ajustes" +msgid "Share" +msgstr "" + +msgid "Share file" +msgstr "" + msgid "Shared" msgstr "" diff --git a/packages/files-ui/src/locales/fr/messages.po b/packages/files-ui/src/locales/fr/messages.po index 97a7a4b941..b79ae24995 100644 --- a/packages/files-ui/src/locales/fr/messages.po +++ b/packages/files-ui/src/locales/fr/messages.po @@ -131,9 +131,6 @@ msgstr "Copier les infos" msgid "Copy over" msgstr "Copier sur" -msgid "Copy to shared folder" -msgstr "Copier dans le dossier partagé" - msgid "Create" msgstr "Créer" @@ -245,15 +242,15 @@ msgstr "Fichier" msgid "File Info" msgstr "Infos du fichier" -msgid "File added successfully!" -msgstr "Fichier ajouté avec succès !" - msgid "File format not supported." msgstr "Format de fichier non pris en charge." msgid "File path" msgstr "Chemin du fichier" +msgid "File shared successfully!" +msgstr "" + msgid "File size" msgstr "Taille" @@ -329,6 +326,9 @@ msgstr "Infos" msgid "I’m done saving my backup secret phrase" msgstr "Phrase de sauvegarde secrète enregistrée" +msgid "Keep original file" +msgstr "" + msgid "Language" msgstr "Langue" @@ -368,6 +368,9 @@ msgstr "Gérer l’accès" msgid "Move" msgstr "Déplacer" +msgid "Move over" +msgstr "" + msgid "Move selected" msgstr "Déplacer la sélection" @@ -581,6 +584,12 @@ msgstr "Définition du nom d’utilisateur" msgid "Settings" msgstr "Paramètres" +msgid "Share" +msgstr "" + +msgid "Share file" +msgstr "" + msgid "Shared" msgstr "Partagé" diff --git a/packages/files-ui/src/locales/no/messages.po b/packages/files-ui/src/locales/no/messages.po index edde230a24..a26f15686d 100644 --- a/packages/files-ui/src/locales/no/messages.po +++ b/packages/files-ui/src/locales/no/messages.po @@ -130,9 +130,6 @@ msgstr "" msgid "Copy over" msgstr "" -msgid "Copy to shared folder" -msgstr "" - msgid "Create" msgstr "Opprett" @@ -241,15 +238,15 @@ msgstr "Fil" msgid "File Info" msgstr "Filinfo" -msgid "File added successfully!" -msgstr "" - msgid "File format not supported." msgstr "" msgid "File path" msgstr "" +msgid "File shared successfully!" +msgstr "" + msgid "File size" msgstr "Filstørrelse" @@ -325,6 +322,9 @@ msgstr "Info" msgid "I’m done saving my backup secret phrase" msgstr "" +msgid "Keep original file" +msgstr "" + msgid "Language" msgstr "Språk" @@ -364,6 +364,9 @@ msgstr "" msgid "Move" msgstr "Flytt" +msgid "Move over" +msgstr "" + msgid "Move selected" msgstr "Flytt valgte" @@ -577,6 +580,12 @@ msgstr "" msgid "Settings" msgstr "Innstillinger" +msgid "Share" +msgstr "" + +msgid "Share file" +msgstr "" + msgid "Shared" msgstr "Delt"