First step refactoring

This commit is contained in:
sageTheDM 2024-10-01 08:13:52 +02:00
parent 2f84559ec2
commit 7a74e70520
2 changed files with 146 additions and 306 deletions

View file

@ -1,17 +1,13 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { applyIOMarketTheme, applyWhiteTheme, applyBlackTheme } from './theme'; import { applyTheme, applyCustomTheme } from './theme';
import { exportSettings, importSettings } from './settingUtils'; // Import utility functions import { exportSettings, importSettings } from './settingUtils'; // Import utility functions
import { getAllLocalStorageItems } from '../backend/GetLocalStorage'; import { getAllLocalStorageItems } from '../backend/GetLocalStorage';
import { import {
sendToDatabase,
createAccount,
changePassword, changePassword,
getData,
changeData, changeData,
checkCredentials,
deleteAccount, deleteAccount,
} from '../backend/database'; } from '../backend/database';
import { equal } from 'assert';
const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ({ closeSettings, accountName }) => { const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ({ closeSettings, accountName }) => {
@ -103,24 +99,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
const savedTheme = localStorage.getItem('selectedTheme'); const savedTheme = localStorage.getItem('selectedTheme');
if (savedTheme) { if (savedTheme) {
setSelectedTheme(savedTheme); setSelectedTheme(savedTheme);
// Apply the saved theme on initial load applyTheme(savedTheme);
switch (savedTheme) {
case 'IOMARKET':
applyIOMarketTheme();
break;
case 'WHITE':
applyWhiteTheme();
break;
case 'BLACK':
applyBlackTheme();
break;
case 'CUSTOM':
// Handle custom theme application here if necessary
break;
default:
applyIOMarketTheme();
break;
}
} }
}, []); // Runs only once when the component mounts }, []); // Runs only once when the component mounts
@ -265,144 +244,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
localStorage.setItem('radioSelection', newValue); // Save the selection for persistence localStorage.setItem('radioSelection', newValue); // Save the selection for persistence
}; };
// Apply imported settings to the CSS variables // Function to handle updating all credentials
const applySettings = (settings: any) => {
if (settings.backgroundColor) {
setBackgroundColor(settings.backgroundColor);
document.documentElement.style.setProperty('--background-color', settings.backgroundColor);
}
if (settings.textColor) {
setTextColor(settings.textColor);
document.documentElement.style.setProperty('--text-color', settings.textColor);
}
if (settings.inputBackgroundColor) {
setInputBackgroundColor(settings.inputBackgroundColor);
document.documentElement.style.setProperty('--input-background-color', settings.inputBackgroundColor);
}
if (settings.inputButtonColor) {
setInputButtonColor(settings.inputButtonColor);
document.documentElement.style.setProperty('--input-button-color', settings.inputButtonColor);
}
if (settings.inputButtonHoverColor) {
setInputButtonHoverColor(settings.inputButtonHoverColor);
document.documentElement.style.setProperty('--input-button-hover-color', settings.inputButtonHoverColor);
}
if (settings.userMessageBackgroundColor) {
setUserMessageBackgroundColor(settings.userMessageBackgroundColor);
document.documentElement.style.setProperty('--user-message-background-color', settings.userMessageBackgroundColor);
}
if (settings.userMessageTextColor) {
setUserMessageTextColor(settings.userMessageTextColor);
document.documentElement.style.setProperty('--user-message-text-color', settings.userMessageTextColor);
}
if (settings.aiMessageBackgroundColor) {
setAiMessageBackgroundColor(settings.aiMessageBackgroundColor);
document.documentElement.style.setProperty('--ai-message-background-color', settings.aiMessageBackgroundColor);
}
if (settings.aiMessageTextColor) {
setAiMessageTextColor(settings.aiMessageTextColor);
document.documentElement.style.setProperty('--ai-message-text-color', settings.aiMessageTextColor);
}
if (settings.buttonBackgroundColor) {
setButtonBackgroundColor(settings.buttonBackgroundColor);
document.documentElement.style.setProperty('--button-background-color', settings.buttonBackgroundColor);
}
if (settings.buttonHoverBackgroundColor) {
setButtonHoverBackgroundColor(settings.buttonHoverBackgroundColor);
document.documentElement.style.setProperty('--button-hover-background-color', settings.buttonHoverBackgroundColor);
}
if (settings.modelsBackgroundColor) {
setModelsBackgroundColor(settings.modelsBackgroundColor);
document.documentElement.style.setProperty('--models-background-color', settings.modelsBackgroundColor);
}
if (settings.historyBackgroundColor) {
setHistoryBackgroundColor(settings.historyBackgroundColor);
document.documentElement.style.setProperty('--history-background-color', settings.historyBackgroundColor);
}
if (settings.leftPanelBackgroundColor) {
setLeftPanelBackgroundColor(settings.leftPanelBackgroundColor);
document.documentElement.style.setProperty('--left-panel-background-color', settings.leftPanelBackgroundColor);
}
if (settings.conversationBackgroundColor) {
setConversationBackgroundColor(settings.conversationBackgroundColor);
document.documentElement.style.setProperty('--conversation-background-color', settings.conversationBackgroundColor);
}
if (settings.popUpTextColor) {
setPopUpTextColor(settings.popUpTextColor);
document.documentElement.style.setProperty('--pop-up-text', settings.popUpTextColor);
}
if (settings.inputBorderColor) {
setInputBorderColor(settings.inputBorderColor);
document.documentElement.style.setProperty('--input-border-color', settings.inputBorderColor);
}
if (settings.fontFamily) {
setFontFamily(settings.fontFamily);
document.documentElement.style.setProperty('--font-family', settings.fontFamily);
}
if (settings.fontSize) {
setFontSize(settings.fontSize);
document.documentElement.style.setProperty('--font-size', settings.fontSize);
}
if (settings.burgerMenu) {
setBurgerMenu(settings.burgerMenu);
document.documentElement.style.setProperty('--burger-menu-background-color', settings.burgerMenu);
}
// Additional theme settings
if (settings.faqBackgroundColor) {
document.documentElement.style.setProperty('--faq-background-color', settings.faqBackgroundColor);
}
if (settings.faqHeadingColor) {
document.documentElement.style.setProperty('--faq-heading-color', settings.faqHeadingColor);
}
if (settings.faqItemBackgroundColor) {
document.documentElement.style.setProperty('--faq-item-background-color', settings.faqItemBackgroundColor);
}
if (settings.faqItemHeadingColor) {
document.documentElement.style.setProperty('--faq-item-heading-color', settings.faqItemHeadingColor);
}
if (settings.faqItemTextColor) {
document.documentElement.style.setProperty('--faq-item-text-color', settings.faqItemTextColor);
}
if (settings.faqItemHoverBackgroundColor) {
document.documentElement.style.setProperty('--faq-item-hover-background-color', settings.faqItemHoverBackgroundColor);
}
if (settings.popupBackgroundColor) {
document.documentElement.style.setProperty('--popup-background-color', settings.popupBackgroundColor);
}
if (settings.overlayTextColor) {
document.documentElement.style.setProperty('--overlay-text-color', settings.overlayTextColor);
}
};
// Function to handle updating all credentials
const handleUpdateCredentials = async () => { const handleUpdateCredentials = async () => {
// Update account information // Update account information
const newData = { const newData = {
@ -624,23 +466,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
localStorage.setItem("selectedTheme", theme); localStorage.setItem("selectedTheme", theme);
// Apply the appropriate theme based on selection // Apply the appropriate theme based on selection
switch (theme) { applyTheme(theme);
case 'IOMARKET':
applyIOMarketTheme();
break;
case 'WHITE':
applyWhiteTheme();
break;
case 'BLACK':
applyBlackTheme();
break;
case 'CUSTOM':
// Handle custom theme logic here if necessary
break;
default:
applyIOMarketTheme();
break;
}
} }
}} }}
> >
@ -1198,7 +1024,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
const handleImport = (event: React.ChangeEvent<HTMLInputElement>) => { const handleImport = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.files && event.target.files.length > 0) { if (event.target.files && event.target.files.length > 0) {
const file = event.target.files[0]; const file = event.target.files[0];
importSettings(file, applySettings); importSettings(file, applyCustomTheme);
} }
}; };
@ -1272,7 +1098,6 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
{renderSettingsContent()} {renderSettingsContent()}
<button className="close-popup" onClick={closeSettings}>Close</button> <button className="close-popup" onClick={closeSettings}>Close</button>
<button className="apply" onClick={() => { <button className="apply" onClick={() => {
applySettings;
getAllLocalStorageItems(); getAllLocalStorageItems();
closeSettings(); closeSettings();
}}> }}>

