Merge branch 'sageTheDm-main'

This commit is contained in:
Patrick_Pluto 2024-09-20 11:17:28 +02:00
commit e08b8e0783
18 changed files with 16 additions and 14 deletions

15
app/components/AI.tsx Normal file
View file

@ -0,0 +1,15 @@
// AI.tsx
import React from 'react';
import InputOutputBackend from '../backend/InputOutputHandler';
const AI: React.FC = () => {
return (
<div>
<div className="ai-container">
<InputOutputBackend />
</div>
</div>
);
};
export default AI;

View file

@ -0,0 +1,62 @@
import React, { ForwardedRef, useEffect, useRef } from 'react';
type Message = {
role: string
content: string
}
interface ConversationProps {
messages: Message[];
onResendClick: () => void;
onEditClick: () => void;
onCopyClick: () => void;
}
const ConversationFrontend = React.forwardRef<HTMLDivElement, ConversationProps>(
({ messages, onResendClick, onEditClick, onCopyClick }, ref: ForwardedRef<HTMLDivElement>) => {
const endOfMessagesRef = useRef<HTMLDivElement>(null);
// Auto-scroll to the bottom of the conversation whenever a new message is added
useEffect(() => {
if (endOfMessagesRef.current) {
endOfMessagesRef.current.scrollIntoView({ behavior: 'smooth' });
}
}, [messages]); // Triggers the effect whenever the 'messages' array changes
return (
<div className="output">
<div className="conversation resize" id="conversation" ref={ref}>
{messages.map((message, index) => {
let isUserMessage
if (message.role == "user") {
isUserMessage = message
}
return (
<div
key={index}
className={isUserMessage ? 'user-message' : 'ai-message'}
>
<p> {message.content}</p>
</div>
);
})}
{/* Dummy div to mark the end of the conversation for auto-scrolling */}
<div ref={endOfMessagesRef} />
<div className="button-container">
<button type="button" onClick={onResendClick}>
<img src="/img/resend.svg" alt="resend" />
</button>
<button type="button" onClick={onEditClick}>
<img src="/img/edit.svg" alt="edit" />
</button>
<button type="button" onClick={onCopyClick}>
<img src="/img/copy.svg" alt="copy" />
</button>
</div>
</div>
</div>
);
}
);
export default ConversationFrontend;

View file

