Skip to content
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

feat: Added a Notification head bar to present current notifications number #1322

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jian4on
Copy link
Contributor

@jian4on jian4on commented Nov 18, 2024

Summary of Changes

Improved the HomeHeaderView component by adding a Notifications head bar, and maintained the test suits for new changes

Related Issues

N/A

Pull Request Checklist

Tick all boxes below to demonstrate that you have completed the respective task. If the item does not apply to your this PR check it anyway to make it apparent that there's nothing to do.

  • All commits contain a DCO Signed-off-by line (we use the DCO GitHub app to enforce this);
  • Updated LICENSE-3RD-PARTY.md for any added dependencies or vendored components;
  • Updated documentation as needed for changed code and new or modified features;
  • Added sufficient tests so that overall code coverage is not reduced.

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

Pro Tip 🤓

  • Read our contribution guide at least once; it will save you a few review cycles!
  • Your PR will likely not be reviewed until all the above boxes are checked and all automated tests have passed.

PR template adapted from the Python attrs project.

Jian Wang added 6 commits November 14, 2024 23:50
…hevron icon as notifications expand/shrink control (no toggle logic yet)

Signed-off-by: Jian Wang <[email protected]>
…h current notifications number

Signed-off-by: Jian Wang <[email protected]>
…or due to snapshot recording in different local env

Signed-off-by: Jian Wang <[email protected]>
Copy link
Contributor

@bryce-mcmath bryce-mcmath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few thoughts

@@ -37,12 +37,13 @@ const Home: React.FC<HomeProps> = () => {
const { ColorPallet } = useTheme()
const [store, dispatch] = useStore()
const { start } = useTour()
const [showNotifications] = useState(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This state variable isn't changed and is used in more than one component. Would it be better adding it as a config option? (TOKENS.CONFIG)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise I don't really see the purpose, as it's not overideable and isn't ever changed. If that's fine then maybe we can just remove it entirely?

Copy link
Contributor Author

@jian4on jian4on Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the chevron and showNotifications state, will add them back in story implements them

Comment on lines 134 to 142
ListHeaderComponent={() => {
const homeHeaderViewProps = {
notifications: notifications,
showNotifications: showNotifications,
}
return (
<HomeHeaderView {...homeHeaderViewProps} />
)
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ListHeaderComponent={() => {
const homeHeaderViewProps = {
notifications: notifications,
showNotifications: showNotifications,
}
return (
<HomeHeaderView {...homeHeaderViewProps} />
)
}}
ListHeaderComponent={() => <HomeHeaderView notifications={notifications} /> }

If the showNotifications gets moved into config, this might be a bit cleaner

Comment on lines 151 to 155
paddingBottom: !showNotifications ? 0 : index === notifications.length - 1 ? 20 : 10,
backgroundColor: ColorPallet.brand.secondaryBackground,
}}
>
{DisplayListItemType(item)}
{ showNotifications && DisplayListItemType(item) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showNotifications can be removed unless it becomes changeable / configurable. If it does become configurable, then it should simply not render these list items at all. No empty Views with padding and background needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the chevron icons and the showNotification state, will add them back in next story with the implementations

Copy link

sonarcloud bot commented Nov 21, 2024

@knguyenBC
Copy link
Contributor

knguyenBC commented Nov 21, 2024

Can the head bar be toggleable/Is it toggleable on/off?

@jian4on
Copy link
Contributor Author

jian4on commented Nov 22, 2024

Can the head bar be toggleable/Is it toggleable on/off?

No interaction control to toggle the notification numbers head bar, but it will disappear after all notifications are dismissed. So we can say it is toggled by current notifications list. Thanks @knguyenBC
We do have a chevron toggle icon in this head bar in next story, they are used to toggle the notifications list below and the default Home screen, not for itself.

@jian4on jian4on marked this pull request as draft November 25, 2024 19:42
@knguyenBC
Copy link
Contributor

Can the head bar be toggleable/Is it toggleable on/off?

No interaction control to toggle the notification numbers head bar, but it will disappear after all notifications are dismissed. So we can say it is toggled by current notifications list. Thanks @knguyenBC We do have a chevron toggle icon in this head bar in next story, they are used to toggle the notifications list below and the default Home screen, not for itself.

@jian4on BC Wallet team would like to choose not to include this feature into our wallet as it will cause some UI issues. If the component can be built so that we can choose to have this enabled off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants