-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "Welcome to the new DevTools" notification
This dialog is shown in the browser extension the first time a user views v4. It is off by default for the standalone extension, but can be enabled via a public API.
- Loading branch information
Brian Vaughn
committed
Jul 31, 2019
1 parent
c57d2a2
commit 4f8b786
Showing
13 changed files
with
180 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,7 @@ | |
text-align: right; | ||
margin-top: 0.5rem; | ||
} | ||
|
||
.Button { | ||
font-size: var(--font-size-sans-large); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// @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 '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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters