mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-12-18 20:04:17 +01:00
Lint
This commit is contained in:
parent
a22913e1e4
commit
8ee03fa1c6
@ -4,6 +4,7 @@ import eslint from '@eslint/js';
|
||||
import globals from "globals";
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
|
||||
const srcGlobs = [
|
||||
'src/**/*.{js,mjs,jsx,ts,tsx}',
|
||||
@ -23,7 +24,11 @@ export default defineConfig(
|
||||
],
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
'react-hooks': reactHooks,
|
||||
},
|
||||
rules: {
|
||||
...reactHooks.configs.recommended.rules,
|
||||
"@typescript-eslint/no-empty-object-type": [
|
||||
"error",
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useMemo, useEffect } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Box } from '@mantine/core';
|
||||
import { useRainbowThemeContext } from '../shared/RainbowThemeProvider';
|
||||
import { useToolWorkflow } from '../../contexts/ToolWorkflowContext';
|
||||
|
||||
@ -6,13 +6,11 @@ import {
|
||||
DndContext,
|
||||
DragEndEvent,
|
||||
DragStartEvent,
|
||||
DragOverEvent,
|
||||
DragOverlay,
|
||||
useSensor,
|
||||
useSensors,
|
||||
PointerSensor,
|
||||
closestCenter,
|
||||
useDndMonitor,
|
||||
useDraggable,
|
||||
useDroppable,
|
||||
} from '@dnd-kit/core';
|
||||
@ -122,7 +120,6 @@ const DragDropGrid = <T extends DragDropItem>({
|
||||
const [dragPreview, setDragPreview] = useState<{ src: string; rotation: number } | null>(null);
|
||||
const [hoveredItemId, setHoveredItemId] = useState<string | null>(null);
|
||||
const [dropSide, setDropSide] = useState<'left' | 'right' | null>(null);
|
||||
const lastCursorXRef = useRef<number | null>(null);
|
||||
|
||||
// Configure sensors for dnd-kit with activation constraint
|
||||
// Require 10px movement before drag starts to allow clicks for selection
|
||||
@ -179,7 +176,7 @@ const DragDropGrid = <T extends DragDropItem>({
|
||||
// Step 2: Find the closest row to cursor Y position
|
||||
let closestRowY = 0;
|
||||
let closestRowDistance = Infinity;
|
||||
rows.forEach((items, rowY) => {
|
||||
Array.from(rows.keys()).forEach((rowY) => {
|
||||
const distance = Math.abs(cursorY - rowY);
|
||||
if (distance < closestRowDistance) {
|
||||
closestRowDistance = distance;
|
||||
|
||||
@ -48,7 +48,7 @@ const PageEditor = ({
|
||||
const { setHasUnsavedChanges } = useNavigationGuard();
|
||||
|
||||
// Get PageEditor coordination functions
|
||||
const { updateCurrentPages, reorderedPages, clearReorderedPages, updateFileOrderFromPages, fileOrder } = usePageEditor();
|
||||
const { updateFileOrderFromPages, fileOrder } = usePageEditor();
|
||||
|
||||
// Derive page editor files from PageEditorContext's fileOrder (page editor workspace order)
|
||||
// Filter to only show PDF files (PageEditor only supports PDFs)
|
||||
|
||||
@ -61,11 +61,11 @@ const PageThumbnail: React.FC<PageThumbnailProps> = ({
|
||||
movingPage,
|
||||
isAnimating,
|
||||
isBoxSelected = false,
|
||||
boxSelectedPageIds = [],
|
||||
// boxSelectedPageIds,
|
||||
clearBoxSelection,
|
||||
getBoxSelection,
|
||||
// getBoxSelection,
|
||||
activeId,
|
||||
isOver,
|
||||
// isOver,
|
||||
pageRefs,
|
||||
dragHandleProps,
|
||||
onReorderPages,
|
||||
|
||||
@ -26,7 +26,6 @@ export function usePageDocument(): PageDocumentHook {
|
||||
// Filter to only include PDF files (PageEditor only supports PDFs)
|
||||
// Use stable string keys to prevent infinite loops
|
||||
const allFileIdsKey = allFileIds.join(',');
|
||||
const selectedIdsKey = [...state.ui.selectedFileIds].sort().join(',');
|
||||
const activeFilesSignature = selectors.getFilesSignature();
|
||||
|
||||
// Get ALL PDF files (selected or not) for document building with placeholders
|
||||
|
||||
@ -105,8 +105,16 @@ const FileMenuItem: React.FC<FileMenuItemProps> = ({
|
||||
});
|
||||
|
||||
return () => {
|
||||
try { dragCleanup(); } catch {}
|
||||
try { dropCleanup(); } catch {}
|
||||
try {
|
||||
dragCleanup();
|
||||
} catch {
|
||||
// Cleanup may fail if element was already removed
|
||||
}
|
||||
try {
|
||||
dropCleanup();
|
||||
} catch {
|
||||
// Cleanup may fail if element was already removed
|
||||
}
|
||||
};
|
||||
}, []); // NOTE: no `onReorder` here
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user