addons/isl/src/debug/DebugToolsButton.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import {Button} from 'isl-components/Button';
b69ab319import {Icon} from 'isl-components/Icon';
b69ab3110import {Tooltip} from 'isl-components/Tooltip';
b69ab3111import {useAtomValue} from 'jotai';
b69ab3112import {lazy, Suspense} from 'react';
b69ab3113import {t} from '../i18n';
b69ab3114import {debugToolsEnabledState} from './DebugToolsState';
b69ab3115
b69ab3116const DebugToolsMenu = lazy(() => import('./DebugToolsMenu'));
b69ab3117
b69ab3118export function DebugToolsButton() {
b69ab3119 const debugEnabled = useAtomValue(debugToolsEnabledState);
b69ab3120 if (!debugEnabled) {
b69ab3121 return null;
b69ab3122 }
b69ab3123 return (
b69ab3124 <Tooltip
b69ab3125 component={dismiss => (
b69ab3126 <Suspense fallback={<Icon icon="loading" />}>
b69ab3127 <DebugToolsMenu dismiss={dismiss} />
b69ab3128 </Suspense>
b69ab3129 )}
b69ab3130 title={t('Debug Tools')}
b69ab3131 trigger="click"
b69ab3132 group="topbar"
b69ab3133 placement="bottom">
b69ab3134 <Button icon>
b69ab3135 <Icon icon="pulse" />
b69ab3136 </Button>
b69ab3137 </Tooltip>
b69ab3138 );
b69ab3139}