Add new mux onboarding video for assistant#807
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded@elie222 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 25 minutes and 6 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (2)
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughReplaces YouTube-only video handling with optional Mux playback across onboarding and video components, updates related prop types/usages, removes the onboarding "Set Up" button and modal from AssistantTabs, and adds image.mux.com to Next.js image remote patterns. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as Onboarding UI
participant Player as Video Renderer
User->>UI: Open onboarding dialog
alt muxPlaybackId provided
UI->>Player: Render Mux player with muxPlaybackId
else youtubeVideoId provided
UI->>Player: Render YouTube player with youtubeVideoId
else
UI->>Player: Render nothing
end
sequenceDiagram
autonumber
participant Page as Automation Page
participant Card as VideoCard
participant Player as Video Renderer
Page->>Card: Pass props (muxPlaybackId?, videoSrc?, thumbnailSrc?)
alt muxPlaybackId present
Card->>Player: Render MuxPlayer + Mux thumbnail
else videoSrc present
Card->>Player: Render iframe + provided thumbnail
else
Card-->>Page: No video rendered
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/web/components/VideoCard.tsx (2)
18-20: Blocker: circular type reference causes TS error.type VideoCardProps references typeof VideoCard before it’s declared (const), which breaks under strict mode.
Apply:
import Image from "next/image"; import MuxPlayer from "@mux/mux-player-react"; ... -import { ClientOnly } from "@/components/ClientOnly"; +import { ClientOnly } from "@/components/ClientOnly"; -type VideoCardProps = ComponentProps<typeof VideoCard> & { - storageKey: string; -}; +type BaseVideoCardProps = React.HTMLAttributes<HTMLDivElement> & { + icon?: React.ReactNode; + title: string; + description: string; + videoSrc?: string; + thumbnailSrc?: string; + muxPlaybackId?: string; + onClose?: () => void; +}; + +type VideoCardProps = BaseVideoCardProps & { storageKey: string }; export function DismissibleVideoCard({ storageKey, ...props }: VideoCardProps) { ... -const VideoCard = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes<HTMLDivElement> & { - icon?: React.ReactNode; - title: string; - description: string; - videoSrc?: string; - thumbnailSrc?: string; - muxPlaybackId?: string; - onClose?: () => void; - } ->( +const VideoCard = React.forwardRef<HTMLDivElement, BaseVideoCardProps>(Also applies to: 44-55
70-71: Guard Next/Image src — empty string will crash at runtime.If neither muxPlaybackId nor thumbnailSrc is provided, src becomes "", which Next/Image rejects.
Apply:
) => { const [isOpen, setIsOpen] = useState(false); + const thumbSrc = muxPlaybackId + ? `https://image.mux.com/${muxPlaybackId}/thumbnail.jpg` + : thumbnailSrc; ... - <Image - src={ - muxPlaybackId - ? `https://image.mux.com/${muxPlaybackId}/thumbnail.jpg` - : thumbnailSrc || "" - } - alt={title} - fill - className="object-cover transition-all duration-200 group-hover:scale-105" - sizes="(max-width: 128px) 100vw, 128px" - /> + {thumbSrc ? ( + <Image + src={thumbSrc} + alt={title} + fill + className="object-cover transition-all duration-200 group-hover:scale-105" + sizes="(max-width: 128px) 100vw, 128px" + /> + ) : ( + <div + className="absolute inset-0 bg-gray-100 dark:bg-gray-800" + aria-hidden="true" + /> + )}Also applies to: 119-124
🧹 Nitpick comments (9)
apps/web/next.config.ts (1)
203-224: Tighten frame-src to only required origins
frame-src 'self' https:is overly broad. Narrow to needed providers (Mux, and YouTube if still supported) to improve CSP posture.Apply this diff:
- "frame-src 'self' https:", + "frame-src 'self' https://*.mux.com https://www.youtube.com https://www.youtube-nocookie.com",If YouTube is fully removed, drop those two YouTube origins accordingly.
apps/web/components/PageHeader.tsx (1)
10-11: Model video source as a discriminated union (optional).To prevent accidentally passing both IDs or neither, consider a union type that encodes the invariant “exactly one source.” This improves DX and avoids ambiguous precedence.
Apply:
type Video = { title: string; description: React.ReactNode; - youtubeVideoId?: string; - muxPlaybackId?: string; +} & ( + | { youtubeVideoId: string; muxPlaybackId?: never } + | { muxPlaybackId: string; youtubeVideoId?: never } +);apps/web/app/(app)/[emailAccountId]/automation/page.tsx (2)
53-55: Fix Next.js route prop types (remove Promise wrappers).In App Router, params/searchParams are plain objects. The Promise types add confusion and aren’t needed.
Apply:
export default async function AutomationPage({ params, searchParams, }: { - params: Promise<{ emailAccountId: string }>; - searchParams: Promise<{ tab: string }>; + params: { emailAccountId: string }; + searchParams: { tab?: string }; }) { - const { emailAccountId } = await params; - const { tab } = await searchParams; + const { emailAccountId } = params; + const { tab } = searchParams;
166-169: Make tab optional in TabNavigation’s props.tab can be undefined; the function already handles a fallback when rendering.
Apply:
-}: { - emailAccountId: string; - tab: string; - hasPendingRule: Promise<boolean>; -}) { +}: { + emailAccountId: string; + tab?: string; + hasPendingRule: Promise<boolean>; +}) {apps/web/components/VideoCard.tsx (2)
170-170: Fix displayName to match the component.Helps DevTools and error boundaries.
Apply:
-VideoCard.displayName = "ActionCard"; +VideoCard.displayName = "VideoCard";
118-136: Accessibility nit: ensure the preview button is a real button everywhere.The preview trigger is a button (good). For completeness, consider aria-describedby linking to title/description container for better context, but optional.
apps/web/components/OnboardingModal.tsx (3)
21-29: Type the video source more strictly (optional).Avoid ambiguous states by requiring exactly one of youtubeVideoId or muxPlaybackId.
Apply:
export function OnboardingModal({ title, description, - youtubeVideoId, - muxPlaybackId, + youtubeVideoId, + muxPlaybackId, buttonProps, }: { title: string; description: React.ReactNode; - youtubeVideoId?: string; - muxPlaybackId?: string; + youtubeVideoId?: string; + muxPlaybackId?: string; buttonProps?: React.ComponentProps<typeof Button>; }) {Or, for stricter safety, introduce:
type VideoSource = { youtubeVideoId: string; muxPlaybackId?: never } | { muxPlaybackId: string; youtubeVideoId?: never };and use it in these component prop types.
Also applies to: 82-89
35-47: Hide the “Watch demo” button if no video is provided (defensive).Prevents opening an empty dialog if both IDs are missing.
Apply:
- <Button onClick={openModal} className="text-nowrap" {...buttonProps}> + {(youtubeVideoId || muxPlaybackId) && ( + <Button onClick={openModal} className="text-nowrap" {...buttonProps}> <PlayIcon className="mr-2 h-4 w-4" /> Watch demo - </Button> + </Button> + )}
3-5: Simplify YouTube sizing to CSS (optional perf/complexity).You can drop useWindowSize and width/height opts; YouTubeVideo already applies responsive classes. Let the container control sizing.
Apply:
-import { useLocalStorage, useWindowSize } from "usehooks-ts"; +import { useLocalStorage } from "usehooks-ts"; ... - const { width } = useWindowSize(); - - const videoWidth = Math.min(width * 0.75, 1200); - const videoHeight = videoWidth * (675 / 1200); + // Let CSS handle responsive sizing. ... - opts={{ - height: `${videoHeight}`, - width: `${videoWidth}`, - playerVars: { - // https://developers.google.com/youtube/player_parameters - autoplay: 1, - }, - }} + opts={{ playerVars: { autoplay: 1 } }}Also applies to: 90-94, 121-127
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
apps/web/app/(app)/[emailAccountId]/assistant/AssistantTabs.tsx(0 hunks)apps/web/app/(app)/[emailAccountId]/automation/page.tsx(2 hunks)apps/web/components/OnboardingModal.tsx(5 hunks)apps/web/components/PageHeader.tsx(2 hunks)apps/web/components/VideoCard.tsx(6 hunks)apps/web/next.config.ts(1 hunks)
💤 Files with no reviewable changes (1)
- apps/web/app/(app)/[emailAccountId]/assistant/AssistantTabs.tsx
🧰 Additional context used
📓 Path-based instructions (16)
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/app/(app)/[emailAccountId]/automation/page.tsxapps/web/next.config.tsapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.tsx
apps/web/app/**
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
NextJS app router structure with (app) directory
Files:
apps/web/app/(app)/[emailAccountId]/automation/page.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
Useresult?.serverErrorwithtoastErrorandtoastSuccess
UseLoadingContentcomponent to handle loading and error states consistently
Passloading,error, and children props toLoadingContent
Files:
apps/web/app/(app)/[emailAccountId]/automation/page.tsxapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.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/app/(app)/[emailAccountId]/automation/page.tsxapps/web/next.config.tsapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.tsx
**/*.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/app/(app)/[emailAccountId]/automation/page.tsxapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)
**/*.{ts,tsx}: UsecreateScopedLoggerfor logging in backend TypeScript files
Typically add the logger initialization at the top of the file when usingcreateScopedLogger
Only use.with()on a logger instance within a specific function, not for a global loggerImport 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/app/(app)/[emailAccountId]/automation/page.tsxapps/web/next.config.tsapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.tsx
apps/web/app/(app)/*/**
📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
Components for the page are either put in page.tsx, or in the apps/web/app/(app)/PAGE_NAME folder
Files:
apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/app/(app)/*/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
If you need to use onClick in a component, that component is a client component and file must start with 'use client'
Files:
apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/app/(app)/*/**/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
If we're in a deeply nested component we will use swr to fetch via API
Files:
apps/web/app/(app)/[emailAccountId]/automation/page.tsx
apps/web/app/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Components with
onClickmust be client components withuse clientdirective
Files:
apps/web/app/(app)/[emailAccountId]/automation/page.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{js,jsx,ts,tsx}: Don't useelements 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/app/(app)/[emailAccountId]/automation/page.tsxapps/web/next.config.tsapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.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/app/(app)/[emailAccountId]/automation/page.tsxapps/web/next.config.tsapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.tsx
**/*.{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/app/(app)/[emailAccountId]/automation/page.tsxapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.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/app/(app)/[emailAccountId]/automation/page.tsxapps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.tsx**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)
**/*.ts: The same validation should be done in the server action too
Define validation schemas using ZodFiles:
apps/web/next.config.tsapps/web/components/**/*.tsx
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Use React Hook Form with Zod validation for form handling
Use the
LoadingContentcomponent to handle loading and error states consistently in data-fetching components.Use PascalCase for components (e.g.
components/Button.tsx)Files:
apps/web/components/OnboardingModal.tsxapps/web/components/VideoCard.tsxapps/web/components/PageHeader.tsx🧠 Learnings (1)
📚 Learning: 2025-07-19T17:50:22.078Z
Learnt from: CR PR: elie222/inbox-zero#0 File: .cursor/rules/ui-components.mdc:0-0 Timestamp: 2025-07-19T17:50:22.078Z Learning: Applies to components/**/*.tsx : Use `next/image` package for imagesApplied to files:
apps/web/next.config.tsapps/web/components/VideoCard.tsx🧬 Code graph analysis (2)
apps/web/components/OnboardingModal.tsx (2)
apps/web/components/MuxVideo.tsx (1)
MuxVideo(14-33)apps/web/components/YouTubeVideo.tsx (1)
YouTubeVideo(4-29)apps/web/components/VideoCard.tsx (1)
apps/web/components/ClientOnly.tsx (1)
ClientOnly(5-13)⏰ 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)
- GitHub Check: cubic · AI code reviewer
🔇 Additional comments (6)
apps/web/next.config.ts (1)
32-35: Allowing Mux image host — LGTMRemote pattern in apps/web/next.config.ts includes image.mux.com and CSP already permits https://image.mux.com; Mux thumbnails are served via next/image (apps/web/components/VideoCard.tsx — Image src = https://image.mux.com/${muxPlaybackId}/thumbnail.jpg); no raw
usages found.
apps/web/components/PageHeader.tsx (1)
46-47: Prop wiring LGTM.Passing youtubeVideoId/muxPlaybackId through to OnboardingDialogContent is clear and consistent with the new API.
apps/web/app/(app)/[emailAccountId]/automation/page.tsx (1)
100-101: Switch to Mux playback ID — looks good.The onboarding video now uses muxPlaybackId consistently in both PageHeader and DismissibleVideoCard.
Also applies to: 134-135
apps/web/components/VideoCard.tsx (2)
140-151: Mux playback path looks solid.ClientOnly + MuxPlayer avoids SSR hydration issues; sensible defaults for metadata/accentColor.
1-173: Verify image domain and DismissibleVideoCard callsites.
- apps/web/next.config.ts already includes image.mux.com in images.remotePatterns and CSP allows https://image.mux.com.
- Repo search for failed (rg: "unrecognized file type: tsx"); cannot confirm callsites. Ensure every DismissibleVideoCard usage provides either muxPlaybackId or thumbnailSrc (re-run a repo-wide search without the --type=tsx filter if needed).
apps/web/components/OnboardingModal.tsx (1)
96-110: Modal content structure LGTM.Mux path is responsive with aspect-video; YouTube path retains inline title/description and autoplay config. Good a11y with sr-only header.
Also applies to: 111-130
There was a problem hiding this comment.
7 issues found across 6 files
Prompt for AI agents (all 7 issues)
Understand the root cause of the following 7 issues and fix them.
<file name="apps/web/components/OnboardingModal.tsx">
<violation number="1" location="apps/web/components/OnboardingModal.tsx:96">
Max width (6xl ≈ 1152px) is smaller than the 1200px video, causing clipping on large screens. Increase max width to fit the video.</violation>
<violation number="2" location="apps/web/components/OnboardingModal.tsx:111">
Hard-coded bg-white ignores theme; use bg-background for dark mode compatibility.</violation>
<violation number="3" location="apps/web/components/OnboardingModal.tsx:125">
Autoplaying with sound can be blocked and is jarring; mute the video to improve autoplay reliability and UX.</violation>
</file>
<file name="apps/web/app/(app)/[emailAccountId]/automation/page.tsx">
<violation number="1" location="apps/web/app/(app)/[emailAccountId]/automation/page.tsx:100">
Mux playback ID is duplicated; centralize to a constant/config to avoid drift and ease updates.</violation>
</file>
<file name="apps/web/components/PageHeader.tsx">
<violation number="1" location="apps/web/components/PageHeader.tsx:10">
Both youtubeVideoId and muxPlaybackId are optional, allowing a video entry with neither ID; the dialog then renders nothing, resulting in a blank modal. Enforce at least one ID (union/discriminated type) or gate rendering of WatchVideo when no ID is present.</violation>
</file>
<file name="apps/web/components/VideoCard.tsx">
<violation number="1" location="apps/web/components/VideoCard.tsx:122">
Fallbacking Image src to an empty string can cause Next/Image runtime errors; ensure a valid placeholder is used when no thumbnail is available.</violation>
<violation number="2" location="apps/web/components/VideoCard.tsx:153">
If videoSrc is undefined, iframe src becomes an invalid URL (e.g., "undefined?autoplay=1..."), breaking playback.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| title: string; | ||
| description: React.ReactNode; | ||
| videoId: string; | ||
| youtubeVideoId?: string; |
There was a problem hiding this comment.
Both youtubeVideoId and muxPlaybackId are optional, allowing a video entry with neither ID; the dialog then renders nothing, resulting in a blank modal. Enforce at least one ID (union/discriminated type) or gate rendering of WatchVideo when no ID is present.
Prompt for AI agents
Address the following comment on apps/web/components/PageHeader.tsx at line 10:
<comment>Both youtubeVideoId and muxPlaybackId are optional, allowing a video entry with neither ID; the dialog then renders nothing, resulting in a blank modal. Enforce at least one ID (union/discriminated type) or gate rendering of WatchVideo when no ID is present.</comment>
<file context>
@@ -7,7 +7,8 @@ import { PlayIcon } from "lucide-react";
title: string;
description: React.ReactNode;
- videoId: string;
+ youtubeVideoId?: string;
+ muxPlaybackId?: string;
};
</file context>
✅ Addressed in 99f610b
| </ClientOnly> | ||
| ) : ( | ||
| <iframe | ||
| src={`${videoSrc}${videoSrc?.includes("?") ? "&" : "?"}autoplay=1&rel=0`} |
There was a problem hiding this comment.
If videoSrc is undefined, iframe src becomes an invalid URL (e.g., "undefined?autoplay=1..."), breaking playback.
Prompt for AI agents
Address the following comment on apps/web/components/VideoCard.tsx at line 153:
<comment>If videoSrc is undefined, iframe src becomes an invalid URL (e.g., "undefined?autoplay=1..."), breaking playback.</comment>
<file context>
@@ -126,16 +134,29 @@ const VideoCard = React.forwardRef<
+ </ClientOnly>
+ ) : (
+ <iframe
+ src={`${videoSrc}${videoSrc?.includes("?") ? "&" : "?"}autoplay=1&rel=0`}
+ className="size-full rounded-lg"
+ title={`Video: ${title}`}
</file context>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx (4)
171-174: Guard percentage math against divide-by-zero (NaN/Infinity).Zero totals will break sorting/UI if value === 0.
- const readPercentage = (item.readEmails / item.value) * 100; + const readPercentage = item.value ? (item.readEmails / item.value) * 100 : 0; const archivedEmails = item.value - item.inboxEmails; - const archivedPercentage = (archivedEmails / item.value) * 100; + const archivedPercentage = item.value ? (archivedEmails / item.value) * 100 : 0;
198-205: ‘emails’ sort currently no-ops; include a key to sort by total emails.Adds totalEmails in the row model and handles the 'emails' branch explicitly.
- return { row, readPercentage, archivedEmails, archivedPercentage }; + return { row, readPercentage, archivedEmails, archivedPercentage, totalEmails: item.value }; }); - const tableRows = sortBy(unsortedTableRows, (row) => { + const tableRows = sortBy(unsortedTableRows, (row) => { + if (sortColumn === "emails") return row.totalEmails; if (sortColumn === "unread") return row.readPercentage; if (sortColumn === "unarchived") return row.archivedPercentage; + return 0; });
111-113: Avoidas anyin URLSearchParams construction.Keep types intact without
any.- // biome-ignore lint/suspicious/noExplicitAny: simplest - const urlParams = new URLSearchParams(params as any); + const urlParams = new URLSearchParams( + Object.entries(params).flatMap(([k, v]) => + Array.isArray(v) ? v.map((vv) => [k, String(vv)]) : [[k, String(v)]], + ) as [string, string][], + );
237-247: Standardize VideoCard usage on the ID-based API — use muxPlaybackId or add youtubeVideoId supportDismissibleVideoCard supports muxPlaybackId (uses MuxPlayer/thumbnail) and falls back to videoSrc/thumbnailSrc; it does not accept youtubeVideoId. Use muxPlaybackId for Mux-hosted assets (YouTube IDs are not Mux playback IDs) or keep videoSrc/thumbnailSrc for YouTube; if you want unified YouTube handling, add a youtubeVideoId prop to VideoCard and centralize the iframe/thumbnail logic there.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
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/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
apps/web/app/**
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
NextJS app router structure with (app) directory
Files:
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.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
Useresult?.serverErrorwithtoastErrorandtoastSuccess
UseLoadingContentcomponent to handle loading and error states consistently
Passloading,error, and children props toLoadingContent
Files:
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.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/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
**/*.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/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)
**/*.{ts,tsx}: UsecreateScopedLoggerfor logging in backend TypeScript files
Typically add the logger initialization at the top of the file when usingcreateScopedLogger
Only use.with()on a logger instance within a specific function, not for a global loggerImport 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/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
apps/web/app/(app)/*/**
📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
Components for the page are either put in page.tsx, or in the apps/web/app/(app)/PAGE_NAME folder
Files:
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
apps/web/app/(app)/*/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
If you need to use onClick in a component, that component is a client component and file must start with 'use client'
Files:
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
apps/web/app/(app)/*/**/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
If we're in a deeply nested component we will use swr to fetch via API
Files:
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
apps/web/app/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Components with
onClickmust be client components withuse clientdirective
Files:
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{js,jsx,ts,tsx}: Don't useelements 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/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.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/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx
**/*.{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/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.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/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx⏰ 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)
- GitHub Check: Vercel Agent Review
🔇 Additional comments (1)
apps/web/app/(app)/[emailAccountId]/bulk-unsubscribe/BulkUnsubscribeSection.tsx (1)
233-234: Correct prop rename to youtubeVideoId (PageHeader.Video API).Looks aligned with the new multi-source video shape. If a Mux asset exists for this video, add muxPlaybackId for best playback/thumbnail quality.
Verify there are no remaining videoId references and that PageHeader.Video type exposes youtubeVideoId and muxPlaybackId — repository search returned no matches, so manual confirmation required.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Refactor
Chores