From bb517551fe71a1ebb8795bca85d21d2741b586ac Mon Sep 17 00:00:00 2001 From: Andrew Charneski Date: Fri, 29 Nov 2024 20:37:35 -0500 Subject: [PATCH] wip --- .../chat-app/src/components/MessageList.tsx | 11 --- webapp/chat-app/src/styles/GlobalStyles.ts | 13 ---- webapp/chat-app/src/themes/themes.ts | 2 - webapp/chat-app/src/types/global.d.ts | 11 --- webapp/chat-app/src/utils/storage.ts | 75 ------------------- webapp/chat-app/src/utils/tabHandling.ts | 4 - 6 files changed, 116 deletions(-) delete mode 100644 webapp/chat-app/src/utils/storage.ts diff --git a/webapp/chat-app/src/components/MessageList.tsx b/webapp/chat-app/src/components/MessageList.tsx index 5e939601..332cd32f 100644 --- a/webapp/chat-app/src/components/MessageList.tsx +++ b/webapp/chat-app/src/components/MessageList.tsx @@ -303,17 +303,6 @@ const MessageList: React.FC = ({messages: propMessages}) => { }; }, []); - - const processMessageContent = useCallback((content: string) => { - logger.debug('Processing message content', {contentLength: content.length}); - const processed = expandMessageReferences(content, messages); - // Re-highlight code blocks after theme change - requestAnimationFrame(() => { - Prism.highlightAll(); - }); - return processed; - }, [messages]); - React.useEffect(() => { logger.debug('MessageList - Messages updated', { messageCount: messages.length, diff --git a/webapp/chat-app/src/styles/GlobalStyles.ts b/webapp/chat-app/src/styles/GlobalStyles.ts index 58d55b94..75d78a8e 100644 --- a/webapp/chat-app/src/styles/GlobalStyles.ts +++ b/webapp/chat-app/src/styles/GlobalStyles.ts @@ -5,19 +5,6 @@ const logStyleChange = (component: string, property: string, value: any) => { console.log(`[${timestamp}] GlobalStyles: ${component} - ${property}:`, value); }; -// Log when global styles are being applied -const logThemeChange = (theme: DefaultTheme) => { - const timestamp = new Date().toISOString(); - console.group(`[${timestamp}] GlobalStyles: Theme Application`); - console.log('Theme configuration:', { - background: theme.colors.background, - textColor: theme.colors.text.primary, - fontFamily: theme.typography.fontFamily, - fontSize: theme.typography.fontSize.md - }); - console.groupEnd(); -}; - export const GlobalStyles = createGlobalStyle<{ theme: DefaultTheme }>` /* Theme CSS variables */ :root { diff --git a/webapp/chat-app/src/themes/themes.ts b/webapp/chat-app/src/themes/themes.ts index 0e90fea4..c3417203 100644 --- a/webapp/chat-app/src/themes/themes.ts +++ b/webapp/chat-app/src/themes/themes.ts @@ -399,5 +399,3 @@ export const logThemeChange = (from: ThemeName, to: ThemeName) => { timestamp: new Date().toISOString() }); }; -// Export logger for use in other components -export const themeLogger = logger; \ No newline at end of file diff --git a/webapp/chat-app/src/types/global.d.ts b/webapp/chat-app/src/types/global.d.ts index 3077b479..0bf608d2 100644 --- a/webapp/chat-app/src/types/global.d.ts +++ b/webapp/chat-app/src/types/global.d.ts @@ -40,15 +40,4 @@ declare global { } } -interface AppConfig { - singleInput: boolean; - stickyInput: boolean; - loadImages: boolean; - showMenubar: boolean; - applicationName: string; - websocket: WebSocketConfig; - appInfo: any | null; - // ... other existing properties -} - export type {AppConfig}; \ No newline at end of file diff --git a/webapp/chat-app/src/utils/storage.ts b/webapp/chat-app/src/utils/storage.ts deleted file mode 100644 index 5081edb8..00000000 --- a/webapp/chat-app/src/utils/storage.ts +++ /dev/null @@ -1,75 +0,0 @@ -// Utility for safely interacting with localStorage -export const safeStorage = { - setItem(key: string, value: string) { - try { - localStorage.setItem(key, value); - return true; - } catch (error: unknown) { - console.warn('[Storage] Failed to save to localStorage:', { - key, - error, - storageUsed: this.getUsedSpace() - }); - // Try to clear old items if storage is full - if (error instanceof Error && error.name === 'QuotaExceededError') { - this.clearOldItems(); - try { - localStorage.setItem(key, value); - return true; - } catch (retryError: unknown) { - console.error('[Storage] Still failed after clearing storage:', retryError); - } - } - return false; - } - }, - - getItem(key: string, defaultValue: string = '') { - try { - const value = localStorage.getItem(key); - return value !== null ? value : defaultValue; - } catch (error: unknown) { - console.warn('[Storage] Failed to read from localStorage:', { - key, - error - }); - return defaultValue; - } - }, - - getUsedSpace() { - try { - let total = 0; - for (let key in localStorage) { - if (Object.prototype.hasOwnProperty.call(localStorage, key)) { - total += localStorage[key].length + key.length; - } - } - return (total * 2) / 1024 / 1024; // Approximate MB used - } catch (error: unknown) { - console.error('[Storage] Failed to calculate storage usage:', error); - return 0; - } - }, - - clearOldItems() { - try { - const themeKey = 'theme'; - const verboseModeKey = 'verboseMode'; - // Keep important settings but clear other items - const currentTheme = this.getItem(themeKey); - const verboseMode = this.getItem(verboseModeKey); - - localStorage.clear(); - - if (currentTheme) { - this.setItem(themeKey, currentTheme); - } - if (verboseMode) { - this.setItem(verboseModeKey, verboseMode); - } - } catch (error) { - console.error('[Storage] Failed to clear storage:', error); - } - } -}; \ No newline at end of file diff --git a/webapp/chat-app/src/utils/tabHandling.ts b/webapp/chat-app/src/utils/tabHandling.ts index 3173eb4c..c7eba49c 100644 --- a/webapp/chat-app/src/utils/tabHandling.ts +++ b/webapp/chat-app/src/utils/tabHandling.ts @@ -18,8 +18,6 @@ export interface TabContainer extends HTMLElement { contentObservers?: Map; } -// Track active tab observers -export const tabObservers = new Map>(); // Add diagnostic counters const diagnostics = { saveCount: 0, @@ -405,8 +403,6 @@ export const updateTabs = debounce(() => { return; } isMutating = true; - // Capture current versions before update - const previousVersions = new Map(tabStateVersions); // Get current tab states const currentStates = getAllTabStates();