@ -0,0 +1,124 @@
import React from 'react';
const Documentation = () => {
return (
<div className="documentation-container">
<section id="documentation" className="documentation-section">
<h1 className="title">AI Virtual Assistant - Internship Students 2024</h1>
<h2 className="subtitle">General planning:</h2>
<p className="paragraph">
We are currently in the process of developing a Python application that leverages HTML and CSS to create an intuitive graphical user interface (GUI). This application will integrate multiple AI models through API calls, enabling users to effortlessly switch between different models tailored for specific tasks, such as coding, mathematics, and language processing. A key feature of our design is that the application will be capable of running locally, ensuring that users can access its functionality without the need for an internet connection.
</p>
<p className="paragraph">
Upon receiving our assignment, we initiated the project by outlining a detailed timeline for each task to ensure a structured approach to development. This timeline serves as a roadmap, helping us allocate resources effectively and track our progress. Following this planning phase, Patrick_Pluto took the lead in creating the repository, establishing a centralized location for our codebase. Meanwhile, Yasin and sageTheDM forked the repository to begin their contributions, allowing them to work on specific features and enhancements independently.
</p>
<p className="paragraph">
As we move forward, our focus will be on refining the user experience, optimizing the integration of AI models, and ensuring that the application is robust and user-friendly. We are excited about the potential of this project and are committed to delivering a high-quality application that meets the needs of our users.
</p>
<h2 className="subtitle">Frontend planning:</h2>
<p className="paragraph">
We are committed to designing a visually appealing graphical user interface (GUI) that significantly enhances user experience and engagement. The GUI will prominently feature a chat function, allowing users to interact seamlessly with the AI Assistant. This conversational interface will facilitate easy communication, making it intuitive for users to ask questions and receive responses.
</p>
<p className="paragraph">
To further improve usability, we will incorporate distinct buttons that enable users to switch effortlessly between online and offline modes. This functionality ensures that users can access the AI's capabilities regardless of their internet connectivity, making the application versatile and accommodating to various user environments.
</p>
<p className="paragraph">
Additionally, the interface will provide options for users to select from a range of AI models, each tailored for specific use cases such as coding assistance, mathematical problem-solving, and language translation. This feature empowers users to choose the most suitable AI for their needs, thereby enhancing the overall effectiveness and relevance of the application.
</p>
<p className="paragraph">
We will also prioritize creating an intuitive layout, ensuring that all elements are easily accessible and visually coherent. By focusing on user experience in our design, we aim to make the application not only functional but also enjoyable to use. Our goal is to create a user-friendly environment that encourages exploration and interaction, ultimately leading to a more satisfying and productive experience for all users.
</p>
<h2 className="subtitle">Draw.io:</h2>
<p className="paragraph">Insert your Draw.io diagrams here.</p>
<h2 className="subtitle">Inspiration:</h2>
<p className="paragraph">Describe your inspirations here.</p>
<h2 className="subtitle">First prototype:</h2>
<p className="paragraph">
After prototyping the Website we started working on optimizing the css and html structure, and combining the front and the backend together with each other using Flask. Since we have never once done that once it was more learning by doing than planning that is why we have not planned this step but documented it.
</p>
<h2 className="subtitle">Web APP</h2>
<h3 className="subsection-title">QtWebEngine 5</h3>
<p className="paragraph">
We decided on going with QtWebEngine, because Qt is cross platform, and easy to use. QtWebEngine is basically a slimmed down version of Chromium that runs on the Qt Widget Framework. It looked pretty good, but the browser part is very barebones, so it broke a lot of styling.
</p>
<h3 className="subsection-title">Styling</h3>
<p className="paragraph">
After conducting thorough testing, we discovered that even after performing a browser reset, the web application exhibited a distinct styling compared to the web version. This inconsistency prompted us to undertake a comprehensive overhaul of the entire CSS framework.
</p>
<p className="paragraph">
In our redesign, we focused on enhancing the user experience by implementing custom scrollbars that align with our overall aesthetic. Additionally, we expanded upon our existing design foundation to ensure a more cohesive and visually appealing interface.
</p>
<p className="paragraph">
Our efforts have resulted in a web application that is not only visually consistent across different platforms but also optimized for performance. The revamped web app is designed to be responsive, making it accessible and functional on a wide range of devices, from desktops to tablets and smartphones. This adaptability ensures that users can enjoy a seamless experience, regardless of the device they choose to use.
</p>
<p className="paragraph">
Overall, these improvements reflect our commitment to delivering a high-quality product that meets the diverse needs of our users while maintaining a polished and professional appearance.
</p>
<h2 className="subtitle">Prototype: 17.09.2024</h2>
<p className="paragraph">
Our current prototype operates on a straightforward Python backend, which, while functional, relies heavily on our optimism that it will remain stable and not encounter any critical failures or data loss.
</p>
<p className="paragraph">
The existing chat system is equipped with several key features designed to enhance user interaction. Users can easily resend the AI's response, allowing for quick follow-up questions or clarifications. Additionally, the system provides the ability to edit user messages, ensuring that any mistakes can be corrected without starting the conversation anew.
</p>
<p className="paragraph">
Furthermore, users have the option to copy the AI's responses, facilitating easy sharing or saving of information for future reference. These features aim to create a more flexible and user-friendly experience, allowing for seamless communication and interaction with the AI.
</p>
<p className="paragraph">
While the current setup serves as a solid foundation, we recognize the need for further improvements and enhancements to ensure reliability and robustness as we move forward in the development process.
</p>
<p className="paragraph">
Theoretically there is also voice recognition but let us ignore that for now.
</p>
<h2 className="subtitle">17.09.2024</h2>
<p className="paragraph">
After transitioning to React, we made several significant changes. We renamed our History and Models components to .left-panel, which can now be hidden when not in use. Additionally, with various optimizations through React, weve successfully split the CSS and HTML components into more manageable parts.
</p>
<p className="paragraph">
We also made our first strides towards achieving a fully responsive website. With these changes, we are well on our way to completing the responsive design in the near future.
</p>
<h2 className="subtitle">Backend planning:</h2>
<h3 className="subsection-title">Task:</h3>
<p className="paragraph">
We will develop an extensible backend that enables us to easily swap out different AI models, facilitating the creation of a versatile AI Virtual Assistant. This architecture will allow for seamless integration of new AI technologies as they become available, ensuring that our application remains up-to-date and capable of meeting diverse user needs.
</p>
<p className="paragraph">
The backend will also incorporate advanced features such as speech recognition, allowing users to interact with the AI Assistant through voice commands for a more natural and intuitive experience. Additionally, we will implement functionality to save chat histories, enabling users to revisit previous conversations and maintain continuity in their interactions with the AI.
</p>
<p className="paragraph">
For the AI model, we will utilize Microsoft Phi 3.5, which offers robust capabilities for understanding and generating human-like responses. This choice will enhance the overall performance of the Virtual Assistant, making it a valuable tool for users seeking assistance across various tasks and topics. By combining an extensible backend with powerful AI capabilities, we aim to deliver a comprehensive and user-friendly virtual assistant experience.
</p>
<h2 className="subtitle">Design Philosophy:</h2>
<p className="paragraph">
Our design philosophy is to create one script file per feature. This allows us to possibly reuse certain features in other projects very easily, as we can copy the individual .py files, which all work on their own, except the specific .py file for this project, which is specially tailored towards this AI chatbot.
</p>
<h2 className="subtitle">UML diagrams:</h2>
<p className="paragraph">Insert your UML diagrams here, one picture per diagram.</p>
<h2 className="subtitle">First Prototype:</h2>
<p className="paragraph">
You are able to simply select an AI Model, then type out what you want to ask. This Prototype is already ready to answer questions and detect what language you write in and give the answer in the corresponding language.
</p>
<h2 className="subtitle">Combining back and frontend</h2>
<h3 className="subsection-title">Flask setup</h3>
<p className="paragraph">
The flask setup was relatively quick. We had to adjust all of the file references, and add /static
</p>
</section>
</div>
);
};
export default Documentation;

