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:
Anthony Stirling 2025-10-05 11:41:05 +01:00
parent 6ea920e9a7
commit ac03c49abb
4 changed files with 6 additions and 6 deletions

View File

@ -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';

View File

@ -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;

View File

@ -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;

View File

@ -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({