From 2d0f8e3846b4c2bfdc4a5ac02cea0f3458e7d975 Mon Sep 17 00:00:00 2001 From: crazywoola <427733928@qq.com> Date: Tue, 10 Dec 2024 10:41:47 +0800 Subject: [PATCH] fix: lint --- .../base/file-uploader/audio-preview.tsx | 7 +++---- .../components/base/file-uploader/pdf-preview.tsx | 10 ++++------ .../base/file-uploader/video-preview.tsx | 6 ++---- .../base/image-uploader/image-preview.tsx | 14 ++++++-------- web/hooks/use-keyboard-short.ts | 8 -------- 5 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 web/hooks/use-keyboard-short.ts diff --git a/web/app/components/base/file-uploader/audio-preview.tsx b/web/app/components/base/file-uploader/audio-preview.tsx index 78e48fe3c70d35..9a1ed440e25f08 100644 --- a/web/app/components/base/file-uploader/audio-preview.tsx +++ b/web/app/components/base/file-uploader/audio-preview.tsx @@ -2,7 +2,8 @@ import type { FC } from 'react' import { createPortal } from 'react-dom' import { RiCloseLine } from '@remixicon/react' import React from 'react' -import { useKeyboardShortcuts } from '@/hooks/use-keyboard-short' + +import { useHotkeys } from 'react-hotkeys-hook' type AudioPreviewProps = { url: string @@ -14,9 +15,7 @@ const AudioPreview: FC = ({ title, onCancel, }) => { - useKeyboardShortcuts({ - esc: onCancel, - }) + useHotkeys('esc', onCancel) return createPortal(
= ({ }) } - useKeyboardShortcuts({ - esc: onCancel, - up: zoomIn, - down: zoomOut, - }) + useHotkeys('esc', onCancel) + useHotkeys('up', zoomIn) + useHotkeys('down', zoomOut) return createPortal(
= ({ title, onCancel, }) => { - useKeyboardShortcuts({ - esc: onCancel, - }) + useHotkeys('esc', onCancel) return createPortal(
= ({ } }, [handleMouseUp]) - useKeyboardShortcuts({ - esc: onCancel, - up: zoomIn, - down: zoomOut, - left: onPrev || (() => {}), - right: onNext || (() => {}), - }) + useHotkeys('esc', onCancel) + useHotkeys('up', zoomIn) + useHotkeys('down', zoomOut) + useHotkeys('left', onPrev || (() => {})) + useHotkeys('right', onNext || (() => {})) return createPortal(
{ - const action = shortcuts[key] - useHotkeys(key, action) - }) -}