-
Notifications
You must be signed in to change notification settings - Fork 0
Add in-site notification feature to Docusaurus #814
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
Conversation
Adjust notification styles for consistency with other dropdown menus.
Clicking a link in the notification dropdown and then clicking another link resulted in a broken link because the relative path was taken into account when then next link was clicked. For example, if the relative link was `AAA/BBB`, then when the link `CCC/DDD` was selected, the URL would be `AAA/CCC/DDD`. This commit ensures that the base URL is called first and then the relative link in the notification message is applied to that base link.
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.
Pull Request Overview
This pull request introduces an in-site notification feature to enhance visitor engagement on the Docusaurus documentation site. The key changes include adding a custom NotificationBell component, implementing notification data and utility functions, and updating the navbar and configuration to integrate the notification bell.
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/theme/NavbarItem/index.tsx | Integrates the NotificationBell via a condition on the item type |
src/data/notifications.js | Implements notifications data and utility functions for language-specific handling |
src/components/NotificationBell.tsx | Develops the NotificationBell component with dynamic notification retrieval and localStorage tracking |
docusaurus.config.js | Updates the navbar configuration to include a custom notification bell entry |
Files not reviewed (2)
- package.json: Language not supported
- src/css/custom.css: Language not supported
Comments suppressed due to low confidence (1)
src/theme/NavbarItem/index.tsx:10
- [nitpick] The 'notifications' prop is declared in the component props but is not used when 'type' equals 'custom-NotificationBell'. Consider either removing this prop or using it if external notification data should override the internal getNotifications call.
notifications?: any[];
Co-authored-by: Copilot <[email protected]>
e89fa24
to
c9835b5
Compare
Implemented content fingerprinting to detect changes in notification messages and URLs. When content changes, the system automatically increments the version number, marking the notification as unread.
c9835b5
to
1bbb91d
Compare
✅ Deploy Preview for staging-scalardl-docs-site ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Description
This pull request introduces a new in-site notification feature to enhance visitor engagement by displaying notifications in the navigation bar at the top of the page in both English and Japanese. The changes include adding a custom notification bell component, integrating it into the navbar, and styling it for both desktop and mobile views. Additionally, a data structure and utility functions were implemented to manage notifications dynamically based on user language and read status.
Related issues and/or PRs
N/A
Changes made
Notification feature implementation:
NotificationBell
component to display notifications, track read/unread status, and handle user interactions. Notifications are fetched dynamically and support language-specific (English or Japanese) messages.getNotifications
for fetching notifications based on language anddetectLanguage
for determining the user's language from the URL.custom-NotificationBell
. Notifications are passed dynamically to the component.Configuration and styling
getNotifications
function and add a custom navbar item for the notification bell. [1] [2]Dependency updates
@fortawesome/fontawesome-free
for consistent icon usage across the notification bell component.Checklist
Additional notes (optional)
N/A