Skip to content

Fix premium side nav in collapsed mode#897

Merged
elie222 merged 1 commit intomainfrom
fix/premium-sidenav
Nov 3, 2025
Merged

Fix premium side nav in collapsed mode#897
elie222 merged 1 commit intomainfrom
fix/premium-sidenav

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Nov 3, 2025

Fixes #896

Summary by CodeRabbit

  • Improvements
    • Premium Expired Card now intelligently adapts based on sidebar visibility. When the sidebar is hidden, it displays in a compact format as an alert icon that expands on hover to show subscription details and reactivation options for a streamlined experience.

@vercel
Copy link

vercel bot commented Nov 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
inbox-zero Ready Ready Preview Nov 3, 2025 1:29pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

This PR addresses a broken subscription issue banner in the left sidebar by introducing a collapsed rendering mode to PremiumExpiredCard. When the sidebar is collapsed, the component renders a compact HoverCard with an AlertTriangle trigger; when expanded, it displays the full card. The SideNav component passes the isCollapsed prop based on sidebar visibility state, and the version is bumped to v2.17.28.

Changes

Cohort / File(s) Summary
PremiumExpiredCard component enhancement
apps/web/components/PremiumExpiredCard.tsx
Added isCollapsed prop (default false) to both PremiumExpiredCard and PremiumExpiredCardContent. When collapsed, renders a HoverCard with AlertTriangle trigger instead of full card. Imported HoverCard component. Updated onDismiss handler to be undefined when collapsed. Adjusted classNames and conditional rendering to support collapsed state.
SideNav component integration
apps/web/components/SideNav.tsx
Updated PremiumExpiredCard usage to pass isCollapsed prop computed as negation of sidebar visibility state (!state.includes("left-sidebar")).
Version bump
version.txt
Updated version string from v2.17.27 to v2.17.28.

Sequence Diagram(s)

sequenceDiagram
    participant SideNav
    participant PremiumExpiredCard
    participant HoverCard
    participant FullCard

    SideNav->>SideNav: Determine sidebar state<br/>(left-sidebar visible?)
    SideNav->>PremiumExpiredCard: Pass isCollapsed prop<br/>(negation of visible)
    
    alt Sidebar Expanded (isCollapsed=false)
        PremiumExpiredCard->>FullCard: Render full card<br/>with Reactivate button
        FullCard->>FullCard: Show dismissible banner
    else Sidebar Collapsed (isCollapsed=true)
        PremiumExpiredCard->>HoverCard: Render compact trigger
        HoverCard->>HoverCard: AlertTriangle icon visible
        HoverCard->>HoverCard: Hover shows subscription details<br/>and Reactivate button
        Note over HoverCard: No dismiss action
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • PremiumExpiredCard.tsx: Requires careful review of the HoverCard conditional rendering logic and onDismiss handler adjustment
  • SideNav.tsx: Verify that the sidebar state negation logic correctly maps to collapsed/expanded intent
  • Integration: Confirm the collapsed and expanded states render appropriately across different viewport/sidebar configurations

Possibly related PRs

  • Premium expired sidebar card #816: Main PR that extends PremiumExpiredCard with the isCollapsed prop addition and updates the component signatures—directly related as this PR refines the same component.

Poem

🐰 Hop, hop—the banner now bends with grace,
A compact icon finds its place,
When sidebars shrink, it hides away,
Then blooms again in expanded display!

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Fix premium side nav in collapsed mode' directly and clearly relates to the main changes in the changeset. The PR modifies the PremiumExpiredCard component to accept an isCollapsed prop and adjusts the SideNav component to conditionally render the card in a collapsed state based on sidebar visibility. The title accurately captures the primary objective of fixing the subscription banner display when the sidebar is collapsed.
Linked Issues check ✅ Passed The PR addresses issue #896 which reports a visually broken subscription banner in the left sidebar. The code changes implement conditional rendering of the PremiumExpiredCard component based on sidebar collapse state through a new isCollapsed prop. When isCollapsed is true, the card renders in a HoverCard format with an AlertTriangle trigger icon instead of the standard card layout, directly addressing the visual layout issue reported in the linked issue.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the premium subscription banner display in collapsed sidebar mode. The PremiumExpiredCard component receives new conditional rendering logic, SideNav passes the isCollapsed state, and version.txt is incremented as a routine version bump. No unrelated refactoring, style changes, or feature additions were introduced outside the scope of addressing the visual issue in issue #896.
✨ 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 fix/premium-sidenav

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: 1

📜 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 e2a7844 and 256d2dd.

