Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fin

Manav Rathi31478004861a
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index efa75b1332..2f691ddef7 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -187,10 +187,10 @@ const Page: React.FC = () => {
useState<CollectionNamerAttributes>(null);
const [collectionNamerView, setCollectionNamerView] = useState(false);
const [shouldDisableDropzone, setShouldDisableDropzone] = useState(false);
- const [isPhotoSwipeOpen, setIsPhotoSwipeOpen] = useState(false);
const [dragAndDropFiles, setDragAndDropFiles] = useState<FileWithPath[]>(
[],
);
+ const [isPhotoSwipeOpen, setIsPhotoSwipeOpen] = useState(false);
const syncInProgress = useRef(false);
const syncInterval = useRef<ReturnType<typeof setInterval> | undefined>(
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 8e22b6af49..1e52800a82 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -27,7 +27,7 @@ import { downloadManager } from "@/gallery/services/download";
import { extractCollectionKeyFromShareURL } from "@/gallery/services/share";
import { updateShouldDisableCFUploadProxy } from "@/gallery/services/upload";
import type { Collection } from "@/media/collection";
-import { type EnteFile, mergeMetadata } from "@/media/file";
+import { mergeMetadata, type EnteFile } from "@/media/file";
import { verifyPublicAlbumPassword } from "@/new/albums/services/publicCollection";
import {
GalleryItemsHeaderAdapter,
@@ -57,11 +57,11 @@ import {
} from "components/FilesDownloadProgress";
import PhotoFrame from "components/PhotoFrame";
import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";
-import {Upload} from "components/Upload";
+import { Upload } from "components/Upload";
import { t } from "i18next";
import { useRouter } from "next/router";
import { useEffect, useMemo, useRef, useState } from "react";
-import { useDropzone } from "react-dropzone";
+import { type FileWithPath } from "react-dropzone";
import {
getLocalPublicCollection,
getLocalPublicCollectionPassword,
@@ -108,6 +108,9 @@ export default function PublicCollectionGallery() {
const [uploadTypeSelectorView, setUploadTypeSelectorView] = useState(false);
const [blockingLoad, setBlockingLoad] = useState(false);
const [shouldDisableDropzone, setShouldDisableDropzone] = useState(false);
+ const [dragAndDropFiles, setDragAndDropFiles] = useState<FileWithPath[]>(
+ [],
+ );
const [selected, setSelected] = useState<SelectedState>({
ownCount: 0,
count: 0,
@@ -115,16 +118,6 @@ export default function PublicCollectionGallery() {
context: undefined,
});
- const {
- getRootProps: getDragAndDropRootProps,
- getInputProps: getDragAndDropInputProps,
- acceptedFiles: dragAndDropFilesReadOnly,
- } = useDropzone({
- noClick: true,
- noKeyboard: true,
- disabled: shouldDisableDropzone,
- });
-
const [
filesDownloadProgressAttributesList,
setFilesDownloadProgressAttributesList,
@@ -163,12 +156,6 @@ export default function PublicCollectionGallery() {
return updater;
};
- // Create a regular array from the readonly array returned by dropzone.
- const dragAndDropFiles = useMemo(
- () => [...dragAndDropFilesReadOnly],
- [dragAndDropFilesReadOnly],
- );
-
const onAddPhotos = useMemo(() => {
return publicCollection?.publicURLs?.[0]?.enableCollect
? () => setUploadTypeSelectorView(true)
@@ -491,8 +478,8 @@ export default function PublicCollectionGallery() {
return (
<PublicCollectionGalleryContext.Provider value={context}>
<FullScreenDropZone
- getInputProps={getDragAndDropInputProps}
- getRootProps={getDragAndDropRootProps}
+ disabled={shouldDisableDropzone}
+ onDrop={setDragAndDropFiles}
>
<NavbarBase
sx={{
diff --git a/web/packages/gallery/components/FullScreenDropZone.tsx b/web/packages/gallery/components/FullScreenDropZone.tsx
index c7c5610a93..e817e2f034 100644
--- a/web/packages/gallery/components/FullScreenDropZone.tsx
+++ b/web/packages/gallery/components/FullScreenDropZone.tsx
@@ -1,3 +1,4 @@
+import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import CloseIcon from "@mui/icons-material/Close";
import { IconButton, Stack, styled, Typography } from "@mui/material";
import { t } from "i18next";
@@ -64,12 +65,15 @@ export const FullScreenDropZone: React.FC<
const [isDropPending, setIsDropPending] = useState(false);
const handleDragEnter = useCallback(() => {
- setIsDropPending(true);
setIsDragActive(true);
}, []);
+ const handleOverlayDrop = useCallback(() => {
+ setIsDropPending(true);
+ setIsDragActive(false);
+ }, []);
+
const handleDragLeave = useCallback(() => {
- setIsDropPending(false);
setIsDragActive(false);
}, []);
@@ -91,16 +95,21 @@ export const FullScreenDropZone: React.FC<
>
{(isDragActive || isDropPending) && (
<DropZoneOverlay
- onDrop={handleDragLeave}
+ onDrop={handleOverlayDrop}
onDragLeave={handleDragLeave}
>
- <CloseButton onClick={handleDragLeave}>
+ <CloseButton
+ disabled={isDropPending}
+ onClick={handleDragLeave}
+ >
<CloseIcon />
</CloseButton>
<Typography variant="h3">
- {isDropPending
- ? "Processing..."
- : (message ?? t("upload_dropzone_hint"))}
+ {isDropPending ? (
+ <ActivityIndicator />
+ ) : (
+ (message ?? t("upload_dropzone_hint"))
+ )}
</Typography>
</DropZoneOverlay>
)}
@@ -125,6 +134,7 @@ const DropZoneOverlay = styled(Stack)(
border-style: solid;
border-color: ${theme.vars.palette.accent.light};
background-color: ${theme.vars.palette.backdrop.base};
+ backdrop-filter: blur(10px);
z-index: 2000; /* aboveFileViewerContentZ + delta */
`,
);