update Uploader component to support public link upload

This commit is contained in:
Abhinav 2022-11-29 23:59:02 +05:30
parent a22e486d4e
commit 35e8cc4366
2 changed files with 26 additions and 12 deletions

View file

@ -7,13 +7,22 @@ import { UploadTypeOption } from './option';
import DialogTitleWithCloseButton from 'components/DialogBox/TitleWithCloseButton';
import { Box, Dialog, Stack, Typography } from '@mui/material';
interface Iprops {
onHide: () => void;
show: boolean;
uploadFiles: () => void;
uploadFolders: () => void;
uploadGoogleTakeoutZips: () => void;
hideZipUploadOption?: boolean;
}
export default function UploadTypeSelector({
onHide,
show,
uploadFiles,
uploadFolders,
uploadGoogleTakeoutZips,
}) {
hideZipUploadOption,
}: Iprops) {
return (
<Dialog
open={show}
@ -40,11 +49,13 @@ export default function UploadTypeSelector({
startIcon={<FolderUploadIcon />}>
{constants.UPLOAD_DIRS}
</UploadTypeOption>
<UploadTypeOption
onClick={uploadGoogleTakeoutZips}
startIcon={<GoogleIcon />}>
{constants.UPLOAD_GOOGLE_TAKEOUT}
</UploadTypeOption>
{!hideZipUploadOption && (
<UploadTypeOption
onClick={uploadGoogleTakeoutZips}
startIcon={<GoogleIcon />}>
{constants.UPLOAD_GOOGLE_TAKEOUT}
</UploadTypeOption>
)}
</Stack>
<Typography p={1.5} pt={4} color="text.secondary">
{constants.DRAG_AND_DROP_HINT}

View file

@ -55,16 +55,16 @@ const FIRST_ALBUM_NAME = 'My First Album';
interface Props {
syncWithRemote: (force?: boolean, silent?: boolean) => Promise<void>;
closeCollectionSelector: () => void;
closeCollectionSelector?: () => void;
closeUploadTypeSelector: () => void;
setCollectionSelectorAttributes: SetCollectionSelectorAttributes;
setCollectionNamerAttributes: SetCollectionNamerAttributes;
setCollectionSelectorAttributes?: SetCollectionSelectorAttributes;
setCollectionNamerAttributes?: SetCollectionNamerAttributes;
setLoading: SetLoading;
setShouldDisableDropzone: (value: boolean) => void;
showCollectionSelector: () => void;
showCollectionSelector?: () => void;
setFiles: SetFiles;
setCollections: SetCollections;
isFirstUpload: boolean;
setCollections?: SetCollections;
isFirstUpload?: boolean;
uploadTypeSelectorView: boolean;
showSessionExpiredMessage: () => void;
showUploadFilesDialog: () => void;
@ -72,6 +72,8 @@ interface Props {
webFolderSelectorFiles: File[];
webFileSelectorFiles: File[];
dragAndDropFiles: File[];
zipUploadDisabled?: boolean;
collection?: Collection;
}
export default function Uploader(props: Props) {
@ -599,6 +601,7 @@ export default function Uploader(props: Props) {
uploadFiles={handleFileUpload}
uploadFolders={handleFolderUpload}
uploadGoogleTakeoutZips={handleZipUpload}
hideZipUploadOption={props.zipUploadDisabled}
/>
<UploadProgress
open={uploadProgressView}