1.0 KB40 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import {Button} from 'isl-components/Button';
9import {Icon} from 'isl-components/Icon';
10import {Tooltip} from 'isl-components/Tooltip';
11import {useAtomValue} from 'jotai';
12import {lazy, Suspense} from 'react';
13import {t} from '../i18n';
14import {debugToolsEnabledState} from './DebugToolsState';
15
16const DebugToolsMenu = lazy(() => import('./DebugToolsMenu'));
17
18export function DebugToolsButton() {
19 const debugEnabled = useAtomValue(debugToolsEnabledState);
20 if (!debugEnabled) {
21 return null;
22 }
23 return (
24 <Tooltip
25 component={dismiss => (
26 <Suspense fallback={<Icon icon="loading" />}>
27 <DebugToolsMenu dismiss={dismiss} />
28 </Suspense>
29 )}
30 title={t('Debug Tools')}
31 trigger="click"
32 group="topbar"
33 placement="bottom">
34 <Button icon>
35 <Icon icon="pulse" />
36 </Button>
37 </Tooltip>
38 );
39}
40