107
app/components/Faq.tsx Normal file
View file

@ -0,0 +1,107 @@
import React from 'react';
const FAQ: React.FC = () => {
return (
<section id="faq">
<h2>Frequently Asked Questions</h2>
<div className="faq-item">
<h3>What is this AI assistant for?</h3>
<p>This AI assistant helps you with various tasks such as answering questions, generating text, and even helping with code or writing tasks.</p>
</div>
<div className="faq-item">
<h3>How does the AI assistant work?</h3>
<p>The assistant uses machine learning algorithms to understand your input and provide contextually relevant answers or generate content based on the task you've described.</p>
</div>
<div className="faq-item">
<h3>Can I trust the answers given by the AI assistant?</h3>
<p>While the AI strives to give accurate and helpful answers, it is important to verify critical information, especially for complex or sensitive queries.</p>
</div>
<div className="faq-item">
<h3>What kind of questions can I ask?</h3>
<p>You can ask a wide range of questions from simple factual queries to more complex requests like generating creative writing or code snippets.</p>
</div>
<div className="faq-item">
<h3>Is my data secure when using the AI assistant?</h3>
<p>We take privacy seriously. Your data is handled according to our privacy policy, ensuring that any personal information shared is securely processed and not misused.</p>
</div>
<div className="faq-item">
<h3>How can I provide feedback about the AI assistant?</h3>
<p>Feedback can be provided through our feedback form, available on our website. We appreciate your input and use it to improve the AI assistant's performance.</p>
</div>
<div className="faq-item">
<h3>Can I customize the AI assistant's responses?</h3>
<p>Customization options are limited in the current version, but we are working on features that will allow users to tailor responses to better suit their needs.</p>
</div>
<div className="faq-item">
<h3>How frequently is the AI assistant updated?</h3>
<p>The AI assistant is updated regularly to improve its functionality and incorporate new features. Stay tuned to our update logs for information on the latest improvements.</p>
</div>
<div className="faq-item">
<h3>What should I do if the AI assistant is not working properly?</h3>
<p>If you encounter any issues with the AI assistant, please contact our support team for assistance. Provide details about the problem to help us resolve it quickly.</p>
</div>
<div className="faq-item">
<h3>Will the AI assistant be available in multiple languages?</h3>
<p>Yes, the AI assistant is designed to support multiple languages. You can specify your language preference in the settings to receive responses in your chosen language.</p>
</div>
<div className="faq-item">
<h3>How can I integrate the AI assistant into my own application?</h3>
<p>Integration guidelines are available in our developer documentation. Follow the instructions to incorporate the AI assistant into your application via our API.</p>
</div>
<div className="faq-item">
<h3>Is there a mobile version of the AI assistant?</h3>
<p>Currently, the AI assistant is optimized for desktop use. We are working on a mobile version to provide a seamless experience on smartphones and tablets.</p>
</div>
<div className="faq-item">
<h3>Can the AI assistant handle multiple simultaneous conversations?</h3>
<p>Yes, the AI assistant is capable of managing multiple conversations at once, ensuring that each interaction is handled efficiently.</p>
</div>
<div className="faq-item">
<h3>What are the system requirements to use the AI assistant?</h3>
<p>The AI assistant can be accessed through most modern web browsers. Ensure your browser is up-to-date for the best experience.</p>
</div>
<div className="faq-item">
<h3>How can I access previous conversations?</h3>
<p>Previous conversations can be accessed through the chat history feature available in the assistant's interface.</p>
</div>
<div className="faq-item">
<h3>What are the limitations of the current AI assistant?</h3>
<p>The AI assistant may have limitations in understanding highly specialized or nuanced topics. We are continuously working to expand its capabilities.</p>
</div>
<div className="faq-item">
<h3>How do I update my profile or settings?</h3>
<p>Profile and settings updates can be made through the account management section of the application. Ensure you save your changes before exiting.</p>
</div>
<div className="faq-item">
<h3>Can the AI assistant be used offline?</h3>
<p>Currently, the AI assistant requires an internet connection to function. Offline capabilities are being explored for future updates.</p>
</div>
<div className="faq-item">
<h3>Who can I contact for technical support?</h3>
<p>Technical support can be reached through our support contact page on the website. Our team is available to help with any technical issues you may encounter.</p>
</div>
</section>
);
};
export default FAQ;