📒 Files selected for processing (3)
  • apps/web/components/PremiumExpiredCard.tsx (4 hunks)
  • apps/web/components/SideNav.tsx (1 hunks)
  • version.txt (1 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{ts,tsx}: Use TypeScript with strict null checks
Path aliases: Use @/ for imports from project root
Use proper error handling with try/catch blocks
Format code with Prettier
Leverage TypeScript inference for better DX

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
apps/web/**/*.tsx

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.tsx: Follow tailwindcss patterns with prettier-plugin-tailwindcss
Prefer functional components with hooks
Use shadcn/ui components when available
Ensure responsive design with mobile-first approach
Follow consistent naming conventions (PascalCase for components)
Use LoadingContent component for async data
Use result?.serverError with toastError and toastSuccess
Use LoadingContent component to handle loading and error states consistently
Pass loading, error, and children props to LoadingContent

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
apps/web/components/**/*.tsx

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Use React Hook Form with Zod validation for form handling

Use the LoadingContent component to handle loading and error states consistently in data-fetching components.

Use PascalCase for components (e.g. components/Button.tsx)

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
!{.cursor/rules/*.mdc}

📄 CodeRabbit inference engine (.cursor/rules/cursor-rules.mdc)

Never place rule files in the project root, in subdirectories outside .cursor/rules, or in any other location

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
  • version.txt
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)

**/*.tsx: Use React Hook Form with Zod for validation
Validate form inputs before submission
Show validation errors inline next to form fields

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)

**/*.{ts,tsx}: Use createScopedLogger for logging in backend TypeScript files
Typically add the logger initialization at the top of the file when using createScopedLogger
Only use .with() on a logger instance within a specific function, not for a global logger

Import Prisma in the project using import prisma from "@/utils/prisma";

**/*.{ts,tsx}: Don't use TypeScript enums.
Don't use TypeScript const enum.
Don't use the TypeScript directive @ts-ignore.
Don't use primitive type aliases or misleading types.
Don't use empty type parameters in type aliases and interfaces.
Don't use any or unknown as type constraints.
Don't use implicit any type on variable declarations.
Don't let variables evolve into any type through reassignments.
Don't use non-null assertions with the ! postfix operator.
Don't misuse the non-null assertion operator (!) in TypeScript files.
Don't use user-defined types.
Use as const instead of literal types and type annotations.
Use export type for types.
Use import type for types.
Don't declare empty interfaces.
Don't merge interfaces and classes unsafely.
Don't use overload signatures that aren't next to each other.
Use the namespace keyword instead of the module keyword to declare TypeScript namespaces.
Don't use TypeScript namespaces.
Don't export imported variables.
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.
Don't use parameter properties in class constructors.
Use either T[] or Array consistently.
Initialize each enum member value explicitly.
Make sure all enum members are literal values.

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{js,jsx,ts,tsx}: Don't use elements in Next.js projects.
Don't use elements in Next.js projects.
Don't use namespace imports.
Don't access namespace imports dynamically.
Don't use global eval().
Don't use console.
Don't use debugger.
Don't use var.
Don't use with statements in non-strict contexts.
Don't use the arguments object.
Don't use consecutive spaces in regular expression literals.
Don't use the comma operator.
Don't use unnecessary boolean casts.
Don't use unnecessary callbacks with flatMap.
Use for...of statements instead of Array.forEach.
Don't create classes that only have static members (like a static namespace).
Don't use this and super in static contexts.
Don't use unnecessary catch clauses.
Don't use unnecessary constructors.
Don't use unnecessary continue statements.
Don't export empty modules that don't change anything.
Don't use unnecessary escape sequences in regular expression literals.
Don't use unnecessary labels.
Don't use unnecessary nested block statements.
Don't rename imports, exports, and destructured assignments to the same name.
Don't use unnecessary string or template literal concatenation.
Don't use String.raw in template literals when there are no escape sequences.
Don't use useless case statements in switch statements.
Don't use ternary operators when simpler alternatives exist.
Don't use useless this aliasing.
Don't initialize variables to undefined.
Don't use the void operators (they're not familiar).
Use arrow functions instead of function expressions.
Use Date.now() to get milliseconds since the Unix Epoch.
Use .flatMap() instead of map().flat() when possible.
Use literal property access instead of computed property access.
Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.
Use concise optional chaining instead of chained logical expressions.
Use regular expression literals instead of the RegExp constructor when possible.
Don't use number literal object member names th...

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
!pages/_document.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

