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

[RHCLOUD-33811] Move notification drawer to its own module #661

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

BlakeHolifield
Copy link

@BlakeHolifield BlakeHolifield commented Jan 10, 2025

Description

Creates a new component for the NotificationDrawer. The functionality was previously in the insights-chrome
repo and will now live here and be called as a ScalprumComponent

RHCLOUD-33811


Checklist ☑️

  • PR only fixes one issue or story
  • Change reviewed for extraneous code
  • UI best practices adhered to
  • Commits squashed and meaningfully named
  • All PR checks pass locally (build, lint, test, E2E)

  • (Optional) QE: Needs QE attention (OUIA changed, perceived impact to tests, no test coverage)
  • (Optional) QE: Has been mentioned
  • (Optional) UX: Needs UX attention (end user UX modified, missing designs)
  • (Optional) UX: Has been mentioned

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.30%. Comparing base (ed0e9e4) to head (4b531da).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #661   +/-   ##
=======================================
  Coverage   91.30%   91.30%           
=======================================
  Files           3        3           
  Lines          23       23           
=======================================
  Hits           21       21           
  Misses          2        2           

@justinorringer justinorringer marked this pull request as ready for review January 23, 2025 19:59
@justinorringer justinorringer requested a review from a team as a code owner January 23, 2025 19:59
Copy link
Contributor

@Hyperkid123 Hyperkid123 left a comment

Choose a reason for hiding this comment

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

Some of the logic should stay in Chrome OR we need to leverage some other techniques (federated modules 😉 ) so we can reach feature parity with the current approach.

fec.config.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/components/NotificationsDrawer/DrawerPanel.tsx Outdated Show resolved Hide resolved
src/components/NotificationsDrawer/DrawerPanel.tsx Outdated Show resolved Hide resolved
src/components/NotificationsDrawer/DrawerPanel.tsx Outdated Show resolved Hide resolved
src/state/atoms/notificationDrawerAtom.ts Outdated Show resolved Hide resolved
Comment on lines 26 to 27
export const notificationDrawerDataAtom = atom<NotificationData[]>([]);
export const notificationDrawerCountAtom = atom(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the initial data should be passed from chrome as well as props. The notifications module should only consume them.

Copy link
Contributor

@karelhala karelhala left a comment

Choose a reason for hiding this comment

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

Other than removing the cypress config, changing Atoms to Redux and utilizing JS clients just a few minor improvements.

package.json Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

This PR should not add cypress config. We have a seperate ticket for that work.

Copy link

@justinorringer justinorringer Jan 27, 2025

Choose a reason for hiding this comment

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

The PR did get big pretty quick haha. I threw these (imperfect) cypress stuff in a draft PR for you all to start with #667

src/components/NotificationsDrawer/DrawerPanel.tsx Outdated Show resolved Hide resolved
src/components/NotificationsDrawer/DrawerPanel.tsx Outdated Show resolved Hide resolved
src/components/NotificationsDrawer/DrawerPanel.tsx Outdated Show resolved Hide resolved
key="manage-event"
onClick={() =>
onNavigateTo(
`/settings/notifications/configure-events?bundle=${notification.bundle}&tab=configuration`
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are in the notifications application I think all links needs to be updated and the /settings should be removed. I would have to however have to check it locally what needs to remain and what can be removed.

<DropdownItem key="quick links" description="Quick links" />,
<DropdownItem
key="notifications log"
onClick={() => onNavigateTo('/settings/notifications/notificationslog')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as with the to links. I think we can remove the /settings URL. But I'd have to check this locally to see what can remain and what can be removed.

src/components/NotificationsDrawer/DrawerUtils.ts Outdated Show resolved Hide resolved
src/components/NotificationsDrawer/NotificationItem.tsx Outdated Show resolved Hide resolved
Comment on lines +45 to +58
const onMarkAsRead = () => {
axios
.put('/api/notifications/v1/notifications/drawer/read', {
notification_ids: [notification.id],
read_status: !notification.read,
})
.then(() => {
updateNotificationRead(notification.id, !notification.read);
setIsDropdownOpen(false);
})
.catch((e) => {
console.error('failed to update notification read status', e);
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use the JS client for this function as well.

@justinorringer justinorringer mentioned this pull request Feb 7, 2025
9 tasks
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.

6 participants