From ed53bdd0fa09a493954d42cff74f7cef94d5b2d1 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 18:28:50 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- apps/dokploy/hooks/use-keyboard-nav.tsx | 160 +++++++++--------- .../services/application/[applicationId].tsx | 2 +- .../services/compose/[composeId].tsx | 2 +- .../[projectId]/services/mysql/[mysqlId].tsx | 2 +- .../services/postgres/[postgresId].tsx | 2 +- .../[projectId]/services/redis/[redisId].tsx | 2 +- 6 files changed, 84 insertions(+), 86 deletions(-) diff --git a/apps/dokploy/hooks/use-keyboard-nav.tsx b/apps/dokploy/hooks/use-keyboard-nav.tsx index 7aa9adf6c..be9e206a9 100644 --- a/apps/dokploy/hooks/use-keyboard-nav.tsx +++ b/apps/dokploy/hooks/use-keyboard-nav.tsx @@ -4,114 +4,112 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation"; import { useCallback, useEffect, useState } from "react"; const PAGES = ["compose", "application", "postgres", "redis", "mysql"] as const; -type Page = typeof PAGES[number]; +type Page = (typeof PAGES)[number]; type Shortcuts = Record; type ShortcutsDictionary = Record; const COMPOSE_SHORTCUTS: Shortcuts = { - g: "general", - e: "environment", - u: "domains", - d: "deployments", - b: "backups", - s: "schedules", - v: "volumeBackups", - l: "logs", - m: "monitoring", - a: "advanced", + g: "general", + e: "environment", + u: "domains", + d: "deployments", + b: "backups", + s: "schedules", + v: "volumeBackups", + l: "logs", + m: "monitoring", + a: "advanced", }; const APPLICATION_SHORTCUTS: Shortcuts = { - g: "general", - e: "environment", - u: "domains", - p: "preview-deployments", - s: "schedules", - v: "volume-backups", - d: "deployments", - l: "logs", - m: "monitoring", - a: "advanced", + g: "general", + e: "environment", + u: "domains", + p: "preview-deployments", + s: "schedules", + v: "volume-backups", + d: "deployments", + l: "logs", + m: "monitoring", + a: "advanced", }; const POSTGRES_SHORTCUTS: Shortcuts = { - g: "general", - e: "environment", - l: "logs", - m: "monitoring", - b: "backups", - a: "advanced", + g: "general", + e: "environment", + l: "logs", + m: "monitoring", + b: "backups", + a: "advanced", }; const REDIS_SHORTCUTS: Shortcuts = { - g: "general", - e: "environment", - l: "logs", - m: "monitoring", - a: "advanced", + g: "general", + e: "environment", + l: "logs", + m: "monitoring", + a: "advanced", }; const SHORTCUTS: ShortcutsDictionary = { - application: APPLICATION_SHORTCUTS, - compose: COMPOSE_SHORTCUTS, - postgres: POSTGRES_SHORTCUTS, - redis: REDIS_SHORTCUTS, - mysql: POSTGRES_SHORTCUTS, + application: APPLICATION_SHORTCUTS, + compose: COMPOSE_SHORTCUTS, + postgres: POSTGRES_SHORTCUTS, + redis: REDIS_SHORTCUTS, + mysql: POSTGRES_SHORTCUTS, }; /** -* Use this to register keyboard shortcuts for different pages. Each shortcut -* must be prefixed with `g` (like GitHub). -* -* @example -* - `g g` "General", -* - `g e` "Environment", -* - `g u` "Domains", -*/ + * Use this to register keyboard shortcuts for different pages. Each shortcut + * must be prefixed with `g` (like GitHub). + * + * @example + * - `g g` "General", + * - `g e` "Environment", + * - `g u` "Domains", + */ export function UseKeyboardNav({ forPage }: { forPage: Page }) { - const [isModPressed, setModPressed] = useState(false); - const [timer, setTimer] = useState(null); + const [isModPressed, setModPressed] = useState(false); + const [timer, setTimer] = useState(null); - const sp = useSearchParams(); - const router = useRouter(); - const pathname = usePathname(); + const sp = useSearchParams(); + const router = useRouter(); + const pathname = usePathname(); - const shortcuts = SHORTCUTS[forPage]; + const shortcuts = SHORTCUTS[forPage]; - const updateSearchParam = useCallback( - (name: string, value: string) => { - const params = new URLSearchParams(sp.toString()); - params.set(name, value); + const updateSearchParam = useCallback( + (name: string, value: string) => { + const params = new URLSearchParams(sp.toString()); + params.set(name, value); - return params.toString(); - }, - [sp], - ); + return params.toString(); + }, + [sp], + ); - useEffect(() => { - const handleKeyDown = ({ key }: KeyboardEvent) => { - if (isModPressed) { - if (timer) clearTimeout(timer); - setModPressed(false); + useEffect(() => { + const handleKeyDown = ({ key }: KeyboardEvent) => { + if (isModPressed) { + if (timer) clearTimeout(timer); + setModPressed(false); - if (key in shortcuts) { - const tab = shortcuts[key]!; - router.push( - `${pathname}?${updateSearchParam("tab", tab)}`, - ); - } - } else { - if (key === "g") { - setModPressed(true); - setTimer(setTimeout(() => setModPressed(false), 5000)); - } - } - }; + if (key in shortcuts) { + const tab = shortcuts[key]!; + router.push(`${pathname}?${updateSearchParam("tab", tab)}`); + } + } else { + if (key === "g") { + setModPressed(true); + setTimer(setTimeout(() => setModPressed(false), 5000)); + } + } + }; - window.addEventListener("keydown", handleKeyDown); - return () => window.removeEventListener("keydown", handleKeyDown); - }, [isModPressed, timer, updateSearchParam, router, pathname]); + window.addEventListener("keydown", handleKeyDown); + return () => window.removeEventListener("keydown", handleKeyDown); + }, [isModPressed, timer, updateSearchParam, router, pathname]); - return null; + return null; } diff --git a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx b/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx index 305a931ce..09766130d 100644 --- a/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx +++ b/apps/dokploy/pages/dashboard/project/[projectId]/services/application/[applicationId].tsx @@ -92,7 +92,7 @@ const Service = ( return (
- + - + - + - + - +