Fix linter errors

This commit is contained in:
Alex Gleason committed 2025-07-20 15:31:29 -05:00
1 parent b832c5c6fd
commit fcf779fe35
15 files changed
+93 -70

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
import { createContext } from 'react';
export interface AISettings {
apiKey: string;
baseUrl: string;
model: string;
}
export interface AISettingsContextType {
settings: AISettings;
updateSettings: (settings: Partial<AISettings>) => void;
isConfigured: boolean;
}
export const AISettingsContext = createContext<AISettingsContextType | undefined>(undefined);
-62
View File
@@ -1,62 +0,0 @@
import { createContext, useContext, useState, useEffect, ReactNode } from 'react';
export interface AISettings {
apiKey: string;
baseUrl: string;
model: string;
}
interface AISettingsContextType {
settings: AISettings;
updateSettings: (settings: Partial<AISettings>) => void;
isConfigured: boolean;
}
const AISettingsContext = createContext<AISettingsContextType | undefined>(undefined);
const DEFAULT_SETTINGS: AISettings = {
apiKey: '',
baseUrl: 'https://openrouter.ai/api/v1',
model: 'anthropic/claude-sonnet-4',
};
const STORAGE_KEY = 'ai-settings';
export function AISettingsProvider({ children }: { children: ReactNode }) {
const [settings, setSettings] = useState<AISettings>(() => {
const stored = localStorage.getItem(STORAGE_KEY);
if (stored) {
try {
return { ...DEFAULT_SETTINGS, ...JSON.parse(stored) };
} catch {
return DEFAULT_SETTINGS;
}
}
return DEFAULT_SETTINGS;
});
useEffect(() => {
localStorage.setItem(STORAGE_KEY, JSON.stringify(settings));
}, [settings]);
const updateSettings = (newSettings: Partial<AISettings>) => {
setSettings(prev => ({ ...prev, ...newSettings }));
};
const isConfigured = Boolean(settings.apiKey);
return (
<AISettingsContext.Provider value={{ settings, updateSettings, isConfigured }}>
{children}
</AISettingsContext.Provider>
);
}
export function useAISettings() {
const context = useContext(AISettingsContext);
if (!context) {
throw new Error('useAISettings must be used within AISettingsProvider');
}
return context;
}
+8
View File
@@ -0,0 +1,8 @@
import { createContext } from 'react';
import type LightningFS from '@isomorphic-git/lightning-fs';
export interface FSContextType {
fs: LightningFS.PromisifiedFS;
}
export const FSContext = createContext<FSContextType | undefined>(undefined);
-29
View File
@@ -1,29 +0,0 @@
import { createContext, useContext, type ReactNode } from 'react';
import LightningFS from '@isomorphic-git/lightning-fs';
interface FSContextType {
fs: LightningFS.PromisifiedFS;
}
const FSContext = createContext<FSContextType | undefined>(undefined);
interface FSProviderProps {
children: ReactNode;
fs: LightningFS.PromisifiedFS;
}
export function FSProvider({ children, fs }: FSProviderProps) {
return (
<FSContext.Provider value={{ fs }}>
{children}
</FSContext.Provider>
);
}
export function useFS(): FSContextType {
const context = useContext(FSContext);
if (context === undefined) {
throw new Error('useFS must be used within a FSProvider');
}
return context;
}