View file

@ -1,102 +1,100 @@
// theme.ts
export const applyIOMarketTheme = () => { export const applyIOMarketTheme = () => {
document.documentElement.style.setProperty('--header-background-color', '#7e7e7e'); // Header background color document.documentElement.style.setProperty('--header-background-color', '#7e7e7e');
document.documentElement.style.setProperty('--header-text-color', '#ffffff'); // Header text color document.documentElement.style.setProperty('--header-text-color', '#ffffff');
document.documentElement.style.setProperty('--background-color', '#8B9635'); // Main background color document.documentElement.style.setProperty('--background-color', '#8B9635');
document.documentElement.style.setProperty('--text-color', '#474D22'); // Main text color document.documentElement.style.setProperty('--text-color', '#474D22');
document.documentElement.style.setProperty('--input-background-color', '#ffffff'); // Input fields background document.documentElement.style.setProperty('--input-background-color', '#ffffff');
document.documentElement.style.setProperty('--input-button-color', '#8B9635'); // Button color document.documentElement.style.setProperty('--input-button-color', '#8B9635');
document.documentElement.style.setProperty('--input-button-hover-color', '#6b7c2b'); // Button hover color document.documentElement.style.setProperty('--input-button-hover-color', '#6b7c2b');
document.documentElement.style.setProperty('--user-message-background-color', '#8B9635'); // User messages background document.documentElement.style.setProperty('--user-message-background-color', '#8B9635');
document.documentElement.style.setProperty('--user-message-text-color', '#000'); // User messages text color document.documentElement.style.setProperty('--user-message-text-color', '#000');
document.documentElement.style.setProperty('--ai-message-background-color', '#FCFCEB'); // AI messages background document.documentElement.style.setProperty('--ai-message-background-color', '#FCFCEB');
document.documentElement.style.setProperty('--ai-message-text-color', '#000'); // AI messages text color document.documentElement.style.setProperty('--ai-message-text-color', '#000');
document.documentElement.style.setProperty('--button-background-color', '#8B9635'); // Button background color document.documentElement.style.setProperty('--button-background-color', '#8B9635');
document.documentElement.style.setProperty('--button-hover-background-color', '#6b7c2b'); // Button hover color document.documentElement.style.setProperty('--button-hover-background-color', '#6b7c2b');
document.documentElement.style.setProperty('--models-background-color', '#ffffff'); // Models section background document.documentElement.style.setProperty('--models-background-color', '#ffffff');
document.documentElement.style.setProperty('--history-background-color', '#f9f9f9'); // History background document.documentElement.style.setProperty('--history-background-color', '#f9f9f9');
document.documentElement.style.setProperty('--left-panel-background-color', '#79832e'); // Left panel background document.documentElement.style.setProperty('--left-panel-background-color', '#79832e');
document.documentElement.style.setProperty('--conversation-background-color', '#79832e'); // Conversation container background document.documentElement.style.setProperty('--conversation-background-color', '#79832e');
document.documentElement.style.setProperty('--doc-background-color', '#ffffff'); // Documents background document.documentElement.style.setProperty('--doc-background-color', '#ffffff');
document.documentElement.style.setProperty('--faq-background-color', '#474D22'); // FAQ section background document.documentElement.style.setProperty('--faq-background-color', '#474D22');
document.documentElement.style.setProperty('--faq-heading-color', '#8B9635'); // FAQ heading color document.documentElement.style.setProperty('--faq-heading-color', '#8B9635');
document.documentElement.style.setProperty('--faq-item-background-color', '#fefefe'); // FAQ items background document.documentElement.style.setProperty('--faq-item-background-color', '#fefefe');
document.documentElement.style.setProperty('--faq-item-heading-color', '#474D22'); // FAQ items heading color document.documentElement.style.setProperty('--faq-item-heading-color', '#474D22');
document.documentElement.style.setProperty('--faq-item-text-color', '#333'); // FAQ items text color document.documentElement.style.setProperty('--faq-item-text-color', '#333');
document.documentElement.style.setProperty('--faq-item-hover-background-color', '#e0e0e0'); // FAQ items hover background document.documentElement.style.setProperty('--faq-item-hover-background-color', '#e0e0e0');
document.documentElement.style.setProperty('--pop-up-text', '#000'); // Pop-up text color document.documentElement.style.setProperty('--pop-up-text', '#000');
document.documentElement.style.setProperty('--input-border-color', '#8B9635'); // Input border color document.documentElement.style.setProperty('--input-border-color', '#8B9635');
document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'"); // Font family document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'");
document.documentElement.style.setProperty('--font-size', '16px'); // Font size document.documentElement.style.setProperty('--font-size', '16px');
document.documentElement.style.setProperty('--burger-menu-background-color', '#79832e'); // Font size document.documentElement.style.setProperty('--burger-menu-background-color', '#79832e');
}; };
export const applyWhiteTheme = () => { export const applyWhiteTheme = () => {
document.documentElement.style.setProperty('--header-background-color', '#ffffff'); // White header background document.documentElement.style.setProperty('--header-background-color', '#ffffff');
document.documentElement.style.setProperty('--header-text-color', '#000000'); // Header text color document.documentElement.style.setProperty('--header-text-color', '#000000');
document.documentElement.style.setProperty('--background-color', '#f0f0f0'); // Main background color document.documentElement.style.setProperty('--background-color', '#f0f0f0');
document.documentElement.style.setProperty('--text-color', '#000000'); // Main text color document.documentElement.style.setProperty('--text-color', '#000000');
document.documentElement.style.setProperty('--input-background-color', '#ffffff'); // Input fields background document.documentElement.style.setProperty('--input-background-color', '#ffffff');
document.documentElement.style.setProperty('--input-button-color', '#007bff'); // Button color document.documentElement.style.setProperty('--input-button-color', '#007bff');
document.documentElement.style.setProperty('--input-button-hover-color', '#0056b3'); // Button hover color document.documentElement.style.setProperty('--input-button-hover-color', '#0056b3');
document.documentElement.style.setProperty('--user-message-background-color', '#ffffff'); // User messages background document.documentElement.style.setProperty('--user-message-background-color', '#ffffff');
document.documentElement.style.setProperty('--user-message-text-color', '#000000'); // User messages text color document.documentElement.style.setProperty('--user-message-text-color', '#000000');
document.documentElement.style.setProperty('--ai-message-background-color', '#f9f9f9'); // AI messages background document.documentElement.style.setProperty('--ai-message-background-color', '#f9f9f9');
document.documentElement.style.setProperty('--ai-message-text-color', '#000000'); // AI messages text color document.documentElement.style.setProperty('--ai-message-text-color', '#000000');
document.documentElement.style.setProperty('--button-background-color', '#007bff'); // Button background color document.documentElement.style.setProperty('--button-background-color', '#007bff');
document.documentElement.style.setProperty('--button-hover-background-color', '#0056b3'); // Button hover color document.documentElement.style.setProperty('--button-hover-background-color', '#0056b3');
document.documentElement.style.setProperty('--models-background-color', '#ffffff'); // Models section background document.documentElement.style.setProperty('--models-background-color', '#ffffff');
document.documentElement.style.setProperty('--history-background-color', '#f9f9f9'); // History background document.documentElement.style.setProperty('--history-background-color', '#f9f9f9');
document.documentElement.style.setProperty('--left-panel-background-color', '#ffffff'); // Left panel background document.documentElement.style.setProperty('--left-panel-background-color', '#ffffff');
document.documentElement.style.setProperty('--conversation-background-color', '#ffffff'); // Conversation container background document.documentElement.style.setProperty('--conversation-background-color', '#ffffff');
document.documentElement.style.setProperty('--doc-background-color', '#ffffff'); // Documents background document.documentElement.style.setProperty('--doc-background-color', '#ffffff');
document.documentElement.style.setProperty('--faq-background-color', '#ffffff'); // FAQ section background document.documentElement.style.setProperty('--faq-background-color', '#ffffff');
document.documentElement.style.setProperty('--faq-heading-color', '#007bff'); // FAQ heading color document.documentElement.style.setProperty('--faq-heading-color', '#007bff');
document.documentElement.style.setProperty('--faq-item-background-color', '#f9f9f9'); // FAQ items background document.documentElement.style.setProperty('--faq-item-background-color', '#f9f9f9');
document.documentElement.style.setProperty('--faq-item-heading-color', '#000000'); // FAQ items heading color document.documentElement.style.setProperty('--faq-item-heading-color', '#000000');
document.documentElement.style.setProperty('--faq-item-text-color', '#333333'); // FAQ items text color document.documentElement.style.setProperty('--faq-item-text-color', '#333333');
document.documentElement.style.setProperty('--faq-item-hover-background-color', '#e0e0e0'); // FAQ items hover background document.documentElement.style.setProperty('--faq-item-hover-background-color', '#e0e0e0');
document.documentElement.style.setProperty('--pop-up-text', '#000000'); // Pop-up text color document.documentElement.style.setProperty('--pop-up-text', '#000000');
document.documentElement.style.setProperty('--input-border-color', '#ced4da'); // Input border color document.documentElement.style.setProperty('--input-border-color', '#ced4da');
document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'"); // Font family document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'");
document.documentElement.style.setProperty('--font-size', '16px'); // Font size document.documentElement.style.setProperty('--font-size', '16px');
document.documentElement.style.setProperty('--burger-menu-background-color', '#79832e'); // Font size document.documentElement.style.setProperty('--burger-menu-background-color', '#79832e');
}; };
export const applyBlackTheme = () => { export const applyBlackTheme = () => {
document.documentElement.style.setProperty('--header-background-color', '#1a1a1a'); // Dark header background document.documentElement.style.setProperty('--header-background-color', '#1a1a1a');
document.documentElement.style.setProperty('--header-text-color', '#ffffff'); // Header text color document.documentElement.style.setProperty('--header-text-color', '#ffffff');
document.documentElement.style.setProperty('--background-color', '#121212'); // Main background color document.documentElement.style.setProperty('--background-color', '#121212');
document.documentElement.style.setProperty('--text-color', '#e0e0e0'); // Main text color document.documentElement.style.setProperty('--text-color', '#e0e0e0');
document.documentElement.style.setProperty('--input-background-color', '#1e1e1e'); // Input fields background document.documentElement.style.setProperty('--input-background-color', '#1e1e1e');
document.documentElement.style.setProperty('--input-button-color', '#3c3c3c'); // Button color document.documentElement.style.setProperty('--input-button-color', '#3c3c3c');
document.documentElement.style.setProperty('--input-button-hover-color', '#5a5a5a'); // Button hover color document.documentElement.style.setProperty('--input-button-hover-color', '#5a5a5a');
document.documentElement.style.setProperty('--user-message-background-color', '#000000'); // User messages background document.documentElement.style.setProperty('--user-message-background-color', '#000000');
document.documentElement.style.setProperty('--user-message-text-color', '#ffffff'); // User messages text color document.documentElement.style.setProperty('--user-message-text-color', '#ffffff');
document.documentElement.style.setProperty('--ai-message-background-color', '#202020'); // AI messages background document.documentElement.style.setProperty('--ai-message-background-color', '#202020');
document.documentElement.style.setProperty('--ai-message-text-color', '#ffffff'); // AI messages text color document.documentElement.style.setProperty('--ai-message-text-color', '#ffffff');
document.documentElement.style.setProperty('--button-background-color', '#3c3c3c'); // Button background color document.documentElement.style.setProperty('--button-background-color', '#3c3c3c');
document.documentElement.style.setProperty('--button-hover-background-color', '#5a5a5a'); // Button hover color document.documentElement.style.setProperty('--button-hover-background-color', '#5a5a5a');
document.documentElement.style.setProperty('--models-background-color', '#1e1e1e'); // Models section background document.documentElement.style.setProperty('--models-background-color', '#1e1e1e');
document.documentElement.style.setProperty('--history-background-color', '#1a1a1a'); // History background document.documentElement.style.setProperty('--history-background-color', '#1a1a1a');
document.documentElement.style.setProperty('--left-panel-background-color', '#1e1e1e'); // Left panel background document.documentElement.style.setProperty('--left-panel-background-color', '#1e1e1e');
document.documentElement.style.setProperty('--conversation-background-color', '#2c2c2c'); // Conversation container background document.documentElement.style.setProperty('--conversation-background-color', '#2c2c2c');
document.documentElement.style.setProperty('--doc-background-color', '#1e1e1e'); // Documents background document.documentElement.style.setProperty('--doc-background-color', '#1e1e1e');
document.documentElement.style.setProperty('--faq-background-color', '#2c2c2c'); // FAQ section background document.documentElement.style.setProperty('--faq-background-color', '#2c2c2c');
document.documentElement.style.setProperty('--faq-heading-color', '#ffffff'); // FAQ heading color document.documentElement.style.setProperty('--faq-heading-color', '#ffffff');
document.documentElement.style.setProperty('--faq-item-background-color', '#3c3c3c'); // FAQ items background document.documentElement.style.setProperty('--faq-item-background-color', '#3c3c3c');
document.documentElement.style.setProperty('--faq-item-heading-color', '#ffffff'); // FAQ items heading color document.documentElement.style.setProperty('--faq-item-heading-color', '#ffffff');
document.documentElement.style.setProperty('--faq-item-text-color', '#e0e0e0'); // FAQ items text color document.documentElement.style.setProperty('--faq-item-text-color', '#e0e0e0');
document.documentElement.style.setProperty('--faq-item-hover-background-color', '#5a5a5a'); // FAQ items hover background document.documentElement.style.setProperty('--faq-item-hover-background-color', '#5a5a5a');
document.documentElement.style.setProperty('--pop-up-text', '#ffffff'); // Pop-up text color document.documentElement.style.setProperty('--pop-up-text', '#ffffff');
document.documentElement.style.setProperty('--input-border-color', '#3c3c3c'); // Input border color document.documentElement.style.setProperty('--input-border-color', '#3c3c3c');
document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'"); // Font family document.documentElement.style.setProperty('--font-family', "'Poppins', 'sans-serif'");
document.documentElement.style.setProperty('--font-size', '16px'); // Font size document.documentElement.style.setProperty('--font-size', '16px');
document.documentElement.style.setProperty('--burger-menu-background-color', '# 79832e'); // Font size document.documentElement.style.setProperty('--burger-menu-background-color', '#79832e');
}; };
export const applyCustomTheme = () => { export const applyCustomTheme = () => {
// Theme variables
const themeVariables = { const themeVariables = {
backgroundColor: localStorage.getItem('backgroundColor'), backgroundColor: localStorage.getItem('backgroundColor'),
textColor: localStorage.getItem('textColor'), textColor: localStorage.getItem('textColor'),
@ -113,45 +111,62 @@ export const applyCustomTheme = () => {
historyBackgroundColor: localStorage.getItem('historyBackgroundColor'), historyBackgroundColor: localStorage.getItem('historyBackgroundColor'),
leftPanelBackgroundColor: localStorage.getItem('leftPanelBackgroundColor'), leftPanelBackgroundColor: localStorage.getItem('leftPanelBackgroundColor'),
conversationBackgroundColor: localStorage.getItem('conversationBackgroundColor'), conversationBackgroundColor: localStorage.getItem('conversationBackgroundColor'),
popUpTextColor: localStorage.getItem('popUpTextColor'),
inputBorderColor: localStorage.getItem('inputBorderColor'),
fontFamily: localStorage.getItem('fontFamily'),
fontSize: localStorage.getItem('fontSize'),
burgerMenu: localStorage.getItem('burgerMenu'),
faqBackgroundColor: localStorage.getItem('faqBackgroundColor'), faqBackgroundColor: localStorage.getItem('faqBackgroundColor'),
faqHeadingColor: localStorage.getItem('faqHeadingColor'), faqHeadingColor: localStorage.getItem('faqHeadingColor'),
faqItemBackgroundColor: localStorage.getItem('faqItemBackgroundColor'), faqItemBackgroundColor: localStorage.getItem('faqItemBackgroundColor'),
faqItemHeadingColor: localStorage.getItem('faqItemHeadingColor'), faqItemHeadingColor: localStorage.getItem('faqItemHeadingColor'),
faqItemTextColor: localStorage.getItem('faqItemTextColor'), faqItemTextColor: localStorage.getItem('faqItemTextColor'),
faqItemHoverBackgroundColor: localStorage.getItem('faqItemHoverBackgroundColor'), faqItemHoverBackgroundColor: localStorage.getItem('faqItemHoverBackgroundColor'),
popupBackgroundColor: localStorage.getItem('popupBackgroundColor'), inputBorderColor: localStorage.getItem('inputBorderColor'),
overlayTextColor: localStorage.getItem('overlayTextColor'), fontFamily: localStorage.getItem('fontFamily'),
}; fontSize: localStorage.getItem('fontSize'),
burgerMenu: localStorage.getItem('burgerMenu'),
};
document.documentElement.style.setProperty('--background-color', themeVariables.backgroundColor || '#121212'); // Main background color document.documentElement.style.setProperty('--background-color', themeVariables.backgroundColor || '#121212');
document.documentElement.style.setProperty('--text-color', themeVariables.textColor || '#e0e0e0'); // Main text color document.documentElement.style.setProperty('--text-color', themeVariables.textColor || '#e0e0e0');
document.documentElement.style.setProperty('--input-background-color', themeVariables.inputBackgroundColor || '#1e1e1e'); // Input fields background document.documentElement.style.setProperty('--input-background-color', themeVariables.inputBackgroundColor || '#1e1e1e');
document.documentElement.style.setProperty('--input-button-color', themeVariables.inputButtonColor || '#3c3c3c'); // Button color document.documentElement.style.setProperty('--input-button-color', themeVariables.inputButtonColor || '#3c3c3c');
document.documentElement.style.setProperty('--input-button-hover-color', themeVariables.inputButtonHoverColor || '#5a5a5a'); // Button hover color document.documentElement.style.setProperty('--input-button-hover-color', themeVariables.inputButtonHoverColor || '#5a5a5a');
document.documentElement.style.setProperty('--user-message-background-color', themeVariables.userMessageBackgroundColor || '#000000'); // User messages background document.documentElement.style.setProperty('--user-message-background-color', themeVariables.userMessageBackgroundColor || '#000000');
document.documentElement.style.setProperty('--user-message-text-color', themeVariables.userMessageTextColor || '#ffffff'); // User messages text color document.documentElement.style.setProperty('--user-message-text-color', themeVariables.userMessageTextColor || '#ffffff');
document.documentElement.style.setProperty('--ai-message-background-color', themeVariables.aiMessageBackgroundColor || '#202020'); // AI messages background document.documentElement.style.setProperty('--ai-message-background-color', themeVariables.aiMessageBackgroundColor || '#202020');
document.documentElement.style.setProperty('--ai-message-text-color', themeVariables.aiMessageTextColor || '#ffffff'); // AI messages text color document.documentElement.style.setProperty('--ai-message-text-color', themeVariables.aiMessageTextColor || '#ffffff');
document.documentElement.style.setProperty('--button-background-color', themeVariables.buttonBackgroundColor || '#3c3c3c'); // Button background color document.documentElement.style.setProperty('--button-background-color', themeVariables.buttonBackgroundColor || '#3c3c3c');
document.documentElement.style.setProperty('--button-hover-background-color', themeVariables.buttonHoverBackgroundColor || '#5a5a5a'); // Button hover color document.documentElement.style.setProperty('--button-hover-background-color', themeVariables.buttonHoverBackgroundColor || '#5a5a5a');
document.documentElement.style.setProperty('--models-background-color', themeVariables.modelsBackgroundColor || '#1e1e1e'); // Models section background document.documentElement.style.setProperty('--models-background-color', themeVariables.modelsBackgroundColor || '#1e1e1e');
document.documentElement.style.setProperty('--history-background-color', themeVariables.historyBackgroundColor || '#1a1a1a'); // History background document.documentElement.style.setProperty('--history-background-color', themeVariables.historyBackgroundColor || '#1a1a1a');
document.documentElement.style.setProperty('--left-panel-background-color', themeVariables.leftPanelBackgroundColor || '#1e1e1e'); // Left panel background document.documentElement.style.setProperty('--left-panel-background-color', themeVariables.leftPanelBackgroundColor || '#1e1e1e');
document.documentElement.style.setProperty('--conversation-background-color', themeVariables.conversationBackgroundColor || '#2c2c2c'); // Conversation container background document.documentElement.style.setProperty('--conversation-background-color', themeVariables.conversationBackgroundColor || '#2c2c2c');
document.documentElement.style.setProperty('--faq-background-color', themeVariables.faqBackgroundColor || '#2c2c2c'); // FAQ section background document.documentElement.style.setProperty('--faq-background-color', themeVariables.faqBackgroundColor || '#2c2c2c');
document.documentElement.style.setProperty('--faq-heading-color', themeVariables.faqHeadingColor || '#ffffff'); // FAQ heading color document.documentElement.style.setProperty('--faq-heading-color', themeVariables.faqHeadingColor || '#ffffff');
document.documentElement.style.setProperty('--faq-item-background-color', themeVariables.faqItemBackgroundColor || '#3c3c3c'); // FAQ items background document.documentElement.style.setProperty('--faq-item-background-color', themeVariables.faqItemBackgroundColor || '#3c3c3c');
document.documentElement.style.setProperty('--faq-item-heading-color', themeVariables.faqItemHeadingColor || '#ffffff'); // FAQ items heading color document.documentElement.style.setProperty('--faq-item-heading-color', themeVariables.faqItemHeadingColor || '#ffffff');
document.documentElement.style.setProperty('--faq-item-text-color', themeVariables.faqItemTextColor || '#e0e0e0'); // FAQ items text color document.documentElement.style.setProperty('--faq-item-text-color', themeVariables.faqItemTextColor || '#e0e0e0');
document.documentElement.style.setProperty('--faq-item-hover-background-color', themeVariables.faqItemHoverBackgroundColor || '#5a5a5a'); // FAQ items hover background document.documentElement.style.setProperty('--faq-item-hover-background-color', themeVariables.faqItemHoverBackgroundColor || '#5a5a5a');
document.documentElement.style.setProperty('--input-border-color', themeVariables.inputBorderColor || '#3c3c3c'); // Input border color document.documentElement.style.setProperty('--input-border-color', themeVariables.inputBorderColor || '#3c3c3c');
document.documentElement.style.setProperty('--font-family', themeVariables.fontFamily || "'Poppins', 'sans-serif'"); // Font family document.documentElement.style.setProperty('--font-family', themeVariables.fontFamily || "'Poppins', 'sans-serif'");
document.documentElement.style.setProperty('--font-size', themeVariables.fontSize || '16px'); // Font size document.documentElement.style.setProperty('--font-size', themeVariables.fontSize || '16px');
document.documentElement.style.setProperty('--burger-menu-background-color', themeVariables.burgerMenu || '#79832e'); // Burger menu background color document.documentElement.style.setProperty('--burger-menu-background-color', themeVariables.burgerMenu || '#79832e');
};
} // This is the new function that calls the appropriate theme application
export const applyTheme = (theme: string) => {
switch (theme) {
case 'IOMARKET':
applyIOMarketTheme();
break;
case 'WHITE':
applyWhiteTheme();
break;
case 'BLACK':
applyBlackTheme();
break;
case 'CUSTOM':
// Handle custom theme application here if necessary
break;
default:
applyIOMarketTheme();
break;
}
};