OpenSourceToggle comments

This commit is contained in:
sageTheDM 2024-10-11 09:31:07 +02:00
parent 461c469289
commit bc6b7f8481

View file

@ -12,25 +12,26 @@ const OpenSourceModeToggle: React.FC<OpenSourceModeToggleProps> = ({
setOpenSourceMode,
setSelectedOption
}) => {
// Handle toggle change event
const handleToggleChange = () => {
const newValue = !openSourceMode;
setOpenSourceMode(newValue);
const newValue = !openSourceMode; // Toggle the current state
setOpenSourceMode(newValue); // Update the open source mode state
// Update radio selection based on the new openSourceMode value
if (newValue) {
setSelectedOption('FOSS'); // Set to FOSS if enabling open source mode
} else {
setSelectedOption('None'); // Or any other default value when disabling
setSelectedOption('None'); // Set to a default value when disabling
}
};
return (
<div className="settings-option">
<div className="settings-option"> {/* Container for the toggle setting */}
<label>
<input
type="checkbox"
checked={openSourceMode}
onChange={handleToggleChange}
type="checkbox" // Checkbox for toggling open source mode
checked={openSourceMode} // Check if the mode is currently enabled
onChange={handleToggleChange} // Handle changes to the checkbox
/>
Enable Open Source Mode
</label>