/** * 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 Button from 'react-devtools-shared/src/devtools/views/Button'; import ButtonIcon from 'react-devtools-shared/src/devtools/views/ButtonIcon'; import ButtonLabel from 'react-devtools-shared/src/devtools/views/ButtonLabel'; import type {SourceSelection} from './EditorPane'; import type {ReactFunctionLocation} from 'shared/ReactTypes'; import {checkConditions} from './utils'; type Props = { editorURL: string, source: ?SourceSelection, className?: string, }; function ActualOpenInEditorButton({ editorURL, source, className, }: Props): React.Node { let disable; if (source == null) { disable = true; } else { const staleLocation: ReactFunctionLocation = [ '', source.url, // This is not live but we just use any line/column to validate whether this can be opened. // We'll call checkConditions again when we click it to get the latest line number. source.selectionRef.line, source.selectionRef.column, ]; disable = checkConditions(editorURL, staleLocation).shouldDisableButton; } return ( ); } function OpenInEditorButton({editorURL, source, className}: Props): React.Node { return ( Loading source maps... }> ); } export default OpenInEditorButton;