import React from 'react'; import usePopover from '@/_hooks/use-popover'; import { SketchPicker } from 'react-color'; import { Confirm } from '../Viewer/Confirm'; import { LeftSidebarItem } from './SidebarItem'; export const LeftSidebarGlobalSettings = ({ globalSettings, globalSettingsChanged, darkMode, toggleAppMaintenance, is_maintenance_on, }) => { const [open, trigger, content] = usePopover(false); const { hideHeader, canvasMaxWidth, canvasMaxHeight, canvasBackgroundColor } = globalSettings; const [showPicker, setShowPicker] = React.useState(false); const [showConfirmation, setConfirmationShow] = React.useState(false); const coverStyles = { position: 'fixed', top: '0px', right: '0px', bottom: '0px', left: '0px', }; return ( <> toggleAppMaintenance()} onCancel={() => setConfirmationShow(false)} darkMode={darkMode} />
Hide header for launched apps
globalSettingsChanged('hideHeader', e.target.checked)} />
Maintenance mode
setConfirmationShow(true)} />
Max width of canvas
{ globalSettingsChanged('canvasMaxWidth', e.target.value); }} value={canvasMaxWidth} /> px
Max height of canvas
{ const height = e.target.value; if (!Number.isNaN(height) && height <= 2400) globalSettingsChanged('canvasMaxHeight', height); }} value={canvasMaxHeight} /> px
Background color of canvas
{showPicker && (
setShowPicker(false)} /> setShowPicker(true)} color={canvasBackgroundColor} onChangeComplete={(color) => globalSettingsChanged('canvasBackgroundColor', color.hex)} />
)}
setShowPicker(true)} >
{canvasBackgroundColor}
); };