mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
[DevTools] Remove Welcome dialog (#16834)
This commit is contained in:
committed by
Brian Vaughn
parent
0b211318c5
commit
cff975b2c9
-12
@@ -40,11 +40,6 @@ let nodeWaitingToConnectHTML: string = '';
|
||||
let projectRoots: Array<string> = [];
|
||||
let statusListener: StatusListener = (message: string) => {};
|
||||
|
||||
// Unlike browser extension users, people using the standalone have actively installed version 4,
|
||||
// So we probably don't need to show them a changelog notice.
|
||||
// We should give embedded users (e.g. Nuclide, Sonar) a way of showing this dialog though.
|
||||
let showWelcomeToTheNewDevToolsDialog: boolean = false;
|
||||
|
||||
function setContentDOMNode(value: HTMLElement) {
|
||||
node = value;
|
||||
|
||||
@@ -63,11 +58,6 @@ function setStatusListener(value: StatusListener) {
|
||||
return DevtoolsUI;
|
||||
}
|
||||
|
||||
function setShowWelcomeToTheNewDevToolsDialog(value: boolean) {
|
||||
showWelcomeToTheNewDevToolsDialog = value;
|
||||
return DevtoolsUI;
|
||||
}
|
||||
|
||||
let bridge: FrontendBridge | null = null;
|
||||
let store: Store | null = null;
|
||||
let root = null;
|
||||
@@ -108,7 +98,6 @@ function reload() {
|
||||
bridge: ((bridge: any): FrontendBridge),
|
||||
canViewElementSourceFunction,
|
||||
showTabBar: true,
|
||||
showWelcomeToTheNewDevToolsDialog,
|
||||
store: ((store: any): Store),
|
||||
warnIfLegacyBackendDetected: true,
|
||||
viewElementSourceFunction,
|
||||
@@ -318,7 +307,6 @@ const DevtoolsUI = {
|
||||
connectToSocket,
|
||||
setContentDOMNode,
|
||||
setProjectRoots,
|
||||
setShowWelcomeToTheNewDevToolsDialog,
|
||||
setStatusListener,
|
||||
startServer,
|
||||
};
|
||||
|
||||
@@ -161,7 +161,6 @@ function createPanelIfReactLoaded() {
|
||||
overrideTab,
|
||||
profilerPortalContainer,
|
||||
showTabBar: false,
|
||||
showWelcomeToTheNewDevToolsDialog: true,
|
||||
store,
|
||||
viewElementSourceFunction,
|
||||
}),
|
||||
|
||||
@@ -25,7 +25,6 @@ import {ProfilerContextController} from './Profiler/ProfilerContext';
|
||||
import {ModalDialogContextController} from './ModalDialog';
|
||||
import ReactLogo from './ReactLogo';
|
||||
import WarnIfLegacyBackendDetected from './WarnIfLegacyBackendDetected';
|
||||
import ShowWelcomeToTheNewDevToolsDialog from './ShowWelcomeToTheNewDevToolsDialog';
|
||||
|
||||
import styles from './DevTools.css';
|
||||
|
||||
@@ -50,7 +49,6 @@ export type Props = {|
|
||||
canViewElementSourceFunction?: ?CanViewElementSource,
|
||||
defaultTab?: TabID,
|
||||
showTabBar?: boolean,
|
||||
showWelcomeToTheNewDevToolsDialog?: boolean,
|
||||
store: Store,
|
||||
warnIfLegacyBackendDetected?: boolean,
|
||||
viewElementSourceFunction?: ?ViewElementSource,
|
||||
@@ -92,7 +90,6 @@ export default function DevTools({
|
||||
overrideTab,
|
||||
profilerPortalContainer,
|
||||
showTabBar = false,
|
||||
showWelcomeToTheNewDevToolsDialog = false,
|
||||
store,
|
||||
warnIfLegacyBackendDetected = false,
|
||||
viewElementSourceFunction,
|
||||
@@ -167,9 +164,6 @@ export default function DevTools({
|
||||
</ViewElementSourceContext.Provider>
|
||||
</SettingsContextController>
|
||||
{warnIfLegacyBackendDetected && <WarnIfLegacyBackendDetected />}
|
||||
{showWelcomeToTheNewDevToolsDialog && (
|
||||
<ShowWelcomeToTheNewDevToolsDialog />
|
||||
)}
|
||||
</ModalDialogContextController>
|
||||
</StoreContext.Provider>
|
||||
</BridgeContext.Provider>
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
.Row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.Column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.Logo {
|
||||
height: 4rem;
|
||||
width: 4rem;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
.Title {
|
||||
font-size: var(--font-size-sans-large);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.ReleaseNotesLink {
|
||||
color: var(--color-button-active);
|
||||
}
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its 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 React, {Fragment, useContext, useEffect} from 'react';
|
||||
import {unstable_batchedUpdates as batchedUpdates} from 'react-dom';
|
||||
import {useLocalStorage} from './hooks';
|
||||
import {ModalDialogContext} from './ModalDialog';
|
||||
import ReactLogo from './ReactLogo';
|
||||
import {CHANGE_LOG_URL} from 'react-devtools-shared/src/constants';
|
||||
|
||||
import styles from './ShowWelcomeToTheNewDevToolsDialog.css';
|
||||
|
||||
const LOCAL_STORAGE_KEY =
|
||||
'React::DevTools::hasShownWelcomeToTheNewDevToolsDialog';
|
||||
|
||||
export default function ShowWelcomeToTheNewDevToolsDialog(_: {||}) {
|
||||
const {dispatch} = useContext(ModalDialogContext);
|
||||
const [
|
||||
hasShownWelcomeToTheNewDevToolsDialog,
|
||||
setHasShownWelcomeToTheNewDevToolsDialog,
|
||||
] = useLocalStorage<boolean>(LOCAL_STORAGE_KEY, false);
|
||||
|
||||
useEffect(
|
||||
() => {
|
||||
if (!hasShownWelcomeToTheNewDevToolsDialog) {
|
||||
batchedUpdates(() => {
|
||||
setHasShownWelcomeToTheNewDevToolsDialog(true);
|
||||
dispatch({
|
||||
canBeDismissed: true,
|
||||
type: 'SHOW',
|
||||
content: <DialogContent />,
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
[
|
||||
dispatch,
|
||||
hasShownWelcomeToTheNewDevToolsDialog,
|
||||
setHasShownWelcomeToTheNewDevToolsDialog,
|
||||
],
|
||||
);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function DialogContent(_: {||}) {
|
||||
return (
|
||||
<Fragment>
|
||||
<div className={styles.Row}>
|
||||
<ReactLogo className={styles.Logo} />
|
||||
<div>
|
||||
<div className={styles.Title}>Welcome to the new React DevTools!</div>
|
||||
<div>
|
||||
<a
|
||||
className={styles.ReleaseNotesLink}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
href={CHANGE_LOG_URL}>
|
||||
Learn more
|
||||
</a>{' '}
|
||||
about changes in this version.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
@@ -56,7 +56,6 @@ inject('dist/app.js', () => {
|
||||
createElement(DevTools, {
|
||||
browserTheme: 'light',
|
||||
showTabBar: true,
|
||||
showWelcomeToTheNewDevToolsDialog: true,
|
||||
warnIfLegacyBackendDetected: true,
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user