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

Replace useDispatch w. useQuery/request: Notifications (src/Components/Notifications/**) #6392 #6543

Merged
merged 11 commits into from
Nov 7, 2023

Conversation

adriansliva
Copy link
Contributor

@adriansliva adriansliva commented Nov 5, 2023

WHAT

🤖 Generated by Copilot at 97346d7

This pull request refactors the notifications components to use custom hooks and functions for fetching and handling data from the API, and adds TypeScript interfaces and ESLint configuration for improving the code quality and readability. It modifies the files NoticeBoard.tsx, NotificationsList.tsx, ShowPushNotification.tsx, api.tsx, .eslintrc.js and models.tsx.
This pull request improves the code quality and readability of the Notifications components.

Proposed Changes

@coronasafe/care-fe-code-reviewers @coronasafe/code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

HOW

🤖 Generated by Copilot at 97346d7

  • Configure ESLint for TypeScript code (link)
  • Define notification interfaces for data, response and configuration (link)
  • Replace dispatch calls with useQuery hook to fetch notifications data in NoticeBoard component (link, link)
  • Remove unused imports of useEffect, useState and useDispatch from NoticeBoard and NotificationsList components (link, link)
  • Import request function and routes object to make API requests and specify types in NotificationsList component (link)
  • Replace dispatch calls with request function to mark notifications as read, get and update push notification configuration, and get public key in NotificationsList component (link, link, link, link, link, link, link)
  • Remove unused dispatch variables from NotificationTile and NotificationsList components (link, link)
  • Remove dispatch dependency from useEffect hook in NotificationsList component (link)
  • Replace useDispatch hook with useQuery hook to fetch notification data and redirect in ShowPushNotification component (link)
  • Remove useEffect hook from ShowPushNotification component as it is redundant (link)
  • Add method and TRes properties to notification routes in routes object to specify HTTP methods and response types (link, link, link)
  • Import notification interfaces from models file in api.tsx file to use them for route types (link)

@adriansliva adriansliva requested a review from a team November 5, 2023 23:05
@adriansliva adriansliva requested a review from a team as a code owner November 5, 2023 23:05
Copy link

vercel bot commented Nov 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
care-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2023 10:40am

Copy link

netlify bot commented Nov 5, 2023

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit 0589c66
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/654a13f8355bed00081edf91
😎 Deploy Preview https://deploy-preview-6543--care-egov-staging.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@adriansliva adriansliva changed the title Issue 6392 Replace useDispatch w. useQuery/request: Notifications (src/Components/Notifications/**) #6392 Nov 5, 2023
src/Redux/api.tsx Outdated Show resolved Hide resolved
src/Redux/api.tsx Outdated Show resolved Hide resolved
src/Components/Notifications/models.tsx Outdated Show resolved Hide resolved
src/Components/Notifications/ShowPushNotification.tsx Outdated Show resolved Hide resolved
src/Components/Notifications/NotificationsList.tsx Outdated Show resolved Hide resolved
src/Components/Notifications/NotificationsList.tsx Outdated Show resolved Hide resolved
src/Components/Notifications/NotificationsList.tsx Outdated Show resolved Hide resolved
src/Components/Notifications/NoticeBoard.tsx Outdated Show resolved Hide resolved
.eslintrc.js Outdated Show resolved Hide resolved
src/Redux/api.tsx Outdated Show resolved Hide resolved
@rithviknishad
Copy link
Member

@adriansliva could you also rebase and clear the merge conflicts?

Copy link
Member

@rithviknishad rithviknishad 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 that, everything LGTM

package-lock.json Outdated Show resolved Hide resolved
Copy link
Member

@rithviknishad rithviknishad left a comment

Choose a reason for hiding this comment

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

Nice work @adriansliva
LGTM

@nihal467
Copy link
Member

nihal467 commented Nov 7, 2023

lgtm

@khavinshankar khavinshankar merged commit bf932d5 into coronasafe:develop Nov 7, 2023
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🛠️ Replace useDispatch w. useQuery/request: Notifications (src/Components/Notifications/**)
4 participants