mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-01 20:10:35 +01:00
Fix TypeScript errors in legacy UI refactor
- Update RefObject types to accept null in hooks - Fix useLocalStorageState return type to support updater functions - Remove unused Group import from LegacyToolSurface 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6ea920e9a7
commit
ac03c49abb
@ -1,5 +1,5 @@
|
||||
import { useEffect, useState, useRef } from 'react';
|
||||
import { ActionIcon, Group, ScrollArea, Switch, Text, Tooltip } from '@mantine/core';
|
||||
import { ActionIcon, ScrollArea, Switch, Text, Tooltip } from '@mantine/core';
|
||||
import ViewSidebarRoundedIcon from '@mui/icons-material/ViewSidebarRounded';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import ToolSearch from './toolPicker/ToolSearch';
|
||||
|
||||
@ -9,7 +9,7 @@ const FOCUSABLE_ELEMENTS = [
|
||||
'[tabindex]:not([tabindex="-1"])',
|
||||
].join(', ');
|
||||
|
||||
export function useFocusTrap(containerRef: RefObject<HTMLElement>, enabled: boolean = true) {
|
||||
export function useFocusTrap(containerRef: RefObject<HTMLElement | null>, enabled: boolean = true) {
|
||||
useEffect(() => {
|
||||
if (!enabled || !containerRef.current) {
|
||||
return;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useState, useEffect, Dispatch, SetStateAction } from 'react';
|
||||
|
||||
export function useLocalStorageState<T>(key: string, defaultValue: T): [T, (value: T) => void] {
|
||||
export function useLocalStorageState<T>(key: string, defaultValue: T): [T, Dispatch<SetStateAction<T>>] {
|
||||
const [state, setState] = useState<T>(() => {
|
||||
if (typeof window === 'undefined') {
|
||||
return defaultValue;
|
||||
|
||||
@ -9,8 +9,8 @@ export interface ToolPanelGeometry {
|
||||
|
||||
interface UseToolPanelGeometryOptions {
|
||||
enabled: boolean;
|
||||
toolPanelRef: RefObject<HTMLDivElement>;
|
||||
quickAccessRef: RefObject<HTMLDivElement>;
|
||||
toolPanelRef: RefObject<HTMLDivElement | null>;
|
||||
quickAccessRef: RefObject<HTMLDivElement | null>;
|
||||
}
|
||||
|
||||
export function useToolPanelGeometry({
|
||||
|
||||
Loading…
Reference in New Issue
Block a user