43
app/components/Header.tsx Normal file
View file

@ -0,0 +1,43 @@
// Header.tsx
import React from 'react';
import Login from './Login';
interface HeaderProps {
onViewChange: (view: 'AI' | 'FAQ' | 'Documentation') => void;
showDivs: boolean;
toggleDivs: () => void;
showHistoryModelsToggle: boolean;
showToggle: boolean; // Add this prop
}
const Header: React.FC<HeaderProps> = ({ onViewChange, showDivs, toggleDivs, showHistoryModelsToggle, showToggle }) => {
return (
<>
<header>
<ul>
<li>
<button onClick={() => onViewChange('AI')} className="header-button header-logo">
<img src="/img/logo.png" alt="logo" className="header-logo" />
</button>
</li>
<li>
<button onClick={() => onViewChange('FAQ')} className="header-button">FAQ</button>
</li>
<li>
<button onClick={() => onViewChange('Documentation')} className="header-button">Documentation</button>
</li>
{showToggle && showHistoryModelsToggle && (
<li>
<button onClick={toggleDivs} className="header-button">
{showDivs ? 'Hide History/Models' : 'Show History/Models'}
</button>
</li>
)}
</ul>
<Login />
</header>
</>
);
};
export default Header;

View file

@ -0,0 +1,20 @@
import React from 'react';
const History: React.FC = () => {
return (
<div className="history-background">
<div className="history">
<ul>
{/* Populate with history items */}
{Array.from({ length: 20 }, (_, index) => (
<li key={index}>
<a href="#">history{index + 1}</a>
</li>
))}
</ul>
</div>
</div>
);
};
export default History;

