2022-01-29 14:51:13 +01:00
|
|
|
import XrayIcon from 'shared/components/icons/xray.js'
|
|
|
|
import { linkClasses, Chevron } from 'shared/components/navigation/primary.js'
|
2022-03-25 15:18:37 +01:00
|
|
|
import Log from './log.js'
|
2022-01-29 14:54:22 +01:00
|
|
|
import Reset from './reset.js'
|
2022-01-29 14:51:13 +01:00
|
|
|
import Disable from './disable.js'
|
|
|
|
import List from './list.js'
|
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
|
|
|
|
|
|
|
const Xray = 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 />}>
|
2022-02-20 19:02:25 +01:00
|
|
|
{props.gist?._state?.xray?.enabled
|
2022-01-29 14:51:13 +01:00
|
|
|
? (
|
|
|
|
<>
|
|
|
|
<span className={`grow ${linkClasses} hover:cursor-resize font-bold uppercase`}>
|
2022-02-10 21:40:19 +01:00
|
|
|
{t('settings:xray.t')}
|
2022-01-29 14:51:13 +01:00
|
|
|
</span>
|
|
|
|
<Chevron />
|
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
<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>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
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>
|
2022-01-29 14:51:13 +01:00
|
|
|
<Disable {...props} />
|
2022-03-25 15:18:37 +01:00
|
|
|
<Log {...props} />
|
2022-01-29 14:54:22 +01:00
|
|
|
<Reset {...props} />
|
2022-01-29 14:51:13 +01:00
|
|
|
{
|
2022-02-20 19:02:25 +01:00
|
|
|
props.gist?._state?.xray?.parts &&
|
2022-03-13 08:48:21 +01:00
|
|
|
Object.keys(props.gist._state.xray.parts).map(partName => <List {...props} partName={partName} />)
|
2022-01-29 14:51:13 +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
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Xray
|