Skip to content

Conversation

@pujitm
Copy link
Member

@pujitm pujitm commented Dec 10, 2024

previously, icons were placed next to bell icon because the status indicators were not accessible to color-blind users. this commit replaces circular status indicators with the icons.

Summary by CodeRabbit

  • New Features

    • Simplified notification indicator logic for improved performance and clarity.
    • Enhanced rendering of notification indicators based on the 'UNREAD' state.
  • Bug Fixes

    • Removed unnecessary timeout mechanism for clearing notification states.
  • Style

    • Adjusted CSS classes for notification indicators to align with new rendering logic.

image
image
image


previously, icons were placed next to bell icon because the status indicators
were not accessible to color-blind users. this commit replaces circular
status indicators with the icons.
the pulse was initially added to provide visual feedback when:

1. a new notification arrived
2. an alert notification was unread

because we began using the legacy notify script, we now get a toast
on new notifications. re:2, feedback on the pulse was mixed, so i'm
removing it.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 10, 2024

Walkthrough

The changes in Indicator.vue focus on the notification indicator logic and template rendering. The hasNewNotifications state and its watcher have been removed, simplifying the logic by eliminating the timeout mechanism. The template now directly checks for the 'UNREAD' state in the indicatorLevel to render the notification indicator. The rendering logic has been streamlined, adjusting CSS classes based on computed properties, resulting in a more straightforward handling of notification states.

Changes

File Path Change Summary
web/components/Notifications/Indicator.vue Removed hasNewNotifications state and its watcher; simplified rendering logic for notification indicators; adjusted CSS classes based on indicatorLevel.

Possibly related PRs

  • fix(web): notification styles #968: The changes in Indicator.vue are directly related to the modifications made in the same file, specifically regarding the notification indicator's logic and styling.

Suggested reviewers

  • zackspear
  • elibosley

Poem

In the burrow where notifications gleam,
A simpler path, a clearer dream.
No more timers, just a bright green light,
Unread messages now shine so bright!
Hopping through code, with joy we sing,
For every change, new wonders we bring! 🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
web/components/Notifications/Indicator.vue (2)

44-47: Consider enhancing the unread indicator's accessibility

While the warning and alert states use distinct icons, the basic unread state still relies solely on a green dot. Consider using a small icon (e.g., a dot with rays) to make it more distinguishable for color-blind users.

-      class="absolute top-0 right-0 size-2.5 rounded-full border border-neutral-800 bg-unraid-green"
+      class="absolute top-0 right-0 size-2.5 flex items-center justify-center"
+    >
+      <span class="block size-2 rounded-full border border-neutral-800 bg-unraid-green" />
+      <span class="absolute size-full animate-ping-slow opacity-75 rounded-full bg-unraid-green" 

42-52: Add ARIA attributes for screen readers

To improve accessibility for screen readers, consider adding appropriate ARIA attributes to convey the notification status.

-  <div class="relative">
+  <div class="relative" role="status" :aria-label="indicatorLevel ? `Notifications: ${indicatorLevel.toLowerCase()}` : 'No new notifications'">
     <BellIcon class="w-6 h-6" />
     <div
       v-if="indicatorLevel === 'UNREAD'"
       class="absolute top-0 right-0 size-2.5 rounded-full border border-neutral-800 bg-unraid-green"
+      aria-hidden="true"
     />
     <component
       :is="icon.component"
       v-else-if="icon && indicatorLevel"
       :class="cn('absolute -top-1 -right-1 size-4 rounded-full', icon.color)"
+      aria-hidden="true"
     />
   </div>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 591bf4a and 43fedd6.

📒 Files selected for processing (1)
  • web/components/Notifications/Indicator.vue (1 hunks)
🔇 Additional comments (1)
web/components/Notifications/Indicator.vue (1)

Line range hint 20-33: LGTM! Good use of semantic color classes for accessibility.

The implementation uses semantic color classes (text-yellow-500, text-unraid-red) which is good for maintainability and accessibility. The icon choices (ExclamationTriangleIcon, ShieldExclamationIcon) also provide clear visual distinction beyond just color, which aligns well with the PR's accessibility goals.

@github-actions
Copy link
Contributor

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL: https://preview.dl.unraid.net/unraid-api/pr/977/dynamix.unraid.net.staging.plg

@pujitm pujitm requested review from mdatelle and zackspear December 10, 2024 19:09
Copy link
Contributor

@mdatelle mdatelle left a comment

Choose a reason for hiding this comment

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

🚀

@pujitm pujitm merged commit f320a77 into main Dec 10, 2024
9 checks passed
@pujitm pujitm deleted the fix/notif-indicator branch December 10, 2024 19:24
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.

4 participants