Home / File/ SettingsModalContextToggle.js — react Source File

SettingsModalContextToggle.js — react Source File

Architecture documentation for SettingsModalContextToggle.js, a javascript file in the react codebase. 8 imports, 0 dependents.

File javascript BabelCompiler Validation 8 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  2c88dff5_1ec3_9232_0235_005236b72c3c["SettingsModalContextToggle.js"]
  c590b2f8_e784_4482_1344_3166beeda587["SettingsModalContext.js"]
  2c88dff5_1ec3_9232_0235_005236b72c3c --> c590b2f8_e784_4482_1344_3166beeda587
  f9049b08_60f8_abce_a6a6_153f88447124["Button.js"]
  2c88dff5_1ec3_9232_0235_005236b72c3c --> f9049b08_60f8_abce_a6a6_153f88447124
  f71ee326_17f0_7db4_4178_2763fb1c2ad1["Button"]
  2c88dff5_1ec3_9232_0235_005236b72c3c --> f71ee326_17f0_7db4_4178_2763fb1c2ad1
  9f39024f_b905_9b0f_2fc7_e24785732638["ButtonIcon.js"]
  2c88dff5_1ec3_9232_0235_005236b72c3c --> 9f39024f_b905_9b0f_2fc7_e24785732638
  4690d9c0_cb81_9593_7817_f9e61a49f9e7["ButtonIcon"]
  2c88dff5_1ec3_9232_0235_005236b72c3c --> 4690d9c0_cb81_9593_7817_f9e61a49f9e7
  913bb343_55ea_f1b8_08f5_b75cb0a92b76["context.js"]
  2c88dff5_1ec3_9232_0235_005236b72c3c --> 913bb343_55ea_f1b8_08f5_b75cb0a92b76
  315baf50_1028_51ca_a9c1_679c6a17ed98["hooks.js"]
  2c88dff5_1ec3_9232_0235_005236b72c3c --> 315baf50_1028_51ca_a9c1_679c6a17ed98
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  2c88dff5_1ec3_9232_0235_005236b72c3c --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style 2c88dff5_1ec3_9232_0235_005236b72c3c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import * as React from 'react';
import {useCallback, useContext, useMemo} from 'react';
import {SettingsModalContext} from './SettingsModalContext';
import Button from '../Button';
import ButtonIcon from '../ButtonIcon';
import {StoreContext} from '../context';
import {useSubscription} from '../hooks';

export default function SettingsModalContextToggle(): React.Node {
  const {setIsModalShowing} = useContext(SettingsModalContext);
  const store = useContext(StoreContext);
  const {profilerStore} = store;

  const showFilterModal = useCallback(
    () => setIsModalShowing(true),
    [setIsModalShowing],
  );

  // Updating preferences while profiling is in progress could break things (e.g. filtering)
  // Explicitly disallow it for now.
  const isProfilingSubscription = useMemo(
    () => ({
      getCurrentValue: () => profilerStore.isProfilingBasedOnUserInput,
      subscribe: (callback: Function) => {
        profilerStore.addListener('isProfiling', callback);
        return () => profilerStore.removeListener('isProfiling', callback);
      },
    }),
    [profilerStore],
  );
  const isProfiling = useSubscription<boolean>(isProfilingSubscription);

  return (
    <Button
      disabled={isProfiling}
      onClick={showFilterModal}
      title="View settings">
      <ButtonIcon type="settings" />
    </Button>
  );
}

Domain

Subdomains

Frequently Asked Questions

What does SettingsModalContextToggle.js do?
SettingsModalContextToggle.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in SettingsModalContextToggle.js?
SettingsModalContextToggle.js defines 1 function(s): SettingsModalContextToggle.
What does SettingsModalContextToggle.js depend on?
SettingsModalContextToggle.js imports 8 module(s): Button, Button.js, ButtonIcon, ButtonIcon.js, SettingsModalContext.js, context.js, hooks.js, react.
Where is SettingsModalContextToggle.js in the architecture?
SettingsModalContextToggle.js is located at packages/react-devtools-shared/src/devtools/views/Settings/SettingsModalContextToggle.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Settings).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free