This commit is contained in:
Manav Rathi
2025-02-20 11:05:57 +05:30
parent 5eba06a269
commit ca28a3c595
3 changed files with 14 additions and 11 deletions

View File

@@ -861,15 +861,14 @@ const Page: React.FC = () => {
}}
>
<FullScreenDropZone
{...{ getDragAndDropRootProps }}
getInputProps={getDragAndDropInputProps}
getRootProps={getDragAndDropRootProps}
message={
watchFolderView
? t("watch_folder_dropzone_hint")
: undefined
}
>
<input {...getDragAndDropInputProps()} />
{blockingLoad && <TranslucentLoadingOverlay />}
<PlanSelector
{...planSelectorVisibilityProps}

View File

@@ -490,8 +490,10 @@ export default function PublicCollectionGallery() {
return (
<PublicCollectionGalleryContext.Provider value={context}>
<FullScreenDropZone {...{ getDragAndDropRootProps }}>
<input {...getDragAndDropInputProps()} />
<FullScreenDropZone
getInputProps={getDragAndDropInputProps}
getRootProps={getDragAndDropRootProps}
>
<NavbarBase
sx={{
mb: "16px",

View File

@@ -5,10 +5,14 @@ import React, { useCallback, useEffect, useState } from "react";
import type { DropzoneState } from "react-dropzone";
interface FullScreenDropZoneProps {
/**
* The `getInputProps` function returned by a call to {@link useDropzone}.
*/
getInputProps: DropzoneState["getInputProps"];
/**
* The `getRootProps` function returned by a call to {@link useDropzone}.
*/
getDragAndDropRootProps: DropzoneState["getRootProps"];
getRootProps: DropzoneState["getRootProps"];
/**
* Optional override to the message show to the user when a drag is in
* progress.
@@ -33,7 +37,7 @@ interface FullScreenDropZoneProps {
*/
export const FullScreenDropZone: React.FC<
React.PropsWithChildren<FullScreenDropZoneProps>
> = ({ getDragAndDropRootProps, message, children }) => {
> = ({ getInputProps, getRootProps, message, children }) => {
const [isDragActive, setIsDragActive] = useState(false);
const onDragEnter = useCallback(() => setIsDragActive(true), []);
@@ -50,10 +54,8 @@ export const FullScreenDropZone: React.FC<
return (
<>
<Stack
sx={{ flex: 1 }}
{...getDragAndDropRootProps({ onDragEnter })}
>
<input {...getInputProps()} />
<Stack sx={{ flex: 1 }} {...getRootProps({ onDragEnter })}>
{isDragActive && (
<DropZoneOverlay
onDrop={onDragLeave}