Animate the api request panel #31
https://github.com/user-attachments/assets/bff55d9b-b899-4b47-99f8-9f97cbcbaed3
Summary by CodeRabbit#
New Features
- API requests panel is now collapsible, animates open/close, and preserves request history.
- Panel header now contains the clear button and animates with the panel.
Style
- Added overflow-hidden styling to the root element for more stable layout.
- Adjusted mode toggle dropdown alignment for improved positioning.
Refactor
- Simplified two-pane layout and streamlined sidebar/panel integration with reactive panel visibility.
- 1
🚀 Preview Deployment#
Status: ✅ Ready!
Preview URL: Open Preview
Commit:
3ecf8e067743863b6fa86cd53a9f4597b15ce4d5Built and deployed successfully
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/routes/_tutorial._db.projects.tsx (1)
38-38: Consider removing redundant overflow-hidden class.The
overflow-hiddenclass onSidebarProvidermay be redundant since the root<html>element also hasoverflow-hiddenapplied (insrc/routes/__root.tsxline 204). This could be simplified unless there's a specific reason for the duplication.🔎 Proposed simplification
- <SidebarProvider className="w-auto overflow-hidden" defaultOpen> + <SidebarProvider className="w-auto" defaultOpen>src/components/ApiRequestsPanel.tsx (1)
158-169: Add explicit default for isApiPanelOpen.When
userPreferencesis undefined (e.g., during initial load before the query completes),isApiPanelOpenwill beundefined, which JavaScript will coerce tofalsein the animation. While this works, it's better to be explicit about the default state for clarity and to avoid potential animation flicker.🔎 Proposed fix for explicit default
- const isApiPanelOpen = userPreferences?.networkPanel === "open"; + const isApiPanelOpen = userPreferences?.networkPanel === "open" ?? false;📜 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 10c4b4fe2b2e44bdf4fc0fb6db29e1ffe21b5639 and 49db3872ccf0de9ec3966f716aa4bcfe05425e62.
📒 Files selected for processing (3)
src/components/ApiRequestsPanel.tsxsrc/routes/__root.tsxsrc/routes/_tutorial._db.projects.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Prefer functions over arrow functions for React components and everything else Prefertypedeclarations overinterfacedeclarationsFiles:
src/components/ApiRequestsPanel.tsxsrc/routes/__root.tsxsrc/routes/_tutorial._db.projects.tsx
🧠 Learnings (3)
📚 Learning: 2025-12-27T20:43:43.168Z
Learnt from: CR Repo: fulopkovacs/trytanstackdb.com PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-12-27T20:43:43.168Z Learning: Project uses TanStack Start framework with React, TanStack Router, shadcn/ui, and Tailwind CSS v4Applied to files:
src/components/ApiRequestsPanel.tsxsrc/routes/_tutorial._db.projects.tsx
📚 Learning: 2025-12-24T15:25:07.106Z
Learnt from: fulopkovacs Repo: fulopkovacs/trytanstackdb.com PR: 22 File: src/components/TodoBoards.tsx:63-81 Timestamp: 2025-12-24T15:25:07.106Z Learning: In Tailwind CSS v4, prefer canonical classes using bg-linear-to-* (e.g., bg-linear-to-b, bg-linear-to-t, bg-linear-to-r) over the older bg-gradient-to-* syntax. This aligns with Tailwind LSP's suggestCanonicalClasses rule. Apply across TSX files (e.g., src/components/*.tsx); replace occurrences of bg-gradient-to-* with the corresponding bg-linear-to-* equivalents and verify gradients visually.Applied to files:
src/components/ApiRequestsPanel.tsxsrc/routes/__root.tsxsrc/routes/_tutorial._db.projects.tsx
📚 Learning: 2025-12-27T20:43:43.168Z
Learnt from: CR Repo: fulopkovacs/trytanstackdb.com PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-12-27T20:43:43.168Z Learning: The root route is located at `src/route/__root.tsx` in TanStack StartApplied to files:
src/routes/_tutorial._db.projects.tsx
🧬 Code graph analysis (2)
src/components/ApiRequestsPanel.tsx (3)
src/collections/UserPreferences.ts (1)
userPreferencesCollection(12-19)
src/utils/USER_PLACEHOLDER_CONSTANT.ts (1)
USER_PLACEHOLDER(7-12)
src/components/ApiPanelToggle.tsx (4)
ApiPanelToggle(8-44)userPreferencesCollection(28-32)q(9-17)draft(29-32)
src/routes/_tutorial._db.projects.tsx (2)
src/components/AppSidebar.tsx (1)
AppSidebar(28-132)
src/components/ApiRequestsPanel.tsx (1)
ApiRequestsPanel(147-230)
🔇 Additional comments (5)
src/routes/_tutorial._db.projects.tsx (1)
23-29: LGTM! Clean layout simplification.The refactored two-pane layout is much cleaner and easier to understand compared to the previous ResizablePanel-driven approach. The structure clearly separates the sidebar/outlet area from the API requests panel.
src/components/ApiRequestsPanel.tsx (3)
1-1: LGTM! Import additions support the new animation and state management.The new imports are all necessary for the collapsible, animated panel functionality:
eqfor filtering user preferences by IDmotionfor smooth animationsuserPreferencesCollectionfor reactive stateUSER_PLACEHOLDERfor identifying the user record
Also applies to: 8-8, 14-14, 16-16
26-27: LGTM! Sensible animation constants.The panel width of 24rem and animation duration of 0.15s provide a good balance between visibility and smooth transitions.
172-229: Excellent animation implementation with staggered timing!The nested
motion.divstructure with coordinated delays creates a polished user experience:- Opening: width expands first, then content fades in
- Closing: content fades out first, then width collapses
This prevents content from being visible in a compressed state during the transition. The use of
initial={false}also prevents animation on mount, which is the correct approach here.src/routes/__root.tsx (1)
204-204: No action needed —overflow-hiddenon the<html>element will not clip tooltips, modals, or popovers in this codebase. All shadcn/ui components (Popover, Dialog, Sheet, DropdownMenu, Tooltip) and the Sonner Toaster use Radix UI portals withfixedpositioning relative to the viewport, which are unaffected by overflow constraints on ancestor elements. Theoverflow-hiddenclass appropriately prevents document scrolling while allowing fixed-positioned portal elements to render normally.fuko merged thisd46d8d0
fuko closed this
Sign in to join this conversation.
Walkthrough#
Replaces the static API requests panel with a collapsible, animated panel driven by
userPreferences.networkPanel(reactively read viauseLiveQuery). Simplifies route layouts by removing the previous resizable/conditional panel and adds anoverflow-hiddenclass to the root HTML element.Changes#
src/components/ApiRequestsPanel.tsxuserPreferences.networkPanel. Added imports:eq(from@tanstack/react-db),motion(frommotion/react),userPreferencesCollection, andUSER_PLACEHOLDER. IntroducedAPI_PANEL_WIDTHandPANEL_ANIMATION_DURATION. UsesuseLiveQueryto deriveisApiPanelOpen. Moved header/clear button into animated header; request list now renders inside a motion-enabledScrollArea.src/routes/__root.tsxoverflow-hiddenclass to the root<html>element (no control-flow changes).src/routes/_tutorial._db.projects.tsxuseLiveQueryuser-preferences fetching andResizablePanelconditional layout. Replaced with a simpler two-pane layout:AppSidebar + Outletleft,ApiRequestsPanelright. Removed panel sizing/open-state logic and adjustedSidebarProviderusage (className change includesoverflow-hidden).src/components/mode-toggle.tsxDropdownMenuContentalignment fromalign="end"toalign="center"(UI alignment only).Estimated code review effort#
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs#
ApiRequestsPaneland user-preferences-driven panel state (touches same component and collections).src/routes/__root.tsxto addoverflow-hiddenon the root HTML element.Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent 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 49db3872ccf0de9ec3966f716aa4bcfe05425e62 and 3ecf8e067743863b6fa86cd53a9f4597b15ce4d5.
📒 Files selected for processing (1)
src/components/mode-toggle.tsx🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/components/mode-toggle.tsx🧠 Learnings (1)
📚 Learning: 2025-12-24T15:25:07.106Z
Applied to files:
src/components/mode-toggle.tsx🧬 Code graph analysis (1)
src/components/mode-toggle.tsx (1)
⏰ 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). (1)
🔇 Additional comments (1)
Comment `@coderabbitai help` to get the list of available commands and usage tips.