1
0
Fork 0
freesewing/packages/freesewing.shared/components/workbench/menu/xray/index.js
2022-03-26 18:06:14 +01:00

54 lines
1.7 KiB
JavaScript

import XrayIcon from 'shared/components/icons/xray.js'
import { linkClasses, Chevron } from 'shared/components/navigation/primary.js'
import Log from './log.js'
import Reset from './reset.js'
import Disable from './disable.js'
import List from './list.js'
import { Ul, Details, TopSummary } from 'shared/components/workbench/menu'
import { useTranslation } from 'next-i18next'
const Xray = props => {
const { t } = useTranslation(['app', 'settings'])
return (
<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 />
</>
) : (
<>
<button
className={`grow ${linkClasses} hover:cursor-resize uppercase font-bold text-left`}
onClick={() => props.updateGist(['_state', 'xray', 'enabled'], true)}
>
{t('settings:xray.t')}
</button>
<span className="text-normal text-secondary">
{t('cfp:thingIsDisabled', { thing: t('settings:xray.t') })}
</span>
</>
)
}
</TopSummary>
{props.gist?._state?.xray?.enabled && (
<Ul>
<Disable {...props} />
<Log {...props} />
<Reset {...props} />
{
props.gist?._state?.xray?.parts &&
Object.keys(props.gist._state.xray.parts).map(partName => <List {...props} partName={partName} />)
}
</Ul>
)}
</Details>
)
}
export default Xray