mirror of
https://github.com/ClipFusion-org/clipfusion.git
synced 2025-08-03 14:45:09 +00:00
eslint is not arguing anymore
This commit is contained in:
parent
e33d04609d
commit
1d34bbf461
@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React, { createContext, Dispatch, forwardRef, ReactNode, SetStateAction, useContext, useId, useState } from "react";
|
||||
import React, { createContext, Dispatch, ReactNode, SetStateAction, useContext, useState } from "react";
|
||||
import { useLiveQuery } from "dexie-react-hooks";
|
||||
import { addProject, db, deleteProject } from "@/lib/db";
|
||||
import { Label } from "@/components/ui/label";
|
||||
@ -108,8 +108,30 @@ const ProjectInfoFormSchema = z.object({
|
||||
|
||||
type ProjectInfoForm = z.infer<typeof ProjectInfoFormSchema>;
|
||||
|
||||
const ProjectInfoFormFields = ({ form }: { form: UseFormReturn<ProjectInfoForm> }) => (
|
||||
<>
|
||||
<FormField control={form.control} name="title" render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Title</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)} />
|
||||
<FormField control={form.control} name="description" render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Description</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} autoComplete="off" placeholder="Tell something about your project" className="resize-y" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)} />
|
||||
</>
|
||||
);
|
||||
|
||||
const RenameProjectDialog = ({ project }: { project: Project }) => {
|
||||
const formId = useId();
|
||||
const renameForm = useForm<ProjectInfoForm>({
|
||||
resolver: zodResolver(ProjectInfoFormSchema),
|
||||
defaultValues: {
|
||||
@ -137,25 +159,8 @@ const RenameProjectDialog = ({ project }: { project: Project }) => {
|
||||
<DialogDescription>Change information of your project.</DialogDescription>
|
||||
</DialogHeader>
|
||||
<Form {...renameForm}>
|
||||
<form id={formId} onSubmit={renameForm.handleSubmit(handleRenameSubmit)} className="grid gap-3">
|
||||
<FormField control={renameForm.control} name="title" render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Title</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)} />
|
||||
<FormField control={renameForm.control} name="description" render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Description</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} autoComplete="off" placeholder="Tell something about your project" className="resize-y" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)} />
|
||||
<form onSubmit={renameForm.handleSubmit(handleRenameSubmit)} className="grid gap-3">
|
||||
<ProjectInfoFormFields form={renameForm}/>
|
||||
<DialogFooter>
|
||||
<DialogClose asChild>
|
||||
<Button type="button" variant="outline">Cancel</Button>
|
||||
@ -163,7 +168,7 @@ const RenameProjectDialog = ({ project }: { project: Project }) => {
|
||||
<DialogClose onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
if (renameForm.formState.errors.title) e.preventDefault();
|
||||
}} asChild>
|
||||
<Button type="submit" form={formId}>Rename</Button>
|
||||
<Button type="submit" >Rename</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
@ -407,7 +412,7 @@ const ProjectContainer = ({
|
||||
|
||||
const date = new Date(project.editDate);
|
||||
|
||||
const handleCheck = (e: React.MouseEvent<HTMLDivElement | HTMLAnchorElement>) => {
|
||||
const handleCheck = () => {
|
||||
const index = selectedProjects.indexOf(project.uuid);
|
||||
if (index >= 0) {
|
||||
selectedProjects.splice(index, 1);
|
||||
@ -541,24 +546,7 @@ export default function Home(): ReactNode {
|
||||
</DialogHeader>
|
||||
<Form {...newProjectForm}>
|
||||
<form onSubmit={newProjectForm.handleSubmit(newProjectSubmit)} className="grid gap-3">
|
||||
<FormField control={newProjectForm.control} name="title" render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Title</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)} />
|
||||
<FormField control={newProjectForm.control} name="description" render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Description</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field} autoComplete="off" placeholder="Tell something about your project" className="resize-y" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)} />
|
||||
<ProjectInfoFormFields form={newProjectForm} />
|
||||
<DialogFooter>
|
||||
<DialogClose asChild>
|
||||
<Button type="button" variant="outline">Cancel</Button>
|
||||
|
@ -9,12 +9,9 @@ import StaticSidebarTrigger from "@/components/static-sidebar-trigger";
|
||||
import StickyTopContainer from "@/components/sticky-top-container";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { useSidebar } from "@/components/ui/sidebar";
|
||||
import WideContainer from "@/components/wide-container";
|
||||
import { useIsMobile } from "@/hooks/use-mobile";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ArrowLeftIcon } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ReactNode, useEffect, useState } from "react";
|
||||
|
||||
function PersistentStorageControl({
|
||||
|
@ -1,35 +1,6 @@
|
||||
import type { Metadata, Viewport } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import { ReactNode } from "react";
|
||||
import "@/app/globals.css";
|
||||
import ThemeProvider from "@/app/theme-provider";
|
||||
import Analytics from "@/app/analytics";
|
||||
import PersistenceProvider from "@/app/persistence-provider";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
import PWAHead from "@/app/pwa-head";
|
||||
|
||||
const geist = Geist({
|
||||
variable: "--font-geist",
|
||||
subsets: ["latin"]
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"]
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "ClipFusion",
|
||||
description: "Desktop power right in your browser",
|
||||
};
|
||||
|
||||
export const viewport: Viewport = {
|
||||
width: 'device-width',
|
||||
initialScale: 1,
|
||||
maximumScale: 1,
|
||||
userScalable: false,
|
||||
viewportFit: "cover"
|
||||
};
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
|
@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
import { ReactNode, useEffect, useRef } from "react";
|
||||
import { SidebarTrigger } from "../ui/sidebar";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useIsMobile } from "@/hooks/use-mobile";
|
||||
import { Button } from "../ui/button";
|
||||
import { ArrowLeftIcon } from "lucide-react";
|
||||
@ -10,10 +9,6 @@ const easeSlide = (x: number) => (
|
||||
1 - Math.pow(1 - x, 3)
|
||||
);
|
||||
|
||||
const lerp = (a: number, b: number, t: number) => (
|
||||
a * t + b * (1 - t)
|
||||
);
|
||||
|
||||
export const StaticBackButton = () => {
|
||||
const isMobile = useIsMobile();
|
||||
const router = useRouter();
|
||||
|
@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { ReactNode, useEffect, useRef } from "react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { SidebarTrigger } from "../ui/sidebar";
|
||||
import { useIsMobile } from "@/hooks/use-mobile";
|
||||
|
||||
@ -7,10 +7,6 @@ const easeSlide = (x: number) => (
|
||||
1 - Math.pow(1 - x, 3)
|
||||
);
|
||||
|
||||
const lerp = (a: number, b: number, t: number) => (
|
||||
a * t + b * (1 - t)
|
||||
);
|
||||
|
||||
export const StaticSidebarTrigger = () => {
|
||||
const isMobile = useIsMobile();
|
||||
const adjustHeight = isMobile ? -1 : 1;
|
||||
|
@ -3,8 +3,8 @@ import React, { createContext, Dispatch, ReactNode, SetStateAction, useCallback,
|
||||
import "./styles.css";
|
||||
|
||||
export interface Props {
|
||||
onDelete: Function;
|
||||
onDeleteConfirm?: Function;
|
||||
onDelete: () => void;
|
||||
onDeleteConfirm?: (onSuccess: () => void, onCancel: () => void) => void;
|
||||
deleteComponent?: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
height?: number;
|
||||
@ -20,6 +20,7 @@ export interface Props {
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const cursorPosition = (event: any) => {
|
||||
if (event?.touches?.[0]?.clientX) return event.touches[0].clientX;
|
||||
if (event?.clientX) return event?.clientX;
|
||||
@ -46,9 +47,9 @@ export const SwipeToDeleteContextProvider = ({
|
||||
children: ReactNode
|
||||
}) => {
|
||||
const [deleting, setDeleting] = useState(false);
|
||||
|
||||
|
||||
return (
|
||||
<SwipeToDeleteContext.Provider value={{deleting: deleting, setDeleting: setDeleting}}>
|
||||
<SwipeToDeleteContext.Provider value={{ deleting: deleting, setDeleting: setDeleting }}>
|
||||
{children}
|
||||
</SwipeToDeleteContext.Provider>
|
||||
);
|
||||
@ -126,14 +127,18 @@ export const SwipeToDelete = ({
|
||||
[rtl, touching, deleting, setDeleting]
|
||||
);
|
||||
|
||||
|
||||
const onMouseMove = useCallback(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function (event: MouseEvent): any {
|
||||
onMove(event);
|
||||
},
|
||||
[onMove]
|
||||
);
|
||||
|
||||
|
||||
const onTouchMove = useCallback(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function (event: TouchEvent): any {
|
||||
onMove(event);
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user