File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 11import React , { useEffect , useState } from "react" ;
22import styled , { css } from "styled-components" ;
33
4- import { useToggle } from "react-use" ;
4+ import { useLocation , useToggle } from "react-use" ;
55
66import KlerosSolutionsIcon from "svgs/menu-icons/kleros-solutions.svg" ;
77
@@ -91,16 +91,17 @@ const DesktopHeader = () => {
9191 const [ isHelpOpen , toggleIsHelpOpen ] = useToggle ( false ) ;
9292 const [ isSettingsOpen , toggleIsSettingsOpen ] = useToggle ( false ) ;
9393 const [ initialTab , setInitialTab ] = useState < number > ( 0 ) ;
94+ const location = useLocation ( ) ;
9495
9596 const initializeNotifications = ( ) => {
96- const hasNotifications = window . location . hash . includes ( "#notifications" ) ;
97- toggleIsSettingsOpen ( hasNotifications ) ;
98- setInitialTab ( hasNotifications ? 1 : 0 ) ;
97+ const hasNotificationsPath : boolean = location . hash . includes ( "#notifications" ) ;
98+ toggleIsSettingsOpen ( hasNotificationsPath ) ;
99+ setInitialTab ( hasNotificationsPath ? 1 : 0 ) ;
99100 } ;
100101
101102 useEffect ( ( ) => {
102103 initializeNotifications ( ) ;
103- } , [ ] ) ;
104+ } , [ location . hash ] ) ;
104105
105106 useLockOverlayScroll ( isDappListOpen || isHelpOpen || isSettingsOpen ) ;
106107
Original file line number Diff line number Diff line change 11import React , { useEffect } from "react" ;
22import styled from "styled-components" ;
33
4- import { useToggle } from "react-use" ;
4+ import { useLocation , useToggle } from "react-use" ;
55
66import { HomePageProvider } from "hooks/useHomePageContext" ;
77import { getOneYearAgoTimestamp } from "utils/date" ;
@@ -26,9 +26,11 @@ const Container = styled.div`
2626
2727const Home : React . FC = ( ) => {
2828 const [ isOnboardingMiniGuidesOpen , toggleIsOnboardingMiniGuidesOpen ] = useToggle ( false ) ;
29+ const location = useLocation ( ) ;
30+
2931 useEffect ( ( ) => {
30- toggleIsOnboardingMiniGuidesOpen ( window . location . hash . includes ( "#onboarding" ) ) ;
31- } , [ ] ) ;
32+ toggleIsOnboardingMiniGuidesOpen ( location . hash . includes ( "#onboarding" ) ) ;
33+ } , [ location . hash ] ) ;
3234
3335 return (
3436 < HomePageProvider timeframe = { getOneYearAgoTimestamp ( ) } >
You can’t perform that action at this time.
0 commit comments