View file

@ -0,0 +1,46 @@
import React, { useState, ForwardedRef } from 'react';
interface InputProps {
message: string;
onSendClick: (message: string) => void;
onMicClick: () => void;
}
const InputFrontend = React.forwardRef<HTMLDivElement, InputProps>(
({ message, onSendClick, onMicClick }, ref: ForwardedRef<HTMLDivElement>) => {
const [inputValue, setInputValue] = useState('');
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setInputValue(e.target.value);
};
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') {
onSendClick(inputValue); // Call the function passed via props
setInputValue(''); // Optionally clear input after submission
event.preventDefault(); // Prevent default action (e.g., form submission)
}
};
return (
<div className="input" id="inputForm" ref={ref}>
<input
type="text"
name="user_message"
placeholder="Type your message here..."
value={inputValue}
onChange={handleInputChange}
onKeyDown={handleKeyDown}
/>
<button type="button" onClick={() => onSendClick(inputValue)}>
<img src="/img/send.svg" alt="send" />
</button>
<button type="button" onClick={onMicClick}>
<img src="/img/microphone.svg" alt="microphone" />
</button>
</div>
);
}
);
export default InputFrontend;

138
app/components/Login.tsx Normal file
View file

@ -0,0 +1,138 @@
import React, { useState } from 'react';
import Settings from './Settings'; // Import the Settings component
const Login: React.FC = () => {
// State to handle popup visibility
const [showPopup, setShowPopup] = useState(false);
const [showSignInPopup, setShowSignInPopup] = useState(false);
const [isLoggedIn, setIsLoggedIn] = useState(false);
const [showSettingsPopup, setShowSettingsPopup] = useState(false);
// Credentials state
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [accountName, setAccountName] = useState('Pluto'); // Set the account name
// Function to toggle the popup
const togglePopup = () => setShowPopup(!showPopup);
// Function to toggle the sign-in popup
const toggleSignInPopup = () => {
setShowSignInPopup(!showSignInPopup);
setShowPopup(false); // Hide login popup when opening the sign-in popup
};
// Function to handle login
const handleLogin = () => {
if ((email === 'pluto@imareal.planet' || accountName === 'Pluto') && password === 'fuckTheSun1234') {
setIsLoggedIn(true); // Successful login
setShowSignInPopup(false); // Close the sign-in popup
} else {
alert('Incorrect credentials');
}
};
// Function to toggle the settings popup
const toggleSettingsPopup = () => setShowSettingsPopup(!showSettingsPopup);
return (
<div>
{/* Login or Settings Button */}
<div className="login-button">
<button onClick={isLoggedIn ? toggleSettingsPopup : togglePopup}>
{isLoggedIn ? 'Settings' : 'Register'}
</button>
</div>
{/* Conditional rendering of the initial Popup */}
{showPopup && (
<div className="popup-overlay">
<div className="popup-content">
<h2>Register</h2>
{/* Name or Email Input */}
<div>
<input
type="text"
placeholder="Name or Email"
onChange={(e) => setEmail(e.target.value)}
/>
</div>
{/* Password Input (displayed as asterisks) */}
<div>
<input
type="password"
placeholder="Password"
onChange={(e) => setPassword(e.target.value)}
/>
</div>
{/* Create Account and Sign In buttons */}
<div className="popup-footer">
<button onClick={() => alert('Create Account clicked')}>
Create Account
</button>
<p>
Already have an account? Sign in {' '}
<span
style={{ color: 'blue', cursor: 'pointer' }}
onClick={toggleSignInPopup}
>
here
</span>
</p>
</div>
{/* Close Button */}
<button className="close-popup" onClick={togglePopup}>
Close
</button>
</div>
</div>
)}
{/* Conditional rendering of the Sign-In Popup */}
{showSignInPopup && (
<div className="popup-overlay">
<div className="popup-content">
<h2>Sign In</h2>
{/* Name or Email Input */}
<div>
<input
type="text"
placeholder="Name or Email"
onChange={(e) => setEmail(e.target.value)}
/>
</div>
{/* Password Input (displayed as asterisks) */}
<div>
<input
type="password"
placeholder="Password"
onChange={(e) => setPassword(e.target.value)}
/>
</div>
{/* Log In Button */}
<div>
<button className="log-into-account" onClick={handleLogin}>Log In</button>
</div>
{/* Close Button */}
<button className="close-popup" onClick={toggleSignInPopup}>
Close
</button>
</div>
</div>
)}
{/* Conditional rendering of the Settings Popup */}
{showSettingsPopup && <Settings closeSettings={toggleSettingsPopup} accountName={accountName} />}
</div>
);
};
export default Login;

