2023-01-28 19:27:11 +01:00
|
|
|
import { XrayIcon } from 'shared/components/icons.mjs'
|
2023-02-05 17:59:22 +01:00
|
|
|
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'
|
2022-01-29 18:24:36 +01:00
|
|
|
import { Ul, Details, TopSummary } from 'shared/components/workbench/menu'
|
2022-02-08 20:49:19 +01:00
|
|
|
import { useTranslation } from 'next-i18next'
|
2022-01-29 14:51:13 +01:00
|
|
|
|
2023-02-05 17:59:22 +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 />}>
|
2023-01-28 19:27:11 +01:00
|
|
|
{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`}
|
2022-02-20 19:02:25 +01:00
|
|
|
onClick={() => props.updateGist(['_state', 'xray', 'enabled'], true)}
|
2022-01-29 14:51:13 +01:00
|
|
|
>
|
2022-02-10 21:40:19 +01:00
|
|
|
{t('settings:xray.t')}
|
2022-01-29 14:51:13 +01:00
|
|
|
</button>
|
|
|
|
<span className="text-normal text-secondary">
|
2022-02-10 21:40:19 +01:00
|
|
|
{t('cfp:thingIsDisabled', { thing: t('settings:xray.t') })}
|
2022-01-29 14:51:13 +01:00
|
|
|
</span>
|
2023-01-28 19:27:11 +01:00
|
|
|
</>
|
|
|
|
)}
|
2022-01-29 18:24:36 +01:00
|
|
|
</TopSummary>
|
2022-02-20 19:02:25 +01:00
|
|
|
{props.gist?._state?.xray?.enabled && (
|
2022-01-29 18:24:36 +01:00
|
|
|
<Ul>
|
2023-02-05 17:59:22 +01:00
|
|
|
<XrayDisable {...props} />
|
|
|
|
<ConsoleLog {...props} />
|
|
|
|
<XrayReset {...props} />
|
2023-01-28 19:27:11 +01:00
|
|
|
{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} />
|
2023-01-28 19:27:11 +01:00
|
|
|
))}
|
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
|
|
|
)
|
|
|
|
}
|