From 0c985a431b99795c9145512de11e8b44da3749ee Mon Sep 17 00:00:00 2001 From: Qing Date: Fri, 29 Dec 2023 10:08:21 +0800 Subject: [PATCH] fix build error --- web_app/package-lock.json | 2 +- web_app/package.json | 2 +- web_app/src/App.tsx | 8 +- web_app/src/components/Coffee.tsx | 9 +- web_app/src/components/Cropper.tsx | 2 +- web_app/src/components/Editor.tsx | 2 +- web_app/src/components/Extender.tsx | 2 +- web_app/src/components/Header.tsx | 2 +- web_app/src/components/InteractiveSeg.tsx | 5 - web_app/src/components/Settings.tsx | 132 ++++++++++------------ web_app/src/components/Shortcuts.tsx | 4 - web_app/src/components/ui/input.tsx | 5 +- 12 files changed, 72 insertions(+), 103 deletions(-) diff --git a/web_app/package-lock.json b/web_app/package-lock.json index c553fb7..f792bdd 100644 --- a/web_app/package-lock.json +++ b/web_app/package-lock.json @@ -57,7 +57,7 @@ "devDependencies": { "@tanstack/eslint-plugin-query": "^5.8.4", "@types/axios": "^0.14.0", - "@types/flexsearch": "^0.7.3", + "@types/flexsearch": "^0.7.6", "@types/lodash": "^4.14.201", "@types/node": "^20.9.2", "@types/react": "^18.2.37", diff --git a/web_app/package.json b/web_app/package.json index 0ba3ac3..acecaf8 100644 --- a/web_app/package.json +++ b/web_app/package.json @@ -59,7 +59,7 @@ "devDependencies": { "@tanstack/eslint-plugin-query": "^5.8.4", "@types/axios": "^0.14.0", - "@types/flexsearch": "^0.7.3", + "@types/flexsearch": "^0.7.6", "@types/lodash": "^4.14.201", "@types/node": "^20.9.2", "@types/react": "^18.2.37", diff --git a/web_app/src/App.tsx b/web_app/src/App.tsx index c591a5c..e1560f2 100644 --- a/web_app/src/App.tsx +++ b/web_app/src/App.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from "react" +import { useCallback, useEffect, useMemo, useRef } from "react" import { nanoid } from "nanoid" import useInputImage from "@/hooks/useInputImage" @@ -56,7 +56,6 @@ function Home() { return nanoid() }, [file]) - const [isDragging, setIsDragging] = useState(false) const dragCounter = useRef(0) const handleDrag = useCallback((event: any) => { @@ -68,9 +67,6 @@ function Home() { event.preventDefault() event.stopPropagation() dragCounter.current += 1 - if (event.dataTransfer.items && event.dataTransfer.items.length > 0) { - setIsDragging(true) - } }, []) const handleDragOut = useCallback((event: any) => { @@ -78,13 +74,11 @@ function Home() { event.stopPropagation() dragCounter.current -= 1 if (dragCounter.current > 0) return - setIsDragging(false) }, []) const handleDrop = useCallback((event: any) => { event.preventDefault() event.stopPropagation() - setIsDragging(false) if (event.dataTransfer.files && event.dataTransfer.files.length > 0) { if (event.dataTransfer.files.length > 1) { // setToastState({ diff --git a/web_app/src/components/Coffee.tsx b/web_app/src/components/Coffee.tsx index 16b110d..c674f54 100644 --- a/web_app/src/components/Coffee.tsx +++ b/web_app/src/components/Coffee.tsx @@ -1,12 +1,5 @@ import { Coffee as CoffeeIcon } from "lucide-react" -import { - Dialog, - DialogContent, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "./ui/dialog" +import { Dialog, DialogContent, DialogTitle, DialogTrigger } from "./ui/dialog" import { IconButton } from "./ui/button" import { DialogDescription } from "@radix-ui/react-dialog" import Kofi from "@/assets/kofi_button_black.png" diff --git a/web_app/src/components/Cropper.tsx b/web_app/src/components/Cropper.tsx index 2d4554b..b80c81b 100644 --- a/web_app/src/components/Cropper.tsx +++ b/web_app/src/components/Cropper.tsx @@ -214,7 +214,7 @@ const Cropper = (props: Props) => { } } - const onPointerDone = (e: PointerEvent) => { + const onPointerDone = () => { if (isResizing) { setIsResizing(false) } diff --git a/web_app/src/components/Editor.tsx b/web_app/src/components/Editor.tsx index 225d0f0..76205c9 100644 --- a/web_app/src/components/Editor.tsx +++ b/web_app/src/components/Editor.tsx @@ -703,7 +703,7 @@ export default function Editor(props: EditorProps) { doubleClick={{ disabled: true }} initialScale={minScale} minScale={minScale * 0.3} - onPanning={(ref) => { + onPanning={() => { if (!panned) { setPanned(true) } diff --git a/web_app/src/components/Extender.tsx b/web_app/src/components/Extender.tsx index dacb85e..a2d5cf9 100644 --- a/web_app/src/components/Extender.tsx +++ b/web_app/src/components/Extender.tsx @@ -209,7 +209,7 @@ const Extender = (props: Props) => { } } - const onPointerDone = (e: PointerEvent) => { + const onPointerDone = () => { if (isResizing) { setIsResizing(false) } diff --git a/web_app/src/components/Header.tsx b/web_app/src/components/Header.tsx index bee1482..1b4ae5a 100644 --- a/web_app/src/components/Header.tsx +++ b/web_app/src/components/Header.tsx @@ -1,5 +1,5 @@ import { PlayIcon } from "@radix-ui/react-icons" -import { useCallback, useState } from "react" +import { useState } from "react" import { IconButton, ImageUploadButton } from "@/components/ui/button" import Shortcuts from "@/components/Shortcuts" import { useImage } from "@/hooks/useImage" diff --git a/web_app/src/components/InteractiveSeg.tsx b/web_app/src/components/InteractiveSeg.tsx index 9a140aa..d540708 100644 --- a/web_app/src/components/InteractiveSeg.tsx +++ b/web_app/src/components/InteractiveSeg.tsx @@ -119,11 +119,6 @@ const InteractiveSegPoints = () => { } const InteractiveSeg = () => { - const [interactiveSegState, updateInteractiveSegState] = useStore((state) => [ - state.interactiveSegState, - state.updateInteractiveSegState, - ]) - return (
diff --git a/web_app/src/components/Settings.tsx b/web_app/src/components/Settings.tsx index d76d619..8422da0 100644 --- a/web_app/src/components/Settings.tsx +++ b/web_app/src/components/Settings.tsx @@ -14,9 +14,7 @@ import { FormField, FormItem, FormLabel, - FormMessage, } from "@/components/ui/form" -import { Input } from "@/components/ui/input" import { Switch } from "./ui/switch" import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs" import { useEffect, useState } from "react" @@ -44,14 +42,8 @@ import useHotKey from "@/hooks/useHotkey" const formSchema = z.object({ enableFileManager: z.boolean(), - inputDirectory: z.string().refine(async (id) => { - // verify that ID exists in database - return true - }), - outputDirectory: z.string().refine(async (id) => { - // verify that ID exists in database - return true - }), + inputDirectory: z.string(), + outputDirectory: z.string(), enableDownloadMask: z.boolean(), enableManualInpainting: z.boolean(), enableUploadMask: z.boolean(), @@ -59,7 +51,7 @@ const formSchema = z.object({ const TAB_GENERAL = "General" const TAB_MODEL = "Model" -const TAB_FILE_MANAGER = "File Manager" +// const TAB_FILE_MANAGER = "File Manager" const TAB_NAMES = [TAB_MODEL, TAB_GENERAL] @@ -341,68 +333,68 @@ export function SettingsDialog() { ) } - function renderFileManagerSettings() { - return ( -
- ( - -
- Enable file manger - - Browser images - -
- - - -
- )} - /> + // function renderFileManagerSettings() { + // return ( + //
+ // ( + // + //
+ // Enable file manger + // + // Browser images + // + //
+ // + // + // + //
+ // )} + // /> - + // - ( - - Input directory - - - - - Browser images from this directory. - - - - )} - /> + // ( + // + // Input directory + // + // + // + // + // Browser images from this directory. + // + // + // + // )} + // /> - ( - - Save directory - - - - - Result images will be saved to this directory. - - - - )} - /> -
- ) - } + // ( + // + // Save directory + // + // + // + // + // Result images will be saved to this directory. + // + // + // + // )} + // /> + //
+ // ) + // } return ( <> diff --git a/web_app/src/components/Shortcuts.tsx b/web_app/src/components/Shortcuts.tsx index 85be539..aac9f78 100644 --- a/web_app/src/components/Shortcuts.tsx +++ b/web_app/src/components/Shortcuts.tsx @@ -37,10 +37,6 @@ const isMac = function () { return /macintosh|mac os x/i.test(navigator.userAgent) } -const isWindows = function () { - return /windows|win32/i.test(navigator.userAgent) -} - const CmdOrCtrl = () => { return isMac() ? "Cmd" : "Ctrl" } diff --git a/web_app/src/components/ui/input.tsx b/web_app/src/components/ui/input.tsx index c88093c..c799aed 100644 --- a/web_app/src/components/ui/input.tsx +++ b/web_app/src/components/ui/input.tsx @@ -1,5 +1,4 @@ import * as React from "react" -import { FocusEvent } from "react" import { cn } from "@/lib/utils" import { useStore } from "@/lib/states" @@ -11,11 +10,11 @@ const Input = React.forwardRef( ({ className, type, ...props }, ref) => { const updateAppState = useStore((state) => state.updateAppState) - const handleOnFocus = (evt: FocusEvent) => { + const handleOnFocus = () => { updateAppState({ disableShortCuts: true }) } - const handleOnBlur = (evt: FocusEvent) => { + const handleOnBlur = () => { updateAppState({ disableShortCuts: false }) } return (