Skip to content

Conversation

@ComputelessComputer
Copy link
Collaborator

Description

  • Created a new notification badge component for the UI
  • Developed a context system to manage application notifications
  • Integrated the notification badge into the sidebar toggle button

@netlify
Copy link

netlify bot commented Dec 22, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 34c69f6
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/69492d6816241a0008f451f0
😎 Deploy Preview https://deploy-preview-2467--hyprnote.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 project configuration.

@netlify
Copy link

netlify bot commented Dec 22, 2025

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit 34c69f6
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/69492d682f59b3000899fb38
😎 Deploy Preview https://deploy-preview-2467--hyprnote-storybook.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 project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 22, 2025

Warning

Rate limit exceeded

@ComputelessComputer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 24 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between eaa5be2 and 34c69f6.

📒 Files selected for processing (3)
  • apps/desktop/src/components/main/body/index.tsx
  • apps/desktop/src/contexts/notifications.tsx
  • apps/desktop/src/routes/app/main/_layout.tsx
📝 Walkthrough

Walkthrough

Introduces a notification system with a context provider managing notification states including banner visibility, download progress tracking, and badge display. Adds a NotificationBadge UI component for animated visual indicators, and integrates the system via context wrapping in the main layout with event-driven progress updates.

Changes

Cohort / File(s) Summary
Notification Badge Component
apps/desktop/src/components/ui/notification-badge.tsx
New UI component that renders an animated badge with configurable size (sm/md/lg) and visibility, using Framer Motion for scale and fade transitions. Badge positioned absolutely at top-right with red circular background.
Notification Context System
apps/desktop/src/contexts/notifications.tsx
New context provider managing global notification state (banner, enhancement, download progress, badge). Subscribes to local-stt download events, tracks progress with bounds, and derives computed flags (hasActiveBanner, hasActiveDownload, shouldShowBadge). Exports useNotifications hook for consumers.
Integration
apps/desktop/src/components/main/body/index.tsx, apps/desktop/src/routes/app/main/_layout.tsx
Wraps NotificationProvider around route content in main layout; integrates useNotifications hook in header to conditionally render NotificationBadge based on notification state.

Sequence Diagram

sequenceDiagram
    participant User
    participant LocalSTT as Local-STT Events
    participant Provider as NotificationProvider
    participant Context as useNotifications Hook
    participant Badge as NotificationBadge Component

    User->>LocalSTT: Initiate model download
    LocalSTT->>Provider: Emit downloadProgressPayload event
    Note over Provider: Update downloadingModel &<br/>downloadProgress state
    Provider->>Provider: Compute shouldShowBadge<br/>(hasActiveDownload = true)
    Provider->>Context: Notify subscribers of state change
    Context->>Badge: Pass show & notifications state
    Badge->>User: Animate badge entrance<br/>(scale + fade)
    
    loop Download in Progress
        LocalSTT->>Provider: Emit downloadProgressPayload updates
        Provider->>Provider: Update downloadProgress
        Provider->>Context: Notify state change
    end
    
    LocalSTT->>Provider: Download completion/error event
    Provider->>Provider: Reset downloadProgress &<br/>downloadingModel<br/>Compute shouldShowBadge = false
    Provider->>Context: Notify subscribers
    Context->>Badge: Pass show = false
    Badge->>User: Animate badge exit<br/>(scale + fade)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Event listener cleanup and subscription management in NotificationProvider—verify proper cleanup on unmount and no memory leaks
  • State synchronization between download events and UI badge visibility, especially edge cases (rapid start/stop, error conditions)
  • Animation timing and Framer Motion integration in NotificationBadge to ensure smooth transitions across different badge sizes
  • Context provider placement in layout hierarchy and proper provider pattern implementation

Suggested reviewers

  • yujonglee

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: a new notification badge component. It directly relates to the primary feature introduced across multiple files (component, context, and integration).
Description check ✅ Passed The description is directly related to the changeset, covering the three main changes: the new notification badge component, the context system for managing notifications, and integration with the sidebar toggle button.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (2)
apps/desktop/src/contexts/notifications.tsx (1)

110-116: Optional: Remove constant from dependency array.

Since hasActiveEnhancement is a constant false (line 84), it doesn't need to be in the dependency array. However, if you plan to make it dynamic in the future, keeping it is fine for consistency.

🔎 Proposed refactor
  }, [
    hasConfigBanner,
-   hasActiveEnhancement,
    downloadingModel,
    downloadProgress,
    isAiTab,
  ]);
apps/desktop/src/components/ui/notification-badge.tsx (1)

11-20: Move sizeClasses outside the component.

