Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywoola committed Dec 10, 2024
1 parent 41e7797 commit 2d0f8e3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 30 deletions.
7 changes: 3 additions & 4 deletions web/app/components/base/file-uploader/audio-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -14,9 +15,7 @@ const AudioPreview: FC<AudioPreviewProps> = ({
title,
onCancel,
}) => {
useKeyboardShortcuts({
esc: onCancel,
})
useHotkeys('esc', onCancel)

return createPortal(
<div
Expand Down
10 changes: 4 additions & 6 deletions web/app/components/base/file-uploader/pdf-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { PdfHighlighter, PdfLoader } from 'react-pdf-highlighter'
import { t } from 'i18next'
import { RiCloseLine, RiZoomInLine, RiZoomOutLine } from '@remixicon/react'
import React, { useState } from 'react'
import { useHotkeys } from 'react-hotkeys-hook'
import Loading from '@/app/components/base/loading'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { useKeyboardShortcuts } from '@/hooks/use-keyboard-short'
import Tooltip from '@/app/components/base/tooltip'

type PdfPreviewProps = {
Expand Down Expand Up @@ -41,11 +41,9 @@ const PdfPreview: FC<PdfPreviewProps> = ({
})
}

useKeyboardShortcuts({
esc: onCancel,
up: zoomIn,
down: zoomOut,
})
useHotkeys('esc', onCancel)
useHotkeys('up', zoomIn)
useHotkeys('down', zoomOut)

return createPortal(
<div
Expand Down
6 changes: 2 additions & 4 deletions web/app/components/base/file-uploader/video-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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 VideoPreviewProps = {
url: string
Expand All @@ -14,9 +14,7 @@ const VideoPreview: FC<VideoPreviewProps> = ({
title,
onCancel,
}) => {
useKeyboardShortcuts({
esc: onCancel,
})
useHotkeys('esc', onCancel)

return createPortal(
<div
Expand Down
14 changes: 6 additions & 8 deletions web/app/components/base/image-uploader/image-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'
import { t } from 'i18next'
import { createPortal } from 'react-dom'
import { RiAddBoxLine, RiCloseLine, RiDownloadCloud2Line, RiFileCopyLine, RiZoomInLine, RiZoomOutLine } from '@remixicon/react'
import { useHotkeys } from 'react-hotkeys-hook'
import Tooltip from '@/app/components/base/tooltip'
import Toast from '@/app/components/base/toast'
import { useKeyboardShortcuts } from '@/hooks/use-keyboard-short'

type ImagePreviewProps = {
url: string
Expand Down Expand Up @@ -193,13 +193,11 @@ const ImagePreview: FC<ImagePreviewProps> = ({
}
}, [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(
<div className='fixed inset-0 p-8 flex items-center justify-center bg-black/80 z-[1000] image-preview-container'
Expand Down
8 changes: 0 additions & 8 deletions web/hooks/use-keyboard-short.ts

This file was deleted.

0 comments on commit 2d0f8e3

Please sign in to comment.