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