The sizeClasses object is recreated on every render. Move it outside the component to avoid unnecessary object allocation.

🔎 Proposed refactor
+const sizeClasses = {
+  sm: "size-2",
+  md: "size-3",
+  lg: "size-4",
+};
+
 export function NotificationBadge({
   show,
   className,
   size = "sm",
 }: NotificationBadgeProps) {
-  const sizeClasses = {
-    sm: "size-2",
-    md: "size-3",
-    lg: "size-4",
-  };
-
   return (
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6cf957d and eaa5be2.

📒 Files selected for processing (4)
  • apps/desktop/src/components/main/body/index.tsx
  • apps/desktop/src/components/ui/notification-badge.tsx
  • apps/desktop/src/contexts/notifications.tsx
  • apps/desktop/src/routes/app/main/_layout.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

Format using dprint fmt from the root. Do not use cargo fmt.

Files:

  • apps/desktop/src/routes/app/main/_layout.tsx
  • apps/desktop/src/components/ui/notification-badge.tsx
  • apps/desktop/src/components/main/body/index.tsx
  • apps/desktop/src/contexts/notifications.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Avoid creating a bunch of types/interfaces if they are not shared. Especially for function props. Just inline them.
Never do manual state management for form/mutation. Use useForm from tanstack-form and useQuery/useMutation from tanstack-query for 99% cases.

Files:

  • apps/desktop/src/routes/app/main/_layout.tsx
  • apps/desktop/src/components/ui/notification-badge.tsx
  • apps/desktop/src/components/main/body/index.tsx
  • apps/desktop/src/contexts/notifications.tsx
**/*.{ts,tsx,rs,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

By default, avoid writing comments at all. If you write one, it should be about 'Why', not 'What'.

Files:

  • apps/desktop/src/routes/app/main/_layout.tsx
  • apps/desktop/src/components/ui/notification-badge.tsx
  • apps/desktop/src/components/main/body/index.tsx
  • apps/desktop/src/contexts/notifications.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: If there are many classNames with conditional logic, use cn (import from @hypr/utils). Always pass an array and split by logical grouping.
Use motion/react instead of framer-motion.

Files:

  • apps/desktop/src/routes/app/main/_layout.tsx
  • apps/desktop/src/components/ui/notification-badge.tsx
  • apps/desktop/src/components/main/body/index.tsx
  • apps/desktop/src/contexts/notifications.tsx
🧬 Code graph analysis (4)
apps/desktop/src/routes/app/main/_layout.tsx (1)
apps/desktop/src/contexts/notifications.tsx (1)
  • NotificationProvider (43-123)
apps/desktop/src/components/ui/notification-badge.tsx (1)
packages/utils/src/cn.ts (1)
  • cn (20-22)
apps/desktop/src/components/main/body/index.tsx (3)
apps/desktop/src/contexts/notifications.tsx (1)
  • useNotifications (125-133)
extensions/shared/types/hypr-extension.d.ts (1)
  • Button (159-159)
apps/desktop/src/components/ui/notification-badge.tsx (1)
  • NotificationBadge (11-40)
apps/desktop/src/contexts/notifications.tsx (2)
apps/desktop/src/config/use-config.ts (1)
  • useConfigValues (42-72)
crates/owhisper-client/src/adapter/parsing.rs (1)
  • value (104-104)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: desktop_ci (linux, depot-ubuntu-22.04-8)
  • GitHub Check: desktop_ci (linux, depot-ubuntu-24.04-8)
  • GitHub Check: fmt
  • GitHub Check: Redirect rules - hyprnote
  • GitHub Check: Header rules - hyprnote
  • GitHub Check: Pages changed - hyprnote
🔇 Additional comments (4)
apps/desktop/src/contexts/notifications.tsx (1)

66-82: LGTM: Proper event listener cleanup and progress clamping.

The event listener correctly handles the Promise-based cleanup, and the progress clamping (0-100) prevents invalid values from appearing in the UI.

apps/desktop/src/routes/app/main/_layout.tsx (1)

66-69: LGTM: Proper context provider integration.

The NotificationProvider is correctly positioned in the component tree, wrapping the tool registration and routing logic to make notification state available throughout the app.

apps/desktop/src/components/main/body/index.tsx (1)

126-136: LGTM: Badge integration with proper positioning.

The NotificationBadge is correctly positioned relative to the panel toggle button, and the shouldShowBadge flag properly controls visibility.

apps/desktop/src/components/ui/notification-badge.tsx (1)

22-39: LGTM: Clean animation implementation.

The badge animation is smooth and appropriate. The use of AnimatePresence with scale/opacity transitions provides good visual feedback, and the styling follows conventions for notification badges.

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.

2 participants