diff --git a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx index 6a62e494e86..432df774d45 100644 --- a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx +++ b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx @@ -42,14 +42,15 @@ import { Typography, } from "@mui/material"; import { t } from "i18next"; -import type { Dispatch, MutableRefObject, Ref, SetStateAction } from "react"; -import { +import React, { forwardRef, Fragment, useContext, useEffect, useRef, useState, + type MutableRefObject, + type Ref, } from "react"; import { getLocalCollections } from "services/collectionService"; import uploadManager from "services/upload/uploadManager"; @@ -792,10 +793,10 @@ const canvasToFile = async ( interface CommonMenuProps { canvasRef: MutableRefObject; originalSizeCanvasRef: MutableRefObject; - setTransformationPerformed: Dispatch>; - setCanvasLoading: Dispatch>; + setTransformationPerformed: (v: boolean) => void; canvasLoading: boolean; - setCurrentTab: Dispatch>; + setCanvasLoading: (v: boolean) => void; + setCurrentTab: (tab: OperationTab) => void; } type CropMenuProps = CommonMenuProps & { @@ -923,11 +924,14 @@ const getCropRegionArgs = ( interface FreehandCropRegionProps { cropBox: CropBoxProps; - setIsDragging: Dispatch>; + setIsDragging: (v: boolean) => void; } const FreehandCropRegion = forwardRef( - (props: FreehandCropRegionProps, ref: Ref) => { + ( + { cropBox, setIsDragging }: FreehandCropRegionProps, + ref: Ref, + ) => { return ( <> {/* Top overlay */} @@ -937,7 +941,7 @@ const FreehandCropRegion = forwardRef( top: 0, left: 0, right: 0, - height: props.cropBox.y + "px", // height up to the top of the crop box + height: cropBox.y + "px", // height up to the top of the crop box backgroundColor: "rgba(0,0,0,0.5)", pointerEvents: "none", }} @@ -950,9 +954,7 @@ const FreehandCropRegion = forwardRef( bottom: 0, left: 0, right: 0, - height: `calc(100% - ${ - props.cropBox.y + props.cropBox.height - }px)`, // height from the bottom of the crop box to the bottom of the canvas + height: `calc(100% - ${cropBox.y + cropBox.height}px)`, // height from the bottom of the crop box to the bottom of the canvas backgroundColor: "rgba(0,0,0,0.5)", pointerEvents: "none", }} @@ -962,10 +964,10 @@ const FreehandCropRegion = forwardRef(
{ e.preventDefault(); - props.setIsDragging(true); + setIsDragging(true); }} >
@@ -1341,11 +1341,11 @@ interface ColoursMenuProps { saturation: number; blur: number; invert: boolean; - setBrightness: Dispatch>; - setContrast: Dispatch>; - setSaturation: Dispatch>; - setBlur: Dispatch>; - setInvert: Dispatch>; + setBrightness: (v: number) => void; + setContrast: (v: number) => void; + setSaturation: (v: number) => void; + setBlur: (v: number) => void; + setInvert: (v: boolean) => void; } const ColoursMenu: React.FC = (props) => (