import { __ } from '@wordpress/i18n';
import type { JSX } from 'react';
import type { Settings } from '../../shared/api/types/settings';
import { Icon } from '../../shared/ui/Icon';
import { Switch } from '../../shared/ui/Switch';
import {
QUIET_HOURS_WINDOWS,
quietHoursSwitchedText,
windowChangedText,
windowLabel,
windowOf,
windowValue,
} from './quietHoursWindows';
import { useSaveSettings } from './useSaveSettings';
export function QuietHours( {
quietHours,
}: {
quietHours: Settings[ 'quiet_hours' ];
} ): JSX.Element {
const saveSettings = useSaveSettings();
return (
{ __(
'The full check waits for the night, when few visitors are on your site.',
'aiplaz-link-checkup'
) }
{
const isEnabled = event.target.checked;
saveSettings(
{ quiet_hours: { enabled: isEnabled } },
quietHoursSwitchedText( isEnabled )
);
} }
/>
);
}