88
app/components/Models.tsx Normal file
View file

@ -0,0 +1,88 @@
// Models.tsx
import React from 'react';
const Models: React.FC = () => {
return (
<div className="model-background">
<div className="models">
<div className="titel">
<h1>Different AI models</h1>
</div>
<form action="">
<div className="grid">
<button className="code-model model-box">
<div className="overlay">
<h3>Code</h3>
<img src="/img/wifi.svg" alt="Wi-Fi" />
</div>
</button>
<button className="math-model model-box">
<div className="overlay">
<h3>Math</h3>
<img src="/img/nowifi.svg" alt="No Wi-Fi" />
</div>
</button>
<button className="language-model model-box">
<div className="overlay">
<h3>Language</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
{/* Example Models */}
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
<button className="default-model model-box">
<div className="overlay">
<h3>Default</h3>
</div>
</button>
</div>
</form>
</div>
</div>
);
};
export default Models;

244
app/components/Settings.tsx Normal file
View file

@ -0,0 +1,244 @@
import React, { useState } from'react';
const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ({ closeSettings, accountName }) => {
const [activeSection, setActiveSection] = useState('general');
const renderSettingsContent = () => {
switch (activeSection) {
case 'general':
return (
<div className="settings-section">
<h2>General Settings</h2>
<div className="settings-option">
<p>Change Language</p>
<select>
<option value="en">English</option>
<option value="es">Spanish</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="it">Italian</option>
<option value="pt">Portuguese</option>
<option value="zh">Chinese</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="ar">Arabic</option>
<option value="ru">Russian</option>
<option value="he">Hebrew</option>
</select>
</div>
<div className="settings-option">
<p>Notifications</p>
<label>
<input type="checkbox" /> Enable notifications
</label>
</div>
<div className="settings-option">
<p>Notification Frequency</p>
<select>
<option value="instant">Instant</option>
<option value="daily">Daily</option>
<option value="weekly">Weekly</option>
<option value="monthly">Monthly</option>
<option value="quarterly">Quarterly</option>
<option value="annually">Annually</option>
</select>
</div>
<div className="settings-option">
<p>Time Zone</p>
<select>
<option value="utc">UTC</option>
<option value="est">EST</option>
<option value="pst">PST</option>
<option value="gmt">GMT</option>
<option value="cst">CST</option>
<option value="mst">MST</option>
<option value="bst">BST</option>
<option value="cest">CEST</option>
</select>
</div>
<div className="settings-option">
<p>Auto-Save</p>
<label>
<input type="checkbox" /> Enable auto-save
</label>
</div>
<div className="settings-option">
<p>Auto-Save Frequency</p>
<select>
<option value="5">Every 5 minutes</option>
<option value="10">Every 10 minutes</option>
<option value="15">Every 15 minutes</option>
<option value="30">Every 30 minutes</option>
<option value="60">Every hour</option>
</select>
</div>
<div className="settings-option">
<p>Default Currency</p>
<select>
<option value="usd">USD</option>
<option value="eur">EUR</option>
<option value="gbp">GBP</option>
<option value="jpy">JPY</option>
<option value="cny">CNY</option>
<option value="aud">AUD</option>
</select>
</div>
<div className="settings-option">
<p>Date Format</p>
<select>
<option value="mm/dd/yyyy">MM/DD/YYYY</option>
<option value="dd/mm/yyyy">DD/MM/YYYY</option>
<option value="yyyy-mm-dd">YYYY-MM-DD</option>
</select>
</div>
<div className="settings-option">
<p>Time Format</p>
<select>
<option value="12-hour">12-hour clock</option>
<option value="24-hour">24-hour clock</option>
</select>
</div>
</div>
);
case 'privacy':
return (
<div className="settings-section">
<h2>Privacy Settings</h2>
<div className="settings-option">
<p>Data Collection</p>
<label>
<input type="checkbox" /> Allow data collection
</label>
</div>
<div className="settings-option">
<p>Location Access</p>
<label>
<input type="checkbox" /> Enable location access
</label>
</div>
<div className="settings-option">
<p>Two-Factor Authentication</p>
<label>
<input type="checkbox" /> Enable 2FA
</label>
</div>
<div className="settings-option">
<p>Data Export</p>
<button>Export Data</button>
</div>
<div className="settings-option">
<p>Cookie Policy</p>
<label>
<input type="checkbox" /> Accept cookie policy
</label>
</div>
<div className="settings-option">
<p>GDPR Compliance</p>
<label>
<input type="checkbox" /> I agree to GDPR terms
</label>
</div>
<div className="settings-option">
<p>CCPA Compliance</p>
<label>
<input type="checkbox" /> I agree to CCPA terms
</label>
</div>
<div className="settings-option">
<p>Biometric Data</p>
<label>
<input type="checkbox" /> Allow biometric data collection
</label>
</div>
</div>
);
case 'theme':
return (
<div className="settings-section">
<h2>Theme Settings</h2>
<div className="settings-option">
<p>Choose Theme Color</p>
<input type="color" />
</div>
<div className="settings-option">
<p>Font Size</p>
<input type="range" min="10" max="30" />
</div>
<div className="settings-option">
<p>Background Pattern</p>
<select>
<option value="solid">Solid</option>
<option value="striped">Striped</option>
<option value="dots">Dotted</option>
<option value="grid">Grid</option>
</select>
</div>
<div className="settings-option">
<p>Font Family</p>
<select>
<option value="arial">Arial</option>
<option value="calibri">Calibri</option>
<option value="helvetica">Helvetica</option>
</select>
</div>
<div className="settings-option">
<p>Button Style</p>
<select>
<option value="flat">Flat</option>
<option value="raised">Raised</option>
<option value="rounded">Rounded</option>
</select>
</div>
</div>
);
case 'account':
return (
<div className="settings-section">
<h2>Account Settings</h2>
<div className="settings-option">
<p>Change Name</p>
<input type="text" placeholder="New Name" />
</div>
<div className="settings-option">
<p>Change Email</p>
<input type="email" placeholder="New Email" />
</div>
<div className="settings-option">
<p>Change Password</p>
<input type="password" placeholder="New Password" />
</div>
<div className="settings-option">
<p>Delete Account</p>
<button>Delete Account</button>
</div>
</div>
);
default:
return null;
}
};
return (
<div className="popup-overlay">
<div className="settings-content">
<div className="settings-container">
<div className="sidebar">
<ul>
<li onClick={() => setActiveSection('general')}>General</li>
<li onClick={() => setActiveSection('privacy')}>Privacy</li>
<li onClick={() => setActiveSection('theme')}>Theme</li>
<li onClick={() => setActiveSection('account')}>Account</li>
</ul>
</div>
<div className="settings-main">
<h2>Settings for {accountName}</h2>
{renderSettingsContent()}
<button className="close-popup" onClick={closeSettings}>Close</button>
</div>
</div>
</div>
</div>
);
};
export default Settings;