-
Notifications
You must be signed in to change notification settings - Fork 13
LW-13590 Add the notifications center #2001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@import '../../../../../packages/core/src/ui/styles/theme.scss'; | ||
@import '../../../../../packages/common/src/ui/styles/theme.scss'; | ||
|
||
.markAllAsRead { | ||
max-width: size_unit(25); | ||
} | ||
|
||
.sectionTitle { | ||
margin-bottom: size_unit(5.5); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is margin specific properties available on Flex component |
||
|
||
.title { | ||
margin-bottom: 0px !important; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Box, Flex } from '@input-output-hk/lace-ui-toolkit'; | ||
|
||
import { Button, NavigationButton } from '@lace/common'; | ||
import { SectionTitle } from '@components/Layout/SectionTitle'; | ||
|
||
import styles from './NotificationsCenter.module.scss'; | ||
|
||
export interface NotificationsCenterProps { | ||
onBack: () => void; | ||
onMarkAllAsRead: () => void; | ||
popupView?: boolean; | ||
} | ||
|
||
export const NotificationsCenter = ({ | ||
onBack, | ||
onMarkAllAsRead, | ||
popupView | ||
}: NotificationsCenterProps): React.ReactElement => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Box p="$24"> | ||
<Flex className={styles.sectionTitle} justifyContent="space-between"> | ||
<SectionTitle | ||
classname={styles.title} | ||
sideText={`(${1})`} | ||
title={ | ||
<Flex alignItems="center" gap="$8"> | ||
<NavigationButton icon="arrow" onClick={onBack} /> | ||
{t('notificationsCenter.title')} | ||
</Flex> | ||
} | ||
/> | ||
{!popupView && ( | ||
<Button | ||
className={styles.markAllAsRead} | ||
block | ||
color="gradient" | ||
data-testid="notifications-bell" | ||
onClick={onMarkAllAsRead} | ||
> | ||
{t('notificationsCenter.markAllAsRead')} | ||
</Button> | ||
)} | ||
</Flex> | ||
Notifications Center (Placeholder content) | ||
</Box> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { useHistory } from 'react-router'; | ||
|
||
import { usePostHogClientContext } from '@providers/PostHogClientProvider'; | ||
import { ExperimentName } from '@lib/scripts/types/feature-flags'; | ||
import { walletRoutePaths } from '@routes'; | ||
import { useWalletStore } from '@stores'; | ||
import { APP_MODE_POPUP } from '@src/utils/constants'; | ||
|
||
import { NotificationsCenter } from './NotificationsCenter'; | ||
|
||
export const NotificationsCenterContainer = (): React.ReactElement => { | ||
const posthog = usePostHogClientContext(); | ||
const history = useHistory(); | ||
const { walletUI } = useWalletStore(); | ||
|
||
if (!posthog?.isFeatureFlagEnabled(ExperimentName.NOTIFICATIONS_CENTER)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you could render this route conditionally in |
||
history.push(walletRoutePaths.assets); | ||
|
||
// eslint-disable-next-line unicorn/no-null | ||
return null; | ||
} | ||
|
||
return ( | ||
<NotificationsCenter | ||
onBack={() => history.goBack()} | ||
onMarkAllAsRead={() => { | ||
// TODO connect with notifications center | ||
// eslint-disable-next-line no-console | ||
console.log('onMarkAllAsRead'); | ||
}} | ||
popupView={walletUI.appMode === APP_MODE_POPUP} | ||
/> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
|
||
import { Layout, SectionLayout } from '@src/views/browser-view/components/Layout'; | ||
import { EducationalList } from '@src/views/browser-view/components'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { getEducationalList } from '@src/views/browser-view/features/assets/components/AssetEducationalList/AssetEducationalList'; | ||
|
||
import { NotificationsCenterContainer } from './NotificationsCenterContainer'; | ||
|
||
export const NotificationsCenterLayout = (): React.ReactElement => { | ||
const { t } = useTranslation(); | ||
|
||
const educationalItems = getEducationalList(t); | ||
|
||
return ( | ||
<> | ||
<Layout> | ||
<SectionLayout | ||
sidePanelContent={ | ||
<EducationalList items={educationalItems} title={t('browserView.sidePanel.aboutYourWallet')} /> | ||
} | ||
> | ||
<NotificationsCenterContainer /> | ||
</SectionLayout> | ||
</Layout> | ||
</> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './NotificationsBellContainer'; | ||
export * from './NotificationsCenterContainer'; | ||
export * from './NotificationsCenterLayout'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kindly rename to be something more generic, eg:
button
, otherwise, if copy of this component changes, you'll need to rename class as well*