mirror of
https://github.com/ClipFusion-org/clipfusion.git
synced 2025-08-03 16:55:08 +00:00
eslint: fixed warnings and disabled exhaustive-deps
rule
This commit is contained in:
parent
9d3f140844
commit
acda651d82
@ -11,6 +11,11 @@ const compat = new FlatCompat({
|
|||||||
|
|
||||||
const eslintConfig = [
|
const eslintConfig = [
|
||||||
...compat.extends("next/core-web-vitals", "next/typescript"),
|
...compat.extends("next/core-web-vitals", "next/typescript"),
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'react-hooks/exhaustive-deps': 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export default eslintConfig;
|
export default eslintConfig;
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "clipfusion-community",
|
"name": "clipfusion-editor",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "clipfusion-community",
|
"name": "clipfusion-editor",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hookform/resolvers": "^5.1.1",
|
"@hookform/resolvers": "^5.1.1",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "clipfusion-community",
|
"name": "clipfusion-editor",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Geist, Geist_Mono } from "next/font/google";
|
import { Geist, Geist_Mono } from "next/font/google";
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
import { ThemeProvider } from "next-themes";
|
|
||||||
import { SidebarProvider } from "@/components/ui/sidebar";
|
import { SidebarProvider } from "@/components/ui/sidebar";
|
||||||
import Dashboard from "@/components/dashboard";
|
import Dashboard from "@/components/dashboard";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import Providers from "./providers";
|
import ThemeProvider from "./theme-provider";
|
||||||
|
|
||||||
const geist = Geist({
|
const geist = Geist({
|
||||||
variable: "--font-geist",
|
variable: "--font-geist",
|
||||||
@ -32,14 +31,14 @@ export default function RootLayout({
|
|||||||
<html lang="en" suppressHydrationWarning>
|
<html lang="en" suppressHydrationWarning>
|
||||||
<head/>
|
<head/>
|
||||||
<body className={`${geist.variable} ${geistMono.variable} antialiased`}>
|
<body className={`${geist.variable} ${geistMono.variable} antialiased`}>
|
||||||
<Providers>
|
<ThemeProvider>
|
||||||
<SidebarProvider>
|
<SidebarProvider>
|
||||||
<Dashboard/>
|
<Dashboard/>
|
||||||
<main>
|
<main>
|
||||||
{children}
|
{children}
|
||||||
</main>
|
</main>
|
||||||
</SidebarProvider>
|
</SidebarProvider>
|
||||||
</Providers>
|
</ThemeProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
"use client";
|
|
||||||
import { ThemeProvider } from "next-themes";
|
|
||||||
import { ReactNode } from "react";
|
|
||||||
|
|
||||||
const Providers = ({
|
|
||||||
children
|
|
||||||
}: {
|
|
||||||
children: ReactNode
|
|
||||||
}): ReactNode => {
|
|
||||||
return (
|
|
||||||
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
|
|
||||||
{children}
|
|
||||||
</ThemeProvider>
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Providers;
|
|
13
src/app/theme-provider.tsx
Normal file
13
src/app/theme-provider.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
"use client";
|
||||||
|
import { ThemeProvider as NextThemeProvider } from "next-themes";
|
||||||
|
import { ComponentProps, ReactNode } from "react";
|
||||||
|
|
||||||
|
const ThemeProvider = (props: ComponentProps<typeof NextThemeProvider>): ReactNode => {
|
||||||
|
return (
|
||||||
|
<ThemeProvider {...props} attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
|
||||||
|
{props.children}
|
||||||
|
</ThemeProvider>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ThemeProvider;
|
@ -1,19 +1,12 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { FolderOpenIcon, HomeIcon, LucideIcon, PlusIcon, SettingsIcon } from "lucide-react";
|
import { FolderOpenIcon, LucideIcon, PlusIcon, SettingsIcon } from "lucide-react";
|
||||||
import { useTheme } from "next-themes";
|
import { ReactNode } from "react";
|
||||||
import { ReactNode, useState, useCallback, useEffect } from "react";
|
import { SidebarMenuItem, SidebarMenuButton, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarHeader, SidebarFooter, Sidebar, SidebarGroupLabel, SidebarGroupAction } from "../ui/sidebar";
|
||||||
import { SidebarMenuItem, SidebarMenuButton, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarHeader, SidebarSeparator, SidebarFooter, Sidebar, SidebarGroupLabel, SidebarGroupAction } from "../ui/sidebar";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import Image from "next/image";
|
|
||||||
import { Switch } from "../ui/switch";
|
|
||||||
import { Label } from "../ui/label";
|
import { Label } from "../ui/label";
|
||||||
import ClipFusionLogo from "../clipfusion-logo";
|
import ClipFusionLogo from "../clipfusion-logo";
|
||||||
import { Input } from "../ui/input";
|
|
||||||
import Search from "../search";
|
|
||||||
import ThemeSwitcher from "../theme-switcher";
|
import ThemeSwitcher from "../theme-switcher";
|
||||||
|
|
||||||
const WHITESPACE_REGEX = /\s+/g;
|
|
||||||
|
|
||||||
interface DashboardItem {
|
interface DashboardItem {
|
||||||
title: string;
|
title: string;
|
||||||
icon: LucideIcon;
|
icon: LucideIcon;
|
||||||
@ -35,18 +28,6 @@ const items: DashboardItem[] = [
|
|||||||
|
|
||||||
|
|
||||||
export const Dashboard = (): ReactNode => {
|
export const Dashboard = (): ReactNode => {
|
||||||
const { theme, setTheme } = useTheme();
|
|
||||||
const [darkModeChecked, setDarkModeChecked] = useState(false);
|
|
||||||
|
|
||||||
const darkModeCallback = useCallback((checked: boolean) => {
|
|
||||||
setTheme(checked ? "dark" : "light");
|
|
||||||
setDarkModeChecked(checked);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setDarkModeChecked(theme == "dark");
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sidebar>
|
<Sidebar>
|
||||||
<SidebarHeader className="flex justify-center items-center">
|
<SidebarHeader className="flex justify-center items-center">
|
||||||
|
@ -15,11 +15,11 @@ export const ThemeSwitcher = ({
|
|||||||
const onThemeChange = useCallback(() => {
|
const onThemeChange = useCallback(() => {
|
||||||
setTheme(theme == "dark" ? "light" : "dark");
|
setTheme(theme == "dark" ? "light" : "dark");
|
||||||
setDark(!dark);
|
setDark(!dark);
|
||||||
}, [theme, dark]);
|
}, [theme, dark, setTheme]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDark(theme == "dark");
|
setDark(theme == "dark");
|
||||||
}, []);
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Toggle pressed={dark} onPressedChange={onThemeChange}>
|
<Toggle pressed={dark} onPressedChange={onThemeChange}>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { Slot } from "@radix-ui/react-slot"
|
import { Slot } from "@radix-ui/react-slot"
|
||||||
import { cva, VariantProps } from "class-variance-authority"
|
import { cva, VariantProps } from "class-variance-authority"
|
||||||
import { PanelLeftCloseIcon, PanelLeftIcon, PanelLeftOpenIcon } from "lucide-react"
|
import { PanelLeftCloseIcon, PanelLeftOpenIcon } from "lucide-react"
|
||||||
|
|
||||||
import { useIsMobile } from "@/hooks/use-mobile"
|
import { useIsMobile } from "@/hooks/use-mobile"
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
Loading…
Reference in New Issue
Block a user