From a995c114b678c9a8fc939bafb7ac97e14a68d6f4 Mon Sep 17 00:00:00 2001 From: sageTheDM Date: Mon, 7 Oct 2024 14:55:24 +0200 Subject: [PATCH] minor changes --- app/components/settings/Settings.tsx | 33 +++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/app/components/settings/Settings.tsx b/app/components/settings/Settings.tsx index 874ebe1..23734f2 100644 --- a/app/components/settings/Settings.tsx +++ b/app/components/settings/Settings.tsx @@ -1,3 +1,4 @@ +//#region imports import React, { useState, useEffect } from 'react'; import { applyTheme } from './theme'; import { exportSettings, importSettings } from './settingUtils'; // Import utility functions @@ -34,6 +35,8 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( return false; // Default to false if item is null or empty }; + //#region variables + // Active section const [activeSection, setActiveSection] = useState(() => localStorage.getItem('activeSection') || 'general'); @@ -287,6 +290,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( { value: "'Zilla Slab Highlight', serif", label: 'Zilla Slab Highlight' }, ]; + //#region Start of the code const handleLogout = () => { localStorage.clear(); alert('Successfully logged out!'); @@ -379,10 +383,11 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( } }; - + //#region rendered content // Render settings content based on the active section const renderSettingsContent = () => { switch (activeSection) { + //#region general case 'general': return (
@@ -439,6 +444,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( ); case 'privacy': + //#region privacy return (

Privacy Settings

@@ -465,6 +471,8 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( case 'theme': + //#region theme + //#region Basic return (

Theme Settings

@@ -473,7 +481,6 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( selectedTheme={selectedTheme} setSelectedTheme={setSelectedTheme} /> - {selectedTheme === 'BASIC-CUSTOM' && ( <>

Basic Colors

@@ -508,6 +515,19 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( setValue={setBasicTextColor} cssVariable="" /> + { + setFontFamily(newFont); + document.documentElement.style.setProperty('--font-family', newFont); + }} + options={fontOptions} + /> + )} @@ -543,7 +563,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( )}
); - + //#region custom --> foss case 'foss': return (
@@ -556,7 +576,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
); - + //#region account case 'account': return (
@@ -599,7 +619,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( />
); - + //#region api case 'api': return (
@@ -653,7 +673,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
); - + //#region import export case 'im/export': return (
@@ -707,6 +727,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( URL.revokeObjectURL(url); // Clean up the URL object }; + //#region overall export return (