Home / File/ OwnerView.js — react Source File

OwnerView.js — react Source File

Architecture documentation for OwnerView.js, a javascript file in the react codebase. 9 imports, 2 dependents.

File javascript BabelCompiler Validation 9 imports 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  fd1ac927_00ef_d34e_8747_a00d62b71152["OwnerView.js"]
  2d59b0f9_9ad6_da4d_0264_d98f193ab3fd["TreeContext.js"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> 2d59b0f9_9ad6_da4d_0264_d98f193ab3fd
  f9049b08_60f8_abce_a6a6_153f88447124["Button.js"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> f9049b08_60f8_abce_a6a6_153f88447124
  f71ee326_17f0_7db4_4178_2763fb1c2ad1["Button"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> f71ee326_17f0_7db4_4178_2763fb1c2ad1
  25e89372_6558_2e4a_04f5_2e343e42cde5["ElementBadges.js"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> 25e89372_6558_2e4a_04f5_2e343e42cde5
  dcddba19_583a_b531_9a4f_941e70dcbf0a["ElementBadges"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> dcddba19_583a_b531_9a4f_941e70dcbf0a
  315baf50_1028_51ca_a9c1_679c6a17ed98["hooks.js"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> 315baf50_1028_51ca_a9c1_679c6a17ed98
  bd2a1a16_698e_77b7_cf2c_8c0895659e55["OwnerView.css"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> bd2a1a16_698e_77b7_cf2c_8c0895659e55
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  2b832bf7_5b5b_7f08_2faa_1e7c8d8acc6d["Logger"]
  fd1ac927_00ef_d34e_8747_a00d62b71152 --> 2b832bf7_5b5b_7f08_2faa_1e7c8d8acc6d
  72d570aa_3875_3688_0200_4617e04d04ed["InspectedElementSuspendedBy.js"]
  72d570aa_3875_3688_0200_4617e04d04ed --> fd1ac927_00ef_d34e_8747_a00d62b71152
  d09ae4bb_9ed0_3257_c11b_1c199408288d["InspectedElementView.js"]
  d09ae4bb_9ed0_3257_c11b_1c199408288d --> fd1ac927_00ef_d34e_8747_a00d62b71152
  style fd1ac927_00ef_d34e_8747_a00d62b71152 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} from 'react';
import {TreeDispatcherContext} from './TreeContext';
import Button from '../Button';
import ElementBadges from './ElementBadges';
import {useHighlightHostInstance} from '../hooks';
import {logEvent} from 'react-devtools-shared/src/Logger';

import styles from './OwnerView.css';

type OwnerViewProps = {
  displayName: string,
  hocDisplayNames: Array<string> | null,
  environmentName: string | null,
  compiledWithForget: boolean,
  id: number,
  isInStore: boolean,
};

export default function OwnerView({
  displayName,
  environmentName,
  hocDisplayNames,
  compiledWithForget,
  id,
  isInStore,
}: OwnerViewProps): React.Node {
  const dispatch = useContext(TreeDispatcherContext);
  const {highlightHostInstance, clearHighlightHostInstance} =
    useHighlightHostInstance();

  const handleClick = useCallback(() => {
    logEvent({
      event_name: 'select-element',
      metadata: {source: 'owner-view'},
    });
    dispatch({
      type: 'SELECT_ELEMENT_BY_ID',
      payload: id,
    });
  }, [dispatch, id]);

  return (
    <Button
      key={id}
      className={styles.OwnerButton}
      disabled={!isInStore}
      onClick={handleClick}
      onMouseEnter={() => highlightHostInstance(id)}
      onMouseLeave={clearHighlightHostInstance}>
      <span className={styles.OwnerContent}>
        <span
          className={`${styles.Owner} ${isInStore ? '' : styles.NotInStore}`}
          title={displayName}
          data-testname="OwnerView">
          {'<' + displayName + '>'}
        </span>

        <ElementBadges
          hocDisplayNames={hocDisplayNames}
          compiledWithForget={compiledWithForget}
          environmentName={environmentName}
        />
      </span>
    </Button>
  );
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does OwnerView.js do?
OwnerView.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 OwnerView.js?
OwnerView.js defines 1 function(s): OwnerView.
What does OwnerView.js depend on?
OwnerView.js imports 9 module(s): Button, Button.js, ElementBadges, ElementBadges.js, Logger, OwnerView.css, TreeContext.js, hooks.js, and 1 more.
What files import OwnerView.js?
OwnerView.js is imported by 2 file(s): InspectedElementSuspendedBy.js, InspectedElementView.js.
Where is OwnerView.js in the architecture?
OwnerView.js is located at packages/react-devtools-shared/src/devtools/views/Components/OwnerView.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Components).

Analyze Your Own Codebase

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

Try Supermodel Free