1- import React from 'react' ;
1+ import React , { useCallback , useContext } from 'react' ;
22import PropTypes from 'prop-types' ;
33
44import {
@@ -48,6 +48,7 @@ import {
4848} from '../../../icons/1x1' ;
4949import { Ph as PhIcon , Us as UsIcon } from '../../../icons/flags/4x3' ;
5050import { Skeleton } from '../../../ui' ;
51+ import { AppContext } from '../../../AppContext' ;
5152
5253const UserAvatar = props => {
5354 const { user } = props ;
@@ -151,15 +152,15 @@ const LocaleMenu = props => {
151152} ;
152153
153154const AccountMenu = props => {
155+ const { user, handleLock, handleSignOut } = useContext ( AppContext ) ;
156+
154157 const {
155158 history,
156159 classes,
157- pageProps,
158160
159161 accountMenuOpen,
160162 onAccountMenuToggle,
161163 } = props ;
162- const { user, handleLock, handleSignOut } = pageProps ;
163164
164165 const navigate = path => history . push ( path ) ;
165166
@@ -191,12 +192,10 @@ const AccountMenu = props => {
191192 </ ListItemAvatar >
192193
193194 < ListItemText >
194- < Typography >
195- { pageProps . user . name }
196- </ Typography >
195+ < Typography > { user . name } </ Typography >
197196
198197 < Typography color = "textSecondary" >
199- { pageProps . user . email }
198+ { user . email }
200199 </ Typography >
201200 </ ListItemText >
202201 </ MenuItem >
@@ -260,7 +259,6 @@ const AccountMenu = props => {
260259function Header ( props ) {
261260 const {
262261 classes,
263- pageProps,
264262 pageTitle,
265263 loading,
266264
@@ -277,10 +275,11 @@ function Header(props) {
277275
278276 const {
279277 user,
278+
280279 monitoringEnabled,
281280 nightMode,
282281 handleNightModeToggled,
283- } = pageProps ;
282+ } = useContext ( AppContext ) ;
284283
285284 const skeletonProps = {
286285 color : colors . grey [ 400 ] ,
@@ -711,7 +710,6 @@ function Header(props) {
711710
712711Header . propTypes = {
713712 classes : PropTypes . object . isRequired ,
714- pageProps : PropTypes . object . isRequired ,
715713 pageTitle : PropTypes . string . isRequired ,
716714 loading : PropTypes . bool ,
717715
0 commit comments