!pages/_document.{js,jsx,ts,tsx}: Don't import next/document outside of pages/_document.jsx in Next.js projects.
Don't import next/document outside of pages/_document.jsx in Next.js projects.

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
  • version.txt
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{jsx,tsx}: Don't destructure props inside JSX components in Solid projects.
Don't use both children and dangerouslySetInnerHTML props on the same element.
Don't use Array index in keys.
Don't assign to React component props.
Don't define React components inside other components.
Don't use event handlers on non-interactive elements.
Don't assign JSX properties multiple times.
Don't add extra closing tags for components without children.
Use <>...</> instead of ....
Don't insert comments as text nodes.
Don't use the return value of React.render.
Make sure all dependencies are correctly specified in React hooks.
Make sure all React hooks are called from the top level of component functions.
Don't use unnecessary fragments.
Don't pass children as props.
Use semantic elements instead of role attributes in JSX.

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
**/*.{html,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{html,jsx,tsx}: Don't use or elements.
Don't use accessKey attribute on any HTML element.
Don't set aria-hidden="true" on focusable elements.
Don't add ARIA roles, states, and properties to elements that don't support them.
Only use the scope prop on elements.
Don't assign non-interactive ARIA roles to interactive HTML elements.
Make sure label elements have text content and are associated with an input.
Don't assign interactive ARIA roles to non-interactive HTML elements.
Don't assign tabIndex to non-interactive HTML elements.
Don't use positive integers for tabIndex property.
Don't include "image", "picture", or "photo" in img alt prop.
Don't use explicit role property that's the same as the implicit/default role.
Make static elements with click handlers use a valid role attribute.
Always include a title element for SVG elements.
Give all elements requiring alt text meaningful information for screen readers.
Make sure anchors have content that's accessible to screen readers.
Assign tabIndex to non-interactive HTML elements with aria-activedescendant.
Include all required ARIA attributes for elements with ARIA roles.
Make sure ARIA properties are valid for the element's supported roles.
Always include a type attribute for button elements.
Make elements with interactive roles and handlers focusable.
Give heading elements content that's accessible to screen readers (not hidden with aria-hidden).
Always include a lang attribute on the html element.
Always include a title attribute for iframe elements.
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress.
Accompany onMouseOver/onMouseOut with onFocus/onBlur.
Include caption tracks for audio and video elements.
Make sure all anchors are valid and navigable.
Ensure all ARIA properties (aria-*) are valid.
Use valid, non-abstract ARIA roles for elements with ARIA roles.
Use valid ARIA state and property values.
Use valid values for the autocomplete attribute on input eleme...

Files:

  • apps/web/components/PremiumExpiredCard.tsx
  • apps/web/components/SideNav.tsx
🧬 Code graph analysis (2)
apps/web/components/PremiumExpiredCard.tsx (1)
apps/web/components/HoverCard.tsx (1)
  • HoverCard (7-20)
apps/web/components/SideNav.tsx (1)
apps/web/components/PremiumExpiredCard.tsx (1)
  • PremiumExpiredCard (186-205)
⏰ 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). (3)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: test
🔇 Additional comments (5)
version.txt (1)

1-1: LGTM!

Version bump aligns with the UI changes for collapsed sidebar support.

apps/web/components/SideNav.tsx (1)

236-236: LGTM!

The isCollapsed prop is correctly derived from the sidebar state. When the sidebar doesn't include "left-sidebar" in its state, the card should render in collapsed mode.

apps/web/components/PremiumExpiredCard.tsx (3)

11-11: LGTM!

HoverCard import is appropriately added to support the collapsed rendering mode.


26-30: LGTM!

The isCollapsed parameter is properly typed with a sensible default, maintaining backward compatibility while enabling the new collapsed rendering mode.


186-204: LGTM!

The wrapper component correctly handles the collapsed state:

  • Accepts the isCollapsed prop with a backward-compatible default
  • Centers the content when collapsed
  • Intentionally disables dismissal in collapsed mode (since there's no space for a dismiss button)
  • Properly forwards all props to the content component

Comment on lines +98 to +133
// When collapsed, show only the alert icon with a hover card
if (isCollapsed) {
return (
<HoverCard
className="w-64"
content={
<div className="space-y-2">
<p className="text-sm font-semibold text-orange-800 dark:text-orange-200">
{title}
</p>
<p className="text-sm text-muted-foreground">{description}</p>
<Button
asChild
size="sm"
className="w-full bg-orange-600 text-white hover:bg-orange-700 border-0 shadow-sm h-8 mt-2"
>
<Link
href="/settings"
className="flex items-center justify-center gap-1.5"
>
<CreditCardIcon className="h-3.5 w-3.5" />
<span className="text-xs font-medium">Reactivate</span>
</Link>
</Button>
</div>
}
>
<Link
href="/settings"
className="flex items-center justify-center p-2 rounded-lg bg-orange-100 hover:bg-orange-200 transition-colors dark:bg-orange-900/30 dark:hover:bg-orange-900/50"
>
<AlertTriangleIcon className="h-5 w-5 text-orange-600 dark:text-orange-400" />
</Link>
</HoverCard>
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add accessible label to the collapsed trigger link.

The collapsed rendering logic is well-implemented, but the Link element (lines 125-130) lacks an accessible name for screen readers. Users relying on assistive technology won't know what this link does.

Apply this diff to add an accessible label:

         <Link
           href="/settings"
           className="flex items-center justify-center p-2 rounded-lg bg-orange-100 hover:bg-orange-200 transition-colors dark:bg-orange-900/30 dark:hover:bg-orange-900/50"
+          aria-label={title}
         >
           <AlertTriangleIcon className="h-5 w-5 text-orange-600 dark:text-orange-400" />
         </Link>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// When collapsed, show only the alert icon with a hover card
if (isCollapsed) {
return (
<HoverCard
className="w-64"
content={
<div className="space-y-2">
<p className="text-sm font-semibold text-orange-800 dark:text-orange-200">
{title}
</p>
<p className="text-sm text-muted-foreground">{description}</p>
<Button
asChild
size="sm"
className="w-full bg-orange-600 text-white hover:bg-orange-700 border-0 shadow-sm h-8 mt-2"
>
<Link
href="/settings"
className="flex items-center justify-center gap-1.5"
>
<CreditCardIcon className="h-3.5 w-3.5" />
<span className="text-xs font-medium">Reactivate</span>
</Link>
</Button>
</div>
}
>
<Link
href="/settings"
className="flex items-center justify-center p-2 rounded-lg bg-orange-100 hover:bg-orange-200 transition-colors dark:bg-orange-900/30 dark:hover:bg-orange-900/50"
>
<AlertTriangleIcon className="h-5 w-5 text-orange-600 dark:text-orange-400" />
</Link>
</HoverCard>
);
}
// When collapsed, show only the alert icon with a hover card
if (isCollapsed) {
return (
<HoverCard
className="w-64"
content={
<div className="space-y-2">
<p className="text-sm font-semibold text-orange-800 dark:text-orange-200">
{title}
</p>
<p className="text-sm text-muted-foreground">{description}</p>
<Button
asChild
size="sm"
className="w-full bg-orange-600 text-white hover:bg-orange-700 border-0 shadow-sm h-8 mt-2"
>
<Link
href="/settings"
className="flex items-center justify-center gap-1.5"
>
<CreditCardIcon className="h-3.5 w-3.5" />
<span className="text-xs font-medium">Reactivate</span>
</Link>
</Button>
</div>
}
>
<Link
href="/settings"
className="flex items-center justify-center p-2 rounded-lg bg-orange-100 hover:bg-orange-200 transition-colors dark:bg-orange-900/30 dark:hover:bg-orange-900/50"
aria-label={title}
>
<AlertTriangleIcon className="h-5 w-5 text-orange-600 dark:text-orange-400" />
</Link>
</HoverCard>
);
}
🤖 Prompt for AI Agents
In apps/web/components/PremiumExpiredCard.tsx around lines 98 to 133, the
collapsed trigger Link (the orange square with the AlertTriangleIcon) lacks an
accessible name for screen readers; add an accessible label by giving the Link
either an aria-label (e.g., aria-label="Open settings to reactivate premium") or
include a visually-hidden span with descriptive text inside the Link so
assistive technologies can announce its purpose, keeping the visible UI
unchanged.

@elie222 elie222 merged commit 0af2ad9 into main Nov 3, 2025
17 checks passed
@elie222 elie222 deleted the fix/premium-sidenav branch November 3, 2025 13:30
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="apps/web/components/PremiumExpiredCard.tsx">

<violation number="1" location="apps/web/components/PremiumExpiredCard.tsx:115">
Icon-only Link lacks an accessible name; add an aria-label so screen readers can announce its purpose</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

className="w-full bg-orange-600 text-white hover:bg-orange-700 border-0 shadow-sm h-8 mt-2"
>
<Link
href="/settings"
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 3, 2025

Choose a reason for hiding this comment

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

Icon-only Link lacks an accessible name; add an aria-label so screen readers can announce its purpose

Prompt for AI agents
Address the following comment on apps/web/components/PremiumExpiredCard.tsx at line 115:

<comment>Icon-only Link lacks an accessible name; add an aria-label so screen readers can announce its purpose</comment>

<file context>
@@ -93,6 +95,43 @@ export function PremiumExpiredCardContent({
+              className=&quot;w-full bg-orange-600 text-white hover:bg-orange-700 border-0 shadow-sm h-8 mt-2&quot;
+            &gt;
+              &lt;Link
+                href=&quot;/settings&quot;
+                className=&quot;flex items-center justify-center gap-1.5&quot;
+              &gt;
</file context>
Suggested change
href="/settings"
href="/settings" aria-label={title}
Fix with Cubic

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.

Subscription Issue Banner Broken on Sidebar

1 participant