2023-09-29 16:01:27 +02:00
|
|
|
// __SDEFILE__ - This file is a dependency for the stand-alone environment
|
2023-09-09 17:58:44 +02:00
|
|
|
import { loadSettingsConfig as loadUiSettingsConfig } from 'shared/components/workbench/menus/ui-settings/config.mjs'
|
2023-05-13 19:58:50 +02:00
|
|
|
import {
|
|
|
|
DesignOptions,
|
|
|
|
ns as designMenuNs,
|
|
|
|
} from 'shared/components/workbench/menus/design-options/index.mjs'
|
2023-05-13 14:17:47 +02:00
|
|
|
import {
|
|
|
|
CoreSettings,
|
|
|
|
ns as coreMenuNs,
|
|
|
|
} from 'shared/components/workbench/menus/core-settings/index.mjs'
|
2023-05-31 17:56:58 +02:00
|
|
|
import { UiSettings, ns as uiNs } from 'shared/components/workbench/menus/ui-settings/index.mjs'
|
2023-08-27 16:24:18 +02:00
|
|
|
import { useTranslation } from 'next-i18next'
|
2023-09-15 18:05:36 +02:00
|
|
|
import { patternNsFromPatternConfig, nsMerge } from 'shared/utils.mjs'
|
2023-09-10 11:08:31 +02:00
|
|
|
import { SettingsIcon, OptionsIcon, DesktopIcon } from 'shared/components/icons.mjs'
|
2023-08-27 16:24:18 +02:00
|
|
|
import { Accordion } from 'shared/components/accordion.mjs'
|
2023-09-09 15:31:53 +02:00
|
|
|
import {
|
|
|
|
FlagsAccordionTitle,
|
|
|
|
FlagsAccordionEntries,
|
|
|
|
} from 'shared/components/workbench/views/flags.mjs'
|
2023-09-27 15:42:42 +02:00
|
|
|
import { collection } from 'site/hooks/use-design.mjs'
|
2023-05-11 19:14:48 +02:00
|
|
|
|
2023-09-15 18:05:36 +02:00
|
|
|
export const ns = nsMerge(coreMenuNs, designMenuNs, uiNs, collection)
|
2023-05-13 14:17:47 +02:00
|
|
|
|
2023-06-23 17:45:50 -05:00
|
|
|
export const DraftMenu = ({
|
|
|
|
design,
|
|
|
|
patternConfig,
|
2023-08-27 17:01:58 +02:00
|
|
|
//setSettings,
|
2023-06-23 17:45:50 -05:00
|
|
|
settings,
|
|
|
|
ui,
|
|
|
|
update,
|
|
|
|
language,
|
|
|
|
account,
|
|
|
|
DynamicDocs,
|
|
|
|
view,
|
|
|
|
setView,
|
2023-09-09 15:31:53 +02:00
|
|
|
flags = false,
|
2023-06-23 17:45:50 -05:00
|
|
|
}) => {
|
2023-09-15 18:05:36 +02:00
|
|
|
const { t } = useTranslation(nsMerge(ns, patternNsFromPatternConfig(patternConfig)))
|
2023-06-23 17:45:50 -05:00
|
|
|
const control = account.control
|
|
|
|
const menuProps = {
|
|
|
|
design,
|
|
|
|
patternConfig,
|
|
|
|
settings,
|
|
|
|
update,
|
|
|
|
language,
|
|
|
|
account,
|
|
|
|
DynamicDocs,
|
|
|
|
control,
|
|
|
|
}
|
2023-09-09 17:58:44 +02:00
|
|
|
const uiSettingsConfig = loadUiSettingsConfig()
|
2023-06-23 14:29:09 -05:00
|
|
|
|
2023-08-27 16:24:18 +02:00
|
|
|
const sections = [
|
|
|
|
{
|
|
|
|
name: 'designOptions',
|
|
|
|
ns: 'design-options',
|
|
|
|
icon: <OptionsIcon className="w-8 h-8" />,
|
|
|
|
menu: <DesignOptions {...menuProps} />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'coreSettings',
|
|
|
|
ns: 'core-settings',
|
|
|
|
icon: <SettingsIcon className="w-8 h-8" />,
|
|
|
|
menu: <CoreSettings {...menuProps} />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'uiSettings',
|
|
|
|
ns: 'ui-settings',
|
|
|
|
icon: <DesktopIcon className="w-8 h-8" />,
|
|
|
|
menu: <UiSettings {...menuProps} {...{ ui, view, setView }} />,
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2023-09-09 15:31:53 +02:00
|
|
|
const items = []
|
2023-09-09 17:58:44 +02:00
|
|
|
if (control >= uiSettingsConfig.kiosk.control && flags)
|
2023-09-09 15:31:53 +02:00
|
|
|
items.push([
|
2023-09-10 11:08:31 +02:00
|
|
|
<FlagsAccordionTitle flags={flags} key={1} />,
|
|
|
|
<FlagsAccordionEntries {...{ update, control, flags }} key={2} />,
|
2023-09-09 15:31:53 +02:00
|
|
|
])
|
|
|
|
items.push(
|
|
|
|
...sections.map((section) => [
|
|
|
|
<>
|
|
|
|
<h5 className="flex flex-row gap-2 items-center justify-between w-full">
|
|
|
|
<span>{t(`${section.ns}:${section.name}.t`)}</span>
|
|
|
|
{section.icon}
|
|
|
|
</h5>
|
|
|
|
<p className="text-left">{t(`${section.ns}:${section.name}.d`)}</p>
|
|
|
|
</>,
|
|
|
|
section.menu,
|
|
|
|
])
|
2023-05-31 15:32:54 +02:00
|
|
|
)
|
2023-09-09 15:31:53 +02:00
|
|
|
|
|
|
|
return <Accordion items={items} />
|
2023-05-31 15:32:54 +02:00
|
|
|
}
|