Skip to content

Commit

Permalink
update novu initialization logic (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
rners01 authored Sep 6, 2023
1 parent a215c8d commit b0e4f08
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/web-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ export const App = withStyles(styles)(

public override render(): ReactNode {
const { classes, history } = this.props
const isAuthenticated = this.store.auth.isAuthenticated
const shouldShowNovuBanner = this.store.auth.isAuthenticated && this.store.profile.novuSignature

return (
<>
{isAuthenticated && <NovuNotificationBanner />}
{shouldShowNovuBanner && <NovuNotificationBanner />}
<MobileDevice>
<div className={classes.mobileMainWindow}>
<div className={classes.mobileNavigationContainer}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const mapStoreToProps = (store: RootStore): any => {
username: isAuthenticated ? store.profile.currentProfile?.username : undefined,
targetReward,
notifications,
novuSignature: store.profile.novuSignature
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import { NavigationBar, type NavigationBarProps } from '@saladtechnologies/garde
import type { FunctionComponent } from 'react'
import { NavigationBarWithNovuNotifications } from './NavigationBarWithNovuNotifications'

export const NavigationBarWithNotifications: FunctionComponent<NavigationBarProps> = (props) => {
export interface NavigationBarWithNotificationsProps extends NavigationBarProps {
novuSignature?: string
}

export const NavigationBarWithNotifications: FunctionComponent<NavigationBarWithNotificationsProps> = ({
novuSignature,
...props
}) => {
const notifications = {
...props.notifications,
news: [],
Expand All @@ -11,8 +18,9 @@ export const NavigationBarWithNotifications: FunctionComponent<NavigationBarProp
onOpenNotificationsDrawer: props.notifications.onOpenNotificationsDrawer,
onCloseNotificationsDrawer: props.notifications.onCloseNotificationsDrawer,
}
const shouldShowNavigationBarWithNovuNotifications = props.username !== undefined && novuSignature !== undefined

return props.username !== undefined ? (
return shouldShowNavigationBarWithNovuNotifications ? (
<NavigationBarWithNovuNotifications {...props} />
) : (
<NavigationBar {...props} notifications={notifications} />
Expand Down

0 comments on commit b0e4f08

Please sign in to comment.