diff --git a/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPage.tsx b/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPage.tsx index c9cf04238..9a5a98051 100644 --- a/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPage.tsx +++ b/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPage.tsx @@ -65,17 +65,21 @@ const styles: (theme: SaladTheme) => Record = (theme: Sa }) export interface Props extends WithStyles { demandedHardwarePerformanceList?: DemandedHardwarePerformance[] + isAuthenticated: boolean withGetNotifiedButton: boolean + navigateToDemandAlerts: () => void fetchDemandedHardwarePerformanceList: () => void onLoginClick: () => void } const _DemandMonitorPage: FunctionComponent = ({ - fetchDemandedHardwarePerformanceList, - onLoginClick, - withGetNotifiedButton, demandedHardwarePerformanceList, + isAuthenticated, + withGetNotifiedButton, classes, + navigateToDemandAlerts, + fetchDemandedHardwarePerformanceList, + onLoginClick, }) => { const [isModalShown, setIsModalShown] = useState(false) @@ -101,7 +105,11 @@ const _DemandMonitorPage: FunctionComponent = ({ } const handleGetNotifiedButtonClick = () => { - setIsModalShown(true) + if (isAuthenticated) { + navigateToDemandAlerts() + } else { + setIsModalShown(true) + } } const getPageContent = () => { diff --git a/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPageContainer.tsx b/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPageContainer.tsx index c244c99bf..a5a4bd244 100644 --- a/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPageContainer.tsx +++ b/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPageContainer.tsx @@ -4,16 +4,16 @@ import { FeatureFlags, useFeatureManager } from '../../../FeatureManager' import type { RootStore } from '../../../Store' import { DemandMonitorPage, type Props as DemandMonitorPageProps } from './DemandMonitorPage' -interface Props extends DemandMonitorPageProps { - isAuthenticated: boolean -} - -export const _DemandMonitorPageContainer: FC = ({ isAuthenticated, ...props }: Props) => { +export const _DemandMonitorPageContainer: FC = ({ isAuthenticated, ...props }) => { const featureManager = useFeatureManager() const isDemandNotificationsFeatureFlagEnabled = featureManager.isEnabled(FeatureFlags.DemandNotifications) - const withGetNotifiedButton = isDemandNotificationsFeatureFlagEnabled && !isAuthenticated - - return + return ( + + ) } const mapStoreToProps = (store: RootStore): any => ({ @@ -22,6 +22,7 @@ const mapStoreToProps = (store: RootStore): any => ({ store.auth.login() }, fetchDemandedHardwarePerformanceList: store.demandMonitor.fetchDemandedHardwarePerformanceList, + navigateToDemandAlerts: () => store.routing.push('/account/alerts'), isAuthenticated: store.auth.isAuthenticated, demandedHardwarePerformanceList: store.demandMonitor.demandedHardwarePerformanceList, })