diff --git a/src/Ui.tsx b/src/Ui.tsx index 4211780..96ccb7e 100644 --- a/src/Ui.tsx +++ b/src/Ui.tsx @@ -158,10 +158,11 @@ const init = (serverUrl) => { return ( - + + {store.isMinimized && } diff --git a/src/components/Notifications.tsx b/src/components/Notifications.tsx index a8e0c06..f14a868 100644 --- a/src/components/Notifications.tsx +++ b/src/components/Notifications.tsx @@ -1,13 +1,21 @@ -import React, { FunctionComponent } from 'react'; +import React, { FunctionComponent, useEffect, useState } from 'react'; +import { useLocation } from 'react-router-dom'; import styled from 'styled-components'; import { NotificationParams } from '../shared/interfaces'; import Notification from './Notification'; // store import { observer } from 'mobx-react'; import { useStore } from '../store'; +import { autorun, reaction } from 'mobx'; const Notifications: FunctionComponent = () => { const store = useStore(); + const location = useLocation(); + const [isRoot, setIsRoot] = useState(true); + + useEffect(() => { + setIsRoot(location.pathname === '/'); + }, [location]); const deleteNotification = (id: string) => store.notifications.splice( @@ -18,7 +26,7 @@ const Notifications: FunctionComponent = () => { if (store.notifications.length === 0) return null; return ( - + {store.notifications.map((data: NotificationParams, key) => ( (props.isRoot ? 39 : 0)}px; z-index: 11; padding: 10px; width: 100%;