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

Notification Component for Notification Panel #311

Merged
merged 25 commits into from
Apr 6, 2022

Conversation

anthonycruzmacedo
Copy link
Contributor

@anthonycruzmacedo anthonycruzmacedo commented Feb 28, 2022

Summary

Notification component for notification panel that displays a source's profile picture, a notification message, a timestamp,
a conditional view dot, and redirects when clicked
Closes: #299

Changes

  • create Notification.jsx, NotificationStyles.js
  • add viewNotification method to api.js
  • add useParams to ProjectDetails.jsx, update useEffect() for getProject method to fix page reload bug when a notification is clicked while already on a project page

Screenshots

image

@ajain1921 ajain1921 changed the base branch from master to notification_feature March 3, 2022 01:06
Copy link
Contributor

@ajain1921 ajain1921 left a comment

Choose a reason for hiding this comment

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

Great work overall! I left a few comments about how you can make the code a little cleaner. In terms of next steps, I'll get Andrew's stuff merged in so you can connect with the backend. Also, it might make sense to move Notification into notification_panel but up to you.

…file, simplify logic in scripts, remove viewComment from userActions.js, call API.viewNotification directly in component
@NdibeRaymond
Copy link
Collaborator

Great job overall, thanks to everyone involved! Though still draft, something caught my attention. It seems we are not building with internalization in mind. The renderTimeAgo function easily comes to mind as a violator. If we can we should use dFormatter for everything concerning date formatting and nFormatter for anything concerning number formatting. It is easy to hook up the values returned from these functions into i18next for translation. To get an idea, try searching for dFormatter and observe how it's being used across the codebase.

@anthonycruzmacedo
Copy link
Contributor Author

Hi Raymond thanks for the feedback. I've updated the component to use dFormatter for the time stamp, as well as i18next translations for the message and timestamp.

@anthonycruzmacedo anthonycruzmacedo marked this pull request as ready for review March 29, 2022 02:04
@tuxology tuxology added the h4i Hack4Impact issue label Apr 1, 2022
@anthonycruzmacedo anthonycruzmacedo changed the title Outline for Notification components and stylings Notification Component for Notification Panel Apr 6, 2022
Copy link
Contributor

@ajain1921 ajain1921 left a comment

Choose a reason for hiding this comment

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

Great work Anthony! Thanks for fixing some of the templates and getting the diagonal pics to work. Overall the component looks really clean and I just left a few comments about minor fixes. Feel free to squash merge when you're done.

zubhub_frontend/zubhub/src/views/PageWrapper.jsx Outdated Show resolved Hide resolved
Comment on lines 24 to 34
const getMessage = () => {
let message = '';
// 55 character message limit + 17 for strong tags being counted as well
if (notification.message.length < 72) {
message += notification.message;
} else {
message += notification.message.slice(0, 72) + '...';
}
return message;
};

Copy link
Contributor

Choose a reason for hiding this comment

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

This might be a nice option for text overflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked at this a bit but it doesn't seem -webkit-box is compatible with JS styles

@anthonycruzmacedo anthonycruzmacedo merged commit 7de5da2 into notification_feature Apr 6, 2022
@anthonycruzmacedo anthonycruzmacedo deleted the al-acm/notification-panel branch April 7, 2022 03:56
ajain1921 added a commit that referenced this pull request Apr 27, 2022
* Outline for Notification components and stylings

* Testing notification

* Complete majority of stylings for notification component, add dummy component and props to PageWrapper.jsx

* Complete stylings for notification component, fix hovers!

* Make small style changes to notification component

* Begin connecting to backend using realistic parameters, not clean or very functional yet

* Begin adapting notification panel to hold notification components

* Finish stylings for notification component and message rendering

* Finish up API methods to updated viewed notification, add token constant to component

* Add logic for rendering notification timestamp, redirect link, and notification message

* Clean up and reduce code, remove redunant or unused sections

* Move renderTimeAgo and getNotification to new NotificationScripts.js file, simplify logic in scripts, remove viewComment from userActions.js, call API.viewNotification directly in component

* Add proper date formatting using dFormatter, string truncation for notification message

* Add double image design to nofications, add project titles to views, fix small format issue in comment template

* Finish up issue, update notification templates for consitency, fix bug in project details useEffect

* Update clapped  web_many message to not include strong tags

* Update web_many message templates to include project name

* Fix url

* Minor fixes, add mobile width dependency, update getMessage() to get consistent character limits, remove mock data from PageWrapper

Co-authored-by: Aditya Jain <[email protected]>
ajain1921 added a commit that referenced this pull request Apr 27, 2022
* Create notifications folder in zubhub_backend/zubhub, begin implementing test functions

