Skip to content

Comments

Show progressive blur at scroll ends in AI view#2330

Merged
ComputelessComputer merged 2 commits intomainfrom
ui/ai-scroll-edge-gradients
Dec 20, 2025
Merged

Show progressive blur at scroll ends in AI view#2330
ComputelessComputer merged 2 commits intomainfrom
ui/ai-scroll-edge-gradients

Conversation

@ComputelessComputer
Copy link
Collaborator

Add a scroll container with state tracking and edge gradient overlays to AI view so a progressive blur appears at the top and bottom when content is scrollable. Use a ref, ResizeObserver and a scroll listener to detect atStart/atEnd and avoid showing gradients when scrolling is at the very start or end. This matches the behavior used in body/index.tsx and prevents gradients from showing on initial or fully-scrolled states.

Add a scroll container with state tracking and edge gradient overlays to AI view so a progressive blur appears at the top and bottom when content is scrollable. Use a ref, ResizeObserver and a scroll listener to detect atStart/atEnd and avoid showing gradients when scrolling is at the very start or end. This matches the behavior used in body/index.tsx and prevents gradients from showing on initial or fully-scrolled states.
@netlify
Copy link

netlify bot commented Dec 16, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit cbdcfe2
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6942089576c331000898cfdd
😎 Deploy Preview https://deploy-preview-2330--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 16, 2025

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit cbdcfe2
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6942089576c331000898cfdf
😎 Deploy Preview https://deploy-preview-2330--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 16, 2025

📝 Walkthrough

Walkthrough

Adds client-side scroll handling to the AI component: a ref-backed inner scroll container, a scrollState with atStart/atEnd, an updateScrollState helper, a useEffect that attaches a scroll listener plus a ResizeObserver with cleanup, and conditional gradient overlays; imports updated for React hooks.

Changes

Cohort / File(s) Change Summary
Scroll state & UI structure
apps/desktop/src/components/main/body/ai.tsx
Added scrollContainerRef and scrollState (atStart/atEnd); implemented updateScrollState; added useEffect to attach scroll listener and ResizeObserver with cleanup; refactored outer wrapper and inner scrollable element; added conditional gradient overlays; updated imports to include useEffect, useRef, and useState.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify useEffect cleanup for both the scroll listener and the ResizeObserver
  • Confirm correctness of updateScrollState calculations using scrollTop, scrollHeight, and clientHeight
  • Check conditional rendering and CSS positioning of gradient overlays for various container sizes and content lengths

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 'Show progressive blur at scroll ends in AI view' directly and clearly describes the main change: adding progressive blur effects at scroll boundaries in the AI view component.
Description check ✅ Passed The description is directly related to the changeset, explaining the implementation of scroll container state tracking, gradient overlays, and the specific detection mechanism using refs and ResizeObserver.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ui/ai-scroll-edge-gradients

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.

@ComputelessComputer ComputelessComputer force-pushed the ui/ai-scroll-edge-gradients branch from 6dc6a5b to e895a5b Compare December 16, 2025 09:28
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 (1)
apps/desktop/src/components/main/body/ai.tsx (1)

122-135: Verify gradient background assumption and consider removing redundant class.

The implementation correctly adds scroll-aware gradient overlays. Two items to consider:

  1. Redundant flex-1 class: On line 125, the flex-1 class is redundant since the parent (line 122) is not a flex container. Only h-full is needed to fill the parent height.

  2. Gradient color assumption: The gradients use from-white (lines 130, 133), assuming the background is always white. Please verify this matches the actual background color, or consider using a CSS variable to ensure theme compatibility.

Note: The PR title mentions "progressive blur," but the implementation uses gradient fades (bg-gradient-to-b/t), which is a standard pattern for indicating scrollable content.

Apply this diff to remove the redundant class:

-          className="flex-1 w-full h-full overflow-y-auto scrollbar-hide px-6 pb-6"
+          className="w-full h-full overflow-y-auto scrollbar-hide px-6 pb-6"
📜 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 e895a5b and cbdcfe2.

📒 Files selected for processing (1)
  • apps/desktop/src/components/main/body/ai.tsx (4 hunks)
🧰 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/components/main/body/ai.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/components/main/body/ai.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/components/main/body/ai.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/components/main/body/ai.tsx
🧬 Code graph analysis (1)
apps/desktop/src/components/main/body/ai.tsx (2)
apps/desktop/src/components/settings/ai/stt/index.tsx (1)
  • STT (4-11)
apps/desktop/src/components/settings/ai/llm/index.tsx (1)
  • LLM (4-11)
⏰ 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: Redirect rules - hyprnote
  • GitHub Check: Header rules - hyprnote
  • GitHub Check: Pages changed - hyprnote
  • GitHub Check: fmt
  • GitHub Check: desktop_ci (linux, depot-ubuntu-22.04-8)
  • GitHub Check: desktop_ci (linux, depot-ubuntu-24.04-8)
🔇 Additional comments (4)
apps/desktop/src/components/main/body/ai.tsx (4)

2-2: LGTM!

The additional React hooks are appropriate for the scroll state management being introduced.


55-59: LGTM!

The ref and state initialization is correct. Setting both atStart and atEnd to true initially prevents gradients from appearing before the first scroll state calculation.


68-76: LGTM!

The scroll state calculation logic is correct, and the 1px threshold appropriately handles sub-pixel scrolling and rounding issues.


78-91: LGTM!

The scroll listener and ResizeObserver setup is correct with proper cleanup. Including activeTab in the dependencies ensures the scroll state updates immediately when switching tabs, rather than waiting for the ResizeObserver to fire after content change.

@ComputelessComputer ComputelessComputer merged commit f55098e into main Dec 20, 2025
16 checks passed
@ComputelessComputer ComputelessComputer deleted the ui/ai-scroll-edge-gradients branch December 20, 2025 13:01
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