1
0
Fork 0
freesewing/sites/shared/components/workbench/menus/xray/index.mjs

51 lines
1.7 KiB
JavaScript
Raw Normal View History

import { XrayIcon } from 'shared/components/icons.mjs'
import { linkClasses, Chevron } from 'shared/components/navigation/primary.mjs'
import { ConsoleLog } from './log.mjs'
import { XrayReset } from './reset.mjs'
import { XrayDisable } from './disable.mjs'
import { XrayList } from './list.mjs'
2023-05-11 19:14:48 +02:00
import { Ul, Details, TopSummary } from 'shared/components/workbench/menus/index.mjs'
2022-02-08 20:49:19 +01:00
import { useTranslation } from 'next-i18next'
2022-01-29 14:51:13 +01:00
export const XrayMenu = (props) => {
2022-02-08 20:49:19 +01:00
const { t } = useTranslation(['app', 'settings'])
2022-01-29 14:51:13 +01:00
return (
2022-01-29 18:24:36 +01:00
<Details open>
<TopSummary icon={<XrayIcon />}>
{props.gist?._state?.xray?.enabled ? (
<>
<span className={`grow ${linkClasses} hover:cursor-resize font-bold uppercase`}>
{t('settings:xray.t')}
</span>
<Chevron />
</>
) : (
<>
2022-01-29 14:51:13 +01:00
<button
className={`grow ${linkClasses} hover:cursor-resize uppercase font-bold text-left`}
onClick={() => props.updateGist(['_state', 'xray', 'enabled'], true)}
2022-01-29 14:51:13 +01:00
>
{t('settings:xray.t')}
2022-01-29 14:51:13 +01:00
</button>
<span className="text-normal text-secondary">
{t('cfp:thingIsDisabled', { thing: t('settings:xray.t') })}
2022-01-29 14:51:13 +01:00
</span>
</>
)}
2022-01-29 18:24:36 +01:00
</TopSummary>
{props.gist?._state?.xray?.enabled && (
2022-01-29 18:24:36 +01:00
<Ul>
<XrayDisable {...props} />
<ConsoleLog {...props} />
<XrayReset {...props} />
{props.gist?._state?.xray?.parts &&
Object.keys(props.gist._state.xray.parts).map((partName) => (
2023-02-05 19:58:25 +01:00
<XrayList {...props} partName={partName} key={partName} />
))}
2022-01-29 18:24:36 +01:00
</Ul>
2022-01-29 14:51:13 +01:00
)}
2022-01-29 18:24:36 +01:00
</Details>
2022-01-29 14:51:13 +01:00
)
}