fix build error

This commit is contained in:
Qing 2023-12-29 10:08:21 +08:00
parent 1169e66ccb
commit 0c985a431b
12 changed files with 72 additions and 103 deletions

View File

@ -57,7 +57,7 @@
"devDependencies": { "devDependencies": {
"@tanstack/eslint-plugin-query": "^5.8.4", "@tanstack/eslint-plugin-query": "^5.8.4",
"@types/axios": "^0.14.0", "@types/axios": "^0.14.0",
"@types/flexsearch": "^0.7.3", "@types/flexsearch": "^0.7.6",
"@types/lodash": "^4.14.201", "@types/lodash": "^4.14.201",
"@types/node": "^20.9.2", "@types/node": "^20.9.2",
"@types/react": "^18.2.37", "@types/react": "^18.2.37",

View File

@ -59,7 +59,7 @@
"devDependencies": { "devDependencies": {
"@tanstack/eslint-plugin-query": "^5.8.4", "@tanstack/eslint-plugin-query": "^5.8.4",
"@types/axios": "^0.14.0", "@types/axios": "^0.14.0",
"@types/flexsearch": "^0.7.3", "@types/flexsearch": "^0.7.6",
"@types/lodash": "^4.14.201", "@types/lodash": "^4.14.201",
"@types/node": "^20.9.2", "@types/node": "^20.9.2",
"@types/react": "^18.2.37", "@types/react": "^18.2.37",

View File

@ -1,4 +1,4 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react" import { useCallback, useEffect, useMemo, useRef } from "react"
import { nanoid } from "nanoid" import { nanoid } from "nanoid"
import useInputImage from "@/hooks/useInputImage" import useInputImage from "@/hooks/useInputImage"
@ -56,7 +56,6 @@ function Home() {
return nanoid() return nanoid()
}, [file]) }, [file])
const [isDragging, setIsDragging] = useState(false)
const dragCounter = useRef(0) const dragCounter = useRef(0)
const handleDrag = useCallback((event: any) => { const handleDrag = useCallback((event: any) => {
@ -68,9 +67,6 @@ function Home() {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
dragCounter.current += 1 dragCounter.current += 1
if (event.dataTransfer.items && event.dataTransfer.items.length > 0) {
setIsDragging(true)
}
}, []) }, [])
const handleDragOut = useCallback((event: any) => { const handleDragOut = useCallback((event: any) => {
@ -78,13 +74,11 @@ function Home() {
event.stopPropagation() event.stopPropagation()
dragCounter.current -= 1 dragCounter.current -= 1
if (dragCounter.current > 0) return if (dragCounter.current > 0) return
setIsDragging(false)
}, []) }, [])
const handleDrop = useCallback((event: any) => { const handleDrop = useCallback((event: any) => {
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
setIsDragging(false)
if (event.dataTransfer.files && event.dataTransfer.files.length > 0) { if (event.dataTransfer.files && event.dataTransfer.files.length > 0) {
if (event.dataTransfer.files.length > 1) { if (event.dataTransfer.files.length > 1) {
// setToastState({ // setToastState({

View File

@ -1,12 +1,5 @@
import { Coffee as CoffeeIcon } from "lucide-react" import { Coffee as CoffeeIcon } from "lucide-react"
import { import { Dialog, DialogContent, DialogTitle, DialogTrigger } from "./ui/dialog"
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "./ui/dialog"
import { IconButton } from "./ui/button" import { IconButton } from "./ui/button"
import { DialogDescription } from "@radix-ui/react-dialog" import { DialogDescription } from "@radix-ui/react-dialog"
import Kofi from "@/assets/kofi_button_black.png" import Kofi from "@/assets/kofi_button_black.png"

View File

@ -214,7 +214,7 @@ const Cropper = (props: Props) => {
} }
} }
const onPointerDone = (e: PointerEvent) => { const onPointerDone = () => {
if (isResizing) { if (isResizing) {
setIsResizing(false) setIsResizing(false)
} }

View File

@ -703,7 +703,7 @@ export default function Editor(props: EditorProps) {
doubleClick={{ disabled: true }} doubleClick={{ disabled: true }}
initialScale={minScale} initialScale={minScale}
minScale={minScale * 0.3} minScale={minScale * 0.3}
onPanning={(ref) => { onPanning={() => {
if (!panned) { if (!panned) {
setPanned(true) setPanned(true)
} }

View File

@ -209,7 +209,7 @@ const Extender = (props: Props) => {
} }
} }
const onPointerDone = (e: PointerEvent) => { const onPointerDone = () => {
if (isResizing) { if (isResizing) {
setIsResizing(false) setIsResizing(false)
} }

View File

@ -1,5 +1,5 @@
import { PlayIcon } from "@radix-ui/react-icons" import { PlayIcon } from "@radix-ui/react-icons"
import { useCallback, useState } from "react" import { useState } from "react"
import { IconButton, ImageUploadButton } from "@/components/ui/button" import { IconButton, ImageUploadButton } from "@/components/ui/button"
import Shortcuts from "@/components/Shortcuts" import Shortcuts from "@/components/Shortcuts"
import { useImage } from "@/hooks/useImage" import { useImage } from "@/hooks/useImage"

View File

@ -119,11 +119,6 @@ const InteractiveSegPoints = () => {
} }
const InteractiveSeg = () => { const InteractiveSeg = () => {
const [interactiveSegState, updateInteractiveSegState] = useStore((state) => [
state.interactiveSegState,
state.updateInteractiveSegState,
])
return ( return (
<div> <div>
<InteractiveSegConfirmActions /> <InteractiveSegConfirmActions />

View File

@ -14,9 +14,7 @@ import {
FormField, FormField,
FormItem, FormItem,
FormLabel, FormLabel,
FormMessage,
} from "@/components/ui/form" } from "@/components/ui/form"
import { Input } from "@/components/ui/input"
import { Switch } from "./ui/switch" import { Switch } from "./ui/switch"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs" import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs"
import { useEffect, useState } from "react" import { useEffect, useState } from "react"
@ -44,14 +42,8 @@ import useHotKey from "@/hooks/useHotkey"
const formSchema = z.object({ const formSchema = z.object({
enableFileManager: z.boolean(), enableFileManager: z.boolean(),
inputDirectory: z.string().refine(async (id) => { inputDirectory: z.string(),
// verify that ID exists in database outputDirectory: z.string(),
return true
}),
outputDirectory: z.string().refine(async (id) => {
// verify that ID exists in database
return true
}),
enableDownloadMask: z.boolean(), enableDownloadMask: z.boolean(),
enableManualInpainting: z.boolean(), enableManualInpainting: z.boolean(),
enableUploadMask: z.boolean(), enableUploadMask: z.boolean(),
@ -59,7 +51,7 @@ const formSchema = z.object({
const TAB_GENERAL = "General" const TAB_GENERAL = "General"
const TAB_MODEL = "Model" const TAB_MODEL = "Model"
const TAB_FILE_MANAGER = "File Manager" // const TAB_FILE_MANAGER = "File Manager"
const TAB_NAMES = [TAB_MODEL, TAB_GENERAL] const TAB_NAMES = [TAB_MODEL, TAB_GENERAL]
@ -341,68 +333,68 @@ export function SettingsDialog() {
) )
} }
function renderFileManagerSettings() { // function renderFileManagerSettings() {
return ( // return (
<div className="flex flex-col justify-between rounded-lg gap-4 w-[400px]"> // <div className="flex flex-col justify-between rounded-lg gap-4 w-[400px]">
<FormField // <FormField
control={form.control} // control={form.control}
name="enableFileManager" // name="enableFileManager"
render={({ field }) => ( // render={({ field }) => (
<FormItem className="flex items-center justify-between gap-4"> // <FormItem className="flex items-center justify-between gap-4">
<div className="space-y-0.5"> // <div className="space-y-0.5">
<FormLabel>Enable file manger</FormLabel> // <FormLabel>Enable file manger</FormLabel>
<FormDescription className="max-w-sm"> // <FormDescription className="max-w-sm">
Browser images // Browser images
</FormDescription> // </FormDescription>
</div> // </div>
<FormControl> // <FormControl>
<Switch // <Switch
checked={field.value} // checked={field.value}
onCheckedChange={field.onChange} // onCheckedChange={field.onChange}
/> // />
</FormControl> // </FormControl>
</FormItem> // </FormItem>
)} // )}
/> // />
<Separator /> // <Separator />
<FormField // <FormField
control={form.control} // control={form.control}
name="inputDirectory" // name="inputDirectory"
render={({ field }) => ( // render={({ field }) => (
<FormItem> // <FormItem>
<FormLabel>Input directory</FormLabel> // <FormLabel>Input directory</FormLabel>
<FormControl> // <FormControl>
<Input placeholder="" {...field} /> // <Input placeholder="" {...field} />
</FormControl> // </FormControl>
<FormDescription> // <FormDescription>
Browser images from this directory. // Browser images from this directory.
</FormDescription> // </FormDescription>
<FormMessage /> // <FormMessage />
</FormItem> // </FormItem>
)} // )}
/> // />
<FormField // <FormField
control={form.control} // control={form.control}
name="outputDirectory" // name="outputDirectory"
render={({ field }) => ( // render={({ field }) => (
<FormItem> // <FormItem>
<FormLabel>Save directory</FormLabel> // <FormLabel>Save directory</FormLabel>
<FormControl> // <FormControl>
<Input placeholder="" {...field} /> // <Input placeholder="" {...field} />
</FormControl> // </FormControl>
<FormDescription> // <FormDescription>
Result images will be saved to this directory. // Result images will be saved to this directory.
</FormDescription> // </FormDescription>
<FormMessage /> // <FormMessage />
</FormItem> // </FormItem>
)} // )}
/> // />
</div> // </div>
) // )
} // }
return ( return (
<> <>

View File

@ -37,10 +37,6 @@ const isMac = function () {
return /macintosh|mac os x/i.test(navigator.userAgent) return /macintosh|mac os x/i.test(navigator.userAgent)
} }
const isWindows = function () {
return /windows|win32/i.test(navigator.userAgent)
}
const CmdOrCtrl = () => { const CmdOrCtrl = () => {
return isMac() ? "Cmd" : "Ctrl" return isMac() ? "Cmd" : "Ctrl"
} }

View File

@ -1,5 +1,4 @@
import * as React from "react" import * as React from "react"
import { FocusEvent } from "react"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { useStore } from "@/lib/states" import { useStore } from "@/lib/states"
@ -11,11 +10,11 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
({ className, type, ...props }, ref) => { ({ className, type, ...props }, ref) => {
const updateAppState = useStore((state) => state.updateAppState) const updateAppState = useStore((state) => state.updateAppState)
const handleOnFocus = (evt: FocusEvent<any>) => { const handleOnFocus = () => {
updateAppState({ disableShortCuts: true }) updateAppState({ disableShortCuts: true })
} }
const handleOnBlur = (evt: FocusEvent<any>) => { const handleOnBlur = () => {
updateAppState({ disableShortCuts: false }) updateAppState({ disableShortCuts: false })
} }
return ( return (