Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.

Commit b649f43

Browse files
committed
Fix for the double marking via marker tool.
1 parent 67fe473 commit b649f43

11 files changed

Lines changed: 146 additions & 74 deletions

File tree

src/frontend/components/reader/FileReaderContent.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import React, { useState, useRef, useEffect, memo, useCallback, useMemo } from 'react';
1+
import type React from 'react';
2+
import { useState, useRef, useEffect, memo, useCallback, useMemo } from 'react';
23
import { useNavigate } from 'react-router-dom';
34
import { useZoom } from '@/lib/contexts/ZoomContext';
45
import { useTabs } from '@/lib/contexts/TabsContext';
56
import { useEditHistoryContext } from '@/lib/contexts/EditHistoryContext';
67
import { getElectronAPI } from '@/lib/navigation';
7-
import FileReaderTopNavbar, { ZoomValue } from '@/components/reader/FileReaderTopNavbar';
8+
import FileReaderTopNavbar, { type ZoomValue } from '@/components/reader/FileReaderTopNavbar';
89
import NoteBar from '@/components/reader/NoteBar';
910
import DocumentViewer, { DEFAULT_FILES, FileType } from '@/components/viewer/DocumentViewer';
1011
import { ScrollMode } from '@/components/viewer/PDFViewer';
@@ -66,7 +67,7 @@ const FileReaderContent = memo(() => {
6667
}>({ totalMatches: 0, currentMatch: 0 });
6768

6869
// Store the search function provided by PDFViewer
69-
const searchFunctionRef = useRef<(text: string, direction: 'forward' | 'backward') => void | null>(null);
70+
const searchFunctionRef = useRef<(text: string, direction: 'forward' | 'backward') => undefined | null>(null);
7071

7172
// Handler for finding text (called from search modal)
7273
const handleFindText = useCallback((text: string, direction: 'forward' | 'backward') => {
@@ -199,7 +200,7 @@ const FileReaderContent = memo(() => {
199200
}, [filePath, setIsLoading]);
200201

201202
// Handle page change
202-
const handlePageChange = useCallback((newPage: number, manual: boolean = false) => {
203+
const handlePageChange = useCallback((newPage: number, manual = false) => {
203204
if (newPage >= 1 && newPage <= (numPages || 1)) {
204205
// Update our internal state
205206
setPageNumber(newPage);

src/frontend/components/reader/FileReaderTopNavbar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, CSSProperties, useEffect, useCallback, useMemo, memo } from 'react';
1+
import React, { useState, type CSSProperties, useEffect, useCallback, useMemo, memo } from 'react';
22
import { useNavigate } from 'react-router-dom';
33
import {
44
ArrowLeftIcon,
@@ -31,7 +31,7 @@ import {
3131
DropdownMenuSeparator,
3232
DropdownMenuTrigger,
3333
} from '@/components/ui/dropdown-menu';
34-
import TabSwitcherModal, { FileTab } from '@/components/modals/TabSwitcherModal';
34+
import TabSwitcherModal, { type FileTab } from '@/components/modals/TabSwitcherModal';
3535
import { useTabs } from '@/lib/contexts/TabsContext';
3636
import { cn } from '@/lib/utils';
3737
import { ScrollMode } from '@/components/viewer/PDFViewer';
@@ -290,13 +290,15 @@ const DropdownTabItem = memo(({
290290
}}
291291
>
292292
<button
293+
type="button"
293294
className="flex-1 flex items-center text-left"
294295
onClick={handleSelect}
295296
>
296297
<FileIcon className="h-4 w-4 mr-2 text-muted-foreground" />
297298
<span className="flex-1 truncate">{tab.name}</span>
298299
</button>
299300
<button
301+
type="button"
300302
className="opacity-50 hover:opacity-100"
301303
onClick={handleClose}
302304
title="Close"
@@ -594,6 +596,7 @@ const FileReaderTopNavbar = memo(({
594596

595597
{/* Middle section - Edit buttons, Search, View controls, and Zoom */}
596598
<div className="flex-1 flex items-center justify-center space-x-3" style={dragRegion}>
599+
{/* biome-ignore lint/a11y/useKeyWithClickEvents: <explanation> */}
597600
<div className="relative w-1/4 max-w-xs" onClick={handleSearchClick}>
598601
<div className="absolute left-3 top-1/2 -translate-y-1/2 text-sidebar-foreground/70">
599602
<Search className="h-4 w-4" />

src/frontend/components/reader/FileViewport.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { useRef, useState, useEffect, useCallback, useMemo, memo } from 'react';
1+
import type React from 'react';
2+
import { useRef, useState, useEffect, useCallback, useMemo, memo } from 'react';
23
import { Card } from '../ui/card';
34

45
interface FileViewportProps {

src/frontend/components/reader/LeftToolbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { memo, useState, useRef, useEffect } from 'react';
1+
import type React from 'react';
2+
import { memo, useState, useRef, useEffect } from 'react';
23
import { Button } from '@/components/ui/button';
34
import {
45
Hand,

src/frontend/components/reader/NoteBar.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { useState, useCallback, useMemo, memo, useEffect } from 'react';
1+
import type React from 'react';
2+
import { useState, useCallback, useMemo, memo } from 'react';
23
import { Button } from '@/components/ui/button';
34
import { Label } from '@/components/ui/label';
45
import { ScrollArea } from '@/components/ui/scroll-area';
@@ -27,7 +28,7 @@ import {
2728
import { CSS } from '@dnd-kit/utilities';
2829
import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
2930
import { useEditHistoryContext } from '@/lib/contexts/EditHistoryContext';
30-
import { Note } from '@/lib/types';
31+
import type { Note } from '@/lib/types';
3132

3233
interface NoteBarProps {
3334
currentPage: number;
@@ -154,7 +155,7 @@ const SortableNote = memo(({
154155
className="h-6 w-6"
155156
onClick={handleDelete}
156157
>
157-
<span className="sr-only">Delete</span>
158+
<span className="sr-only">Delete note</span>
158159
<svg
159160
xmlns="http://www.w3.org/2000/svg"
160161
width="24"
@@ -166,9 +167,11 @@ const SortableNote = memo(({
166167
strokeLinecap="round"
167168
strokeLinejoin="round"
168169
className="h-4 w-4 text-muted-foreground"
170+
aria-hidden="true"
169171
>
170-
<path d="M18 6L6 18"></path>
171-
<path d="M6 6l12 12"></path>
172+
<title>Delete icon</title>
173+
<path d="M18 6L6 18" />
174+
<path d="M6 6l12 12" />
172175
</svg>
173176
</Button>
174177
</div>

src/frontend/components/reader/PageNavigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const PageNavigation = memo(({ pageNumber, numPages, onPageChange, isVisible, is
3939

4040
// Process page input and navigate if valid
4141
const processPageInput = useCallback(() => {
42-
const newPage = parseInt(inputValue) || pageNumber;
42+
const newPage = Number.parseInt(inputValue) || pageNumber;
4343
const maxPage = numPages || 1;
4444

4545
if (newPage >= 1 && newPage <= maxPage && newPage !== pageNumber) {

src/frontend/components/reader/SearchBar.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { useState, useRef, useEffect, useCallback } from 'react';
1+
import type React from 'react';
2+
import { useState, useRef, useEffect, useCallback } from 'react';
23
import {
34
Search,
45
ArrowUp,
@@ -169,6 +170,7 @@ const SearchBar = ({
169170
/>
170171
{searchQuery && (
171172
<button
173+
type="button"
172174
onClick={handleClearSearch}
173175
className="absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
174176
aria-label="Clear search"
@@ -226,9 +228,10 @@ const SearchBar = ({
226228
Recent Searches
227229
</div>
228230
<div className="flex flex-wrap gap-1.5">
229-
{recentSearches.map((term, index) => (
231+
{recentSearches.map((term) => (
230232
<button
231-
key={`${term}-${index}`}
233+
type="button"
234+
key={term}
232235
onClick={() => handleRecentSearchClick(term)}
233236
className="px-2 py-1 text-xs rounded-md bg-muted hover:bg-muted/80 transition-colors"
234237
>

src/frontend/components/viewer/DocumentViewer.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { useState, useEffect, useCallback, memo, useRef } from 'react';
1+
import type React from 'react';
2+
import { useState, useEffect, useCallback, memo, useRef } from 'react';
23
import { Skeleton } from '@/components/ui/skeleton';
34
import LoadingModal from '@/components/modals/LoadingModal';
4-
import { ZoomValue } from '@/components/reader/FileReaderTopNavbar';
5+
import type { ZoomValue } from '@/components/reader/FileReaderTopNavbar';
56

67
// Import the PDFViewer
78
import PDFViewer, { ScrollMode } from './PDFViewer';
@@ -213,7 +214,7 @@ const DocumentViewer: React.FC<DocumentViewerProps> = memo(({
213214
drawingLineWidth={drawingLineWidth}
214215
/>
215216
);
216-
case FileType.UNKNOWN:
217+
//case FileType.UNKNOWN:
217218
default:
218219
// Only show the fallback PDF for unknown files
219220
return (
@@ -234,7 +235,7 @@ const DocumentViewer: React.FC<DocumentViewerProps> = memo(({
234235
{/* Loading Modal - only shown when initially loading a file */}
235236
<LoadingModal
236237
isOpen={showLoadingModal}
237-
message={`Loading document...`}
238+
message={"Loading document..."}
238239
fullScreen={false}
239240
/>
240241
</>

0 commit comments

Comments
 (0)