* Move send_whatsapp function to adapters.py, create task in tasks.py, create send-notification path for testing, test get method in views

* Create notifications folder in zubhub_backend/zubhub, begin implementing test functions

* Move send_whatsapp function to adapters.py, create task in tasks.py, create send-notification path for testing, test get method in views

* Use whatsapp phone in adapter

* Fix whatsapp message sending

* Fix bug in send_whatsapp function in adapters.py

* Fix settings name

* Notification Model and Endpoints (#286)

* initial commit

* fix namings

* Add update and delete requests

* Add boilerplate stuff

* finish all endpoints

* Add source and preferred contact

* modifications to notification endpoints

* fix notification list view

* hyphens

* address merge conflict

* Update start

Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: Grace Zhang <[email protected]>
Co-authored-by: Aditya Jain <[email protected]>
Co-authored-by: Zora Zhang <[email protected]>

* Add notification button components (#302)

* Add notification button components

* Fix popper positioning

* Add popper arrow and inner content

* Give dropdown box shadow

* Add mobile view

* Fix box shadow on arrow for dropdown panel

* Fix coloring of unread notifications text

* Add push notification util function and use CreatorSerializer (#316)

* Add push notification util function and use CreatorSerializer for notification serializer

* Add notification type field to notification model

* Add type to notification serializer and add migration

* Remove references to message property of notification

* Add viewed to notification serializer

* Use creator minimal serializer

* Add new link property to notification model

* Notification Helper Function (#306)

* initial setup

* add setting

* fix the way to get setting

* commit

* finished and tested function

* add original code back in

* modify function to send mass text/email

* Add channel verification

Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: Aditya Jain <[email protected]>

* Fix migrations

* Add several functions and maps for notifications logic (#324)

* Add several functions and maps for notifications logic, not working

* Finish notification sending function

* Remove redundant check for valid notification channel for notification type

* Send notifications when notification events occur

* Recommend unused function

* Add throttle classes back

* Fix file extensions

* Fix notification template prefix

* Add message field to notification model to support notifications that mention project names

* Properly create migrations and use char field

* Use name instead of label for django integer choice class

* Change notification link attribute to be a char field

* Fix email templates for notifications

* Notifications panel loading notifications complete (#341)

* Notifications panel loading notifications complete

* Use artifical loading for pages after 1

* Change padding

* Add comment for recent notification threshold

* Remove console log

* Format

* Remove unncessary space

* Reset scroll on notification tab change

* Add notification grouping code (#351)

* Add notification grouping code

* Use set to determine valid grouped notification types

* Actually make the grouping work

* Persist context for pushing notifications

* Remove prints

* Fix django db warning'

* Return notification in all branch paths

* No need to return notification

* Notification Component for Notification Panel (#311)

* Outline for Notification components and stylings

* Testing notification

* Complete majority of stylings for notification component, add dummy component and props to PageWrapper.jsx

* Complete stylings for notification component, fix hovers!

* Make small style changes to notification component

* Begin connecting to backend using realistic parameters, not clean or very functional yet

* Begin adapting notification panel to hold notification components

* Finish stylings for notification component and message rendering

* Finish up API methods to updated viewed notification, add token constant to component

* Add logic for rendering notification timestamp, redirect link, and notification message

* Clean up and reduce code, remove redunant or unused sections

* Move renderTimeAgo and getNotification to new NotificationScripts.js file, simplify logic in scripts, remove viewComment from userActions.js, call API.viewNotification directly in component

* Add proper date formatting using dFormatter, string truncation for notification message

* Add double image design to nofications, add project titles to views, fix small format issue in comment template

* Finish up issue, update notification templates for consitency, fix bug in project details useEffect

* Update clapped  web_many message to not include strong tags

* Update web_many message templates to include project name

* Fix url

* Minor fixes, add mobile width dependency, update getMessage() to get consistent character limits, remove mock data from PageWrapper

Co-authored-by: Aditya Jain <[email protected]>

* Notification feature fix (#429)

* Fix most notification feature bugs

* Fix app bar on top of other elements

* Fix panel zindex

* Fix panel loading

* Fix comment notif

Co-authored-by: Aditya Jain <[email protected]>

* Add quotes to template

* linearize migrations

* Fix import

* Add project to template

* Styling fixes

* Delete .gitignore

Co-authored-by: saxytony <[email protected]>
Co-authored-by: AndrewLester <[email protected]>
Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: Grace Zhang <[email protected]>
Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: saxytony <[email protected]>
NdibeRaymond pushed a commit that referenced this pull request Jun 5, 2022
* Create notifications folder in zubhub_backend/zubhub, begin implementing test functions

* Move send_whatsapp function to adapters.py, create task in tasks.py, create send-notification path for testing, test get method in views

* Create notifications folder in zubhub_backend/zubhub, begin implementing test functions

* Move send_whatsapp function to adapters.py, create task in tasks.py, create send-notification path for testing, test get method in views

* Use whatsapp phone in adapter

* Fix whatsapp message sending

* Fix bug in send_whatsapp function in adapters.py

* Fix settings name

* Notification Model and Endpoints (#286)

* initial commit

* fix namings

* Add update and delete requests

* Add boilerplate stuff

* finish all endpoints

* Add source and preferred contact

* modifications to notification endpoints

* fix notification list view

* hyphens

* address merge conflict

* Update start

Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: Grace Zhang <[email protected]>
Co-authored-by: Aditya Jain <[email protected]>
Co-authored-by: Zora Zhang <[email protected]>

* Add notification button components (#302)

* Add notification button components

* Fix popper positioning

* Add popper arrow and inner content

* Give dropdown box shadow

* Add mobile view

* Fix box shadow on arrow for dropdown panel

* Fix coloring of unread notifications text

* Add push notification util function and use CreatorSerializer (#316)

* Add push notification util function and use CreatorSerializer for notification serializer

* Add notification type field to notification model

* Add type to notification serializer and add migration

* Remove references to message property of notification

* Add viewed to notification serializer

* Use creator minimal serializer

* Add new link property to notification model

* Notification Helper Function (#306)

* initial setup

* add setting

* fix the way to get setting

* commit

* finished and tested function

* add original code back in

* modify function to send mass text/email

* Add channel verification

Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: Aditya Jain <[email protected]>

* Fix migrations

* Add several functions and maps for notifications logic (#324)

* Add several functions and maps for notifications logic, not working

* Finish notification sending function

* Remove redundant check for valid notification channel for notification type

* Send notifications when notification events occur

* Recommend unused function

* Add throttle classes back

* Fix file extensions

* Fix notification template prefix

* Add message field to notification model to support notifications that mention project names

* Properly create migrations and use char field

* Use name instead of label for django integer choice class

* Change notification link attribute to be a char field

* Fix email templates for notifications

* Notifications panel loading notifications complete (#341)

* Notifications panel loading notifications complete

* Use artifical loading for pages after 1

* Change padding

* Add comment for recent notification threshold

* Remove console log

* Format

* Remove unncessary space

* Reset scroll on notification tab change

* Add notification grouping code (#351)

* Add notification grouping code

* Use set to determine valid grouped notification types

* Actually make the grouping work

* Persist context for pushing notifications

* Remove prints

* Fix django db warning'

* Return notification in all branch paths

* No need to return notification

* Notification Component for Notification Panel (#311)

* Outline for Notification components and stylings

* Testing notification

* Complete majority of stylings for notification component, add dummy component and props to PageWrapper.jsx

* Complete stylings for notification component, fix hovers!

* Make small style changes to notification component

* Begin connecting to backend using realistic parameters, not clean or very functional yet

* Begin adapting notification panel to hold notification components

* Finish stylings for notification component and message rendering

* Finish up API methods to updated viewed notification, add token constant to component

* Add logic for rendering notification timestamp, redirect link, and notification message

* Clean up and reduce code, remove redunant or unused sections

* Move renderTimeAgo and getNotification to new NotificationScripts.js file, simplify logic in scripts, remove viewComment from userActions.js, call API.viewNotification directly in component

* Add proper date formatting using dFormatter, string truncation for notification message

* Add double image design to nofications, add project titles to views, fix small format issue in comment template

* Finish up issue, update notification templates for consitency, fix bug in project details useEffect

* Update clapped  web_many message to not include strong tags

* Update web_many message templates to include project name

* Fix url

* Minor fixes, add mobile width dependency, update getMessage() to get consistent character limits, remove mock data from PageWrapper

Co-authored-by: Aditya Jain <[email protected]>

* Notification feature fix (#429)

* Fix most notification feature bugs

* Fix app bar on top of other elements

* Fix panel zindex

* Fix panel loading

* Fix comment notif

Co-authored-by: Aditya Jain <[email protected]>

* Add quotes to template

* linearize migrations

* Fix import

* Add project to template

* Styling fixes

* Delete .gitignore

Co-authored-by: saxytony <[email protected]>
Co-authored-by: AndrewLester <[email protected]>
Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: Grace Zhang <[email protected]>
Co-authored-by: Zora Zhang <[email protected]>
Co-authored-by: saxytony <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
h4i Hack4Impact issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants