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