radio selection still broken will come back to that later

This commit is contained in:
sageTheDM 2024-10-03 14:38:56 +02:00
parent d0ebe2d79a
commit 7c77e43be8
2 changed files with 29 additions and 10 deletions

View file

@ -1,5 +1,4 @@
// PrivacySettings.tsx
import React from 'react';
import React, { useEffect } from 'react';
interface PrivacySettingsProps {
selectedOption: string; // The currently selected option
@ -8,24 +7,37 @@ interface PrivacySettingsProps {
}
const PrivacySettings: React.FC<PrivacySettingsProps> = ({ selectedOption, handleRadioChange, openSourceMode }) => {
// Set default option based on openSourceMode if no option is selected
useEffect(() => {
if (!selectedOption) {
handleRadioChange(openSourceMode ? 'Offline' : 'None');
}
}, [selectedOption, handleRadioChange, openSourceMode]);
// Handle option click and allow all options, even in open-source mode
const handleOptionClick = (option: string) => {
handleRadioChange(option); // No restrictions on options
};
return (
<>
{/* AI Mode Radio Options */}
<div className="settings-option">
<p>Disable Options:</p>
<p>{openSourceMode ? 'Disable Options (FOSS Mode):' : 'Disable Options:'}</p>
<div className="slider">
{/* Offline */}
<div
className={`slider-option ${selectedOption === 'Offline' ? 'active' : ''}`}
onClick={() => handleRadioChange('Offline')} // Allow selection only if not in open-source mode
onClick={() => handleOptionClick('Offline')}
>
Offline tools{openSourceMode ? ' (FOSS)' : ''}
</div>
{/* Online */}
{/* Online (Available even in FOSS mode) */}
<div
className={`slider-option ${selectedOption === 'Online' ? 'active' : ''}`}
onClick={() => handleRadioChange('Online')}
onClick={() => handleOptionClick('Online')}
>
Online tools{openSourceMode ? ' (FOSS)' : ''}
</div>
@ -33,7 +45,7 @@ const PrivacySettings: React.FC<PrivacySettingsProps> = ({ selectedOption, handl
{/* None */}
<div
className={`slider-option ${selectedOption === 'None' ? 'active' : ''}`}
onClick={() => handleRadioChange('None')}
onClick={() => handleOptionClick('None')}
>
None{openSourceMode ? ' (FOSS)' : ''}
</div>