fix: resolve all ESLint errors blocking CI releases
- Extract ThemeContext and ToolCollapseContext definitions into separate files to satisfy react-refresh/only-export-components rule - Move useTheme and useToolCollapse hooks to dedicated hook files - Fix empty catch block in ThemeContext (add comment) - Replace Date.now() ref in ThinkingIndicator with useState initializer - Update all imports across components Closes feedback #58
This commit is contained in:
@@ -6,7 +6,7 @@ import type { ChatMessage, ConnectionStatus } from '../types';
|
||||
import { Bot, ArrowDown, Loader2, ChevronsDownUp, ChevronsUpDown } from 'lucide-react';
|
||||
import { useT } from '../hooks/useLocale';
|
||||
import { getLocale, type TranslationKey } from '../lib/i18n';
|
||||
import { useToolCollapse } from '../contexts/ToolCollapseContext';
|
||||
import { useToolCollapse } from '../hooks/useToolCollapse';
|
||||
|
||||
interface Props {
|
||||
messages: ChatMessage[];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
import { Palette, Sun, Moon, Monitor, Check } from 'lucide-react';
|
||||
import { useTheme, type ThemeName, type AccentColor } from '../contexts/ThemeContext';
|
||||
import { useTheme } from '../hooks/useTheme';
|
||||
import type { ThemeName, AccentColor } from '../contexts/ThemeContextDef';
|
||||
import { useT } from '../hooks/useLocale';
|
||||
|
||||
import type { TranslationKey } from '../lib/i18n';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Brain } from 'lucide-react';
|
||||
import { useT } from '../hooks/useLocale';
|
||||
|
||||
@@ -10,14 +10,14 @@ import { useT } from '../hooks/useLocale';
|
||||
export function ThinkingIndicator() {
|
||||
const t = useT();
|
||||
const [elapsed, setElapsed] = useState(0);
|
||||
const startRef = useRef(Date.now());
|
||||
const [start] = useState(() => Date.now());
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
setElapsed(Math.floor((Date.now() - startRef.current) / 1000));
|
||||
setElapsed(Math.floor((Date.now() - start) / 1000));
|
||||
}, 1000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
}, [start]);
|
||||
|
||||
const formatElapsed = (s: number) => {
|
||||
if (s < 60) return `${s}s`;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ChevronRight, ChevronDown, Check, Copy, WrapText, AlignLeft } from 'luc
|
||||
import hljs from 'highlight.js/lib/common';
|
||||
import { useT } from '../hooks/useLocale';
|
||||
import { ImageBlock } from './ImageBlock';
|
||||
import { useToolCollapse } from '../contexts/ToolCollapseContext';
|
||||
import { useToolCollapse } from '../hooks/useToolCollapse';
|
||||
|
||||
type ToolColor = { border: string; bg: string; text: string; icon: string; glow: string; expandBorder: string; expandBg: string };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user