Home / File/ GeneralSettings.js — react Source File

GeneralSettings.js — react Source File

Architecture documentation for GeneralSettings.js, a javascript file in the react codebase. 12 imports, 1 dependents.

File javascript BabelCompiler Validation 12 imports 1 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  ba1321bc_42b8_c6c2_e944_8928bf07c59a["GeneralSettings.js"]
  5996f1e4_af81_a51b_84bc_175bfba4f818["SettingsContext.js"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> 5996f1e4_af81_a51b_84bc_175bfba4f818
  913bb343_55ea_f1b8_08f5_b75cb0a92b76["context.js"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> 913bb343_55ea_f1b8_08f5_b75cb0a92b76
  3c0f989f_424c_e338_72c3_e8bc259ca04f["SettingsShared.css"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> 3c0f989f_424c_e338_72c3_e8bc259ca04f
  3360bd40_244b_03ad_208a_10c8b4341347["CodeEditorOptions.js"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> 3360bd40_244b_03ad_208a_10c8b4341347
  09ea2535_a107_bb02_d62f_c47ef5914da8["CodeEditorOptions"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> 09ea2535_a107_bb02_d62f_c47ef5914da8
  d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0["CodeEditorByDefault.js"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> d31d8c6c_50ef_6d6a_4682_cdf66edc0ca0
  d2be5ba0_2c7d_bbe3_e84c_f71455803f2b["CodeEditorByDefault"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> d2be5ba0_2c7d_bbe3_e84c_f71455803f2b
  bcb71f5e_1ecf_5620_9a9e_55d6ab61dd1f["constants.js"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> bcb71f5e_1ecf_5620_9a9e_55d6ab61dd1f
  315baf50_1028_51ca_a9c1_679c6a17ed98["hooks.js"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> 315baf50_1028_51ca_a9c1_679c6a17ed98
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  5e586213_f9d4_ea00_b68f_3bb5d6133eb4["constants"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> 5e586213_f9d4_ea00_b68f_3bb5d6133eb4
  ae1017d8_c18a_3ecd_18f4_bf7a64bbd91a["react-devtools-feature-flags"]
  ba1321bc_42b8_c6c2_e944_8928bf07c59a --> ae1017d8_c18a_3ecd_18f4_bf7a64bbd91a
  33c9bb39_5afe_7433_b39c_5c97384e3323["SettingsModal.js"]
  33c9bb39_5afe_7433_b39c_5c97384e3323 --> ba1321bc_42b8_c6c2_e944_8928bf07c59a
  style ba1321bc_42b8_c6c2_e944_8928bf07c59a 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 {useContext, useMemo} from 'react';
import {SettingsContext} from './SettingsContext';
import {StoreContext} from '../context';
import {CHANGE_LOG_URL} from 'react-devtools-shared/src/devtools/constants';
import {isInternalFacebookBuild} from 'react-devtools-feature-flags';

import styles from './SettingsShared.css';

import CodeEditorOptions from './CodeEditorOptions';
import CodeEditorByDefault from './CodeEditorByDefault';
import {LOCAL_STORAGE_ALWAYS_OPEN_IN_EDITOR} from '../../../constants';
import {useLocalStorage} from '../hooks';

function getChangeLogUrl(version: ?string): string | null {
  if (!version) {
    return null;
  }

  // Version numbers are in the format of: <major>.<minor>.<patch>-<sha>
  // e.g. "4.23.0-f0dd459e0"
  // GitHub CHANGELOG headers are in the format of: <major>.<minor>.<patch>
  // but the "." are stripped from anchor tags, becomming: <major><minor><patch>
  const versionAnchor = version.replace(/^(\d+)\.(\d+)\.(\d+).*/, '$1$2$3');
  return `${CHANGE_LOG_URL}#${versionAnchor}`;
}

export default function GeneralSettings(_: {}): React.Node {
  const {
    displayDensity,
    setDisplayDensity,
    setTheme,
    setTraceUpdatesEnabled,
    theme,
    traceUpdatesEnabled,
  } = useContext(SettingsContext);

  const {backendVersion, supportsTraceUpdates} = useContext(StoreContext);
  const frontendVersion = process.env.DEVTOOLS_VERSION;

  const showBackendVersion =
    backendVersion && backendVersion !== frontendVersion;

  const [alwaysOpenInEditor] = useLocalStorage<boolean>(
    LOCAL_STORAGE_ALWAYS_OPEN_IN_EDITOR,
    false,
  );

  return (
    <div className={styles.SettingList}>
      {isInternalFacebookBuild && (
// ... (112 more lines)

Domain

Subdomains

Frequently Asked Questions

What does GeneralSettings.js do?
GeneralSettings.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 GeneralSettings.js?
GeneralSettings.js defines 3 function(s): GeneralSettings, Version, getChangeLogUrl.
What does GeneralSettings.js depend on?
GeneralSettings.js imports 12 module(s): CodeEditorByDefault, CodeEditorByDefault.js, CodeEditorOptions, CodeEditorOptions.js, SettingsContext.js, SettingsShared.css, constants, constants.js, and 4 more.
What files import GeneralSettings.js?
GeneralSettings.js is imported by 1 file(s): SettingsModal.js.
Where is GeneralSettings.js in the architecture?
GeneralSettings.js is located at packages/react-devtools-shared/src/devtools/views/Settings/GeneralSettings.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