Repository navigation
Refactor marketing app mockup into components - #2626
Conversation
📝 WalkthroughWalkthroughAppMockup was refactored into composable subcomponents (WindowChrome, LeftSidebar, MainPanel, RightSidebar, ExternalIdePopup) with types moved to Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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: 1
🧹 Nitpick comments (4)
apps/marketing/src/app/components/HeroSection/components/AppMockup/components/MainPanel/MainPanel.tsx (1)
14-190: Add a co-located test for theactiveDemostate transitions.This component now owns multiple animated UI branches; adding
MainPanel.test.tsxnext to it would reduce regression risk for the"Use Any Agents"vs"Create Parallel Branches"paths.As per coding guidelines
**/*.{ts,tsx}: Co-locate tests with their implementation files (e.g.,Component.test.tsxnext toComponent.tsx).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/MainPanel/MainPanel.tsx` around lines 14 - 190, Add a co-located test file MainPanel.test.tsx to cover MainPanel's activeDemo-driven UI branches: assert that when prop activeDemo === "Use Any Agents" the AGENT_TABS motion divs are visible/animated and when activeDemo === "Create Parallel Branches" the setup motion panel (which renders SETUP_STEPS and AsciiSpinner) is visible while the Claude panel is hidden; use the MainPanel component, pass appropriate activeDemo values, and query for unique text/icons (e.g., "claude", "setup", elements from SETUP_STEPS or "Setting up new parallel environment...") to verify transitions and pointerEvents behavior.apps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsx (1)
66-75: Prefer usingfile.pathalone as the key.The static analysis tool flags the use of
indexin the key. SinceFILE_CHANGEScontains uniquepathvalues (as seen inconstants.ts), usingfile.pathalone is sufficient and avoids the linting warning.🔧 Suggested fix
{FILE_CHANGES.map((file, index) => ( <FileChangeItem - key={`${file.path}-${index}`} + key={file.path} path={file.path} add={file.add} del={file.del} indent={file.indent} type={file.type} /> ))}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsx` around lines 66 - 75, The map uses a composite key `${file.path}-${index}` which triggers a lint warning for using the index; replace that with the unique path only by setting the key to file.path in the FILE_CHANGES mapping where FileChangeItem is rendered (look for FILE_CHANGES.map(...) and the FileChangeItem component) so each FileChangeItem uses key={file.path} instead of including the index.apps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/LeftSidebar.tsx (1)
67-84: Consider extracting magic strings to constants.The comparison
workspace.name === "use any agents"uses a magic string that must match the value inWORKSPACES. If the constant changes, this logic could silently break.♻️ Optional improvement
Consider adding a constant or using the first workspace reference:
const FIRST_WORKSPACE_NAME = WORKSPACES[0]?.name; // ... const isFirstItem = workspace.name === FIRST_WORKSPACE_NAME;Or add an
idfield toWorkspaceDatafor stable identification.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/LeftSidebar.tsx` around lines 67 - 84, Replace the hard-coded magic string "use any agents" used in the isFirstItem check with a stable constant or reference: define a constant (e.g., FIRST_WORKSPACE_NAME = WORKSPACES[0]?.name or a named constant matching WORKSPACES) and update the isFirstItem computation in the map to use FIRST_WORKSPACE_NAME; alternatively add and use a stable identifier field (e.g., workspace.id) on the WORKSPACES entries and compare against that. Ensure you update the isFirstItem declaration and any related logic (the isFirstItem variable used to compute shouldHideActiveState and the props passed into WorkspaceItem) to reference the new constant/ID.apps/marketing/src/app/components/HeroSection/components/AppMockup/components/FileChangeItem/FileChangeItem.tsx (1)
27-35: Consider extracting icon mapping to a constant for readability.The nested ternary works but a lookup object would be more maintainable as new file types are added.
♻️ Optional refactor
const FILE_TYPE_ICONS = { folder: VscChevronRight, add: VscDiffAdded, edit: VscDiffModified, delete: VscDiffRemoved, } as const; // Then use: const Icon = FILE_TYPE_ICONS[type] ?? VscDiffModified;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/FileChangeItem/FileChangeItem.tsx` around lines 27 - 35, The nested ternary that assigns Icon in FileChangeItem.tsx (using isFolder and type) should be replaced with a lookup constant for readability and future extensibility: create a FILE_TYPE_ICONS mapping constant that maps "folder"->VscChevronRight, "add"->VscDiffAdded, "edit"->VscDiffModified, "delete"->VscDiffRemoved, then set Icon by checking isFolder first (or by mapping a "folder" key) and falling back to VscDiffModified when no match; update the Icon assignment in the FileChangeItem component to use this lookup instead of the nested ternary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/ExternalIdePopup/ExternalIdePopup.tsx`:
- Around line 13-23: The popup stays mounted in ExternalIdePopup and only
animates opacity/scale via the motion.div even when inactive, allowing it to
intercept pointer events; update the motion.div (the element using activeDemo
=== "Open in Any IDE" for animate) to prevent interaction when hidden by adding
pointer-events: active ? 'auto' : 'none' (or a conditional class like
'pointer-events-none' when inactive), and also set aria-hidden or entirely
unmount the motion.div when activeDemo !== "Open in Any IDE" if you prefer
removing it from the DOM to avoid focus/trap issues; modify the motion.div
render logic around the animate prop and activeDemo check to implement one of
these fixes.
---
Nitpick comments:
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/FileChangeItem/FileChangeItem.tsx`:
- Around line 27-35: The nested ternary that assigns Icon in FileChangeItem.tsx
(using isFolder and type) should be replaced with a lookup constant for
readability and future extensibility: create a FILE_TYPE_ICONS mapping constant
that maps "folder"->VscChevronRight, "add"->VscDiffAdded,
"edit"->VscDiffModified, "delete"->VscDiffRemoved, then set Icon by checking
isFolder first (or by mapping a "folder" key) and falling back to
VscDiffModified when no match; update the Icon assignment in the FileChangeItem
component to use this lookup instead of the nested ternary.
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/LeftSidebar.tsx`:
- Around line 67-84: Replace the hard-coded magic string "use any agents" used
in the isFirstItem check with a stable constant or reference: define a constant
(e.g., FIRST_WORKSPACE_NAME = WORKSPACES[0]?.name or a named constant matching
WORKSPACES) and update the isFirstItem computation in the map to use
FIRST_WORKSPACE_NAME; alternatively add and use a stable identifier field (e.g.,
workspace.id) on the WORKSPACES entries and compare against that. Ensure you
update the isFirstItem declaration and any related logic (the isFirstItem
variable used to compute shouldHideActiveState and the props passed into
WorkspaceItem) to reference the new constant/ID.
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/MainPanel/MainPanel.tsx`:
- Around line 14-190: Add a co-located test file MainPanel.test.tsx to cover
MainPanel's activeDemo-driven UI branches: assert that when prop activeDemo ===
"Use Any Agents" the AGENT_TABS motion divs are visible/animated and when
activeDemo === "Create Parallel Branches" the setup motion panel (which renders
SETUP_STEPS and AsciiSpinner) is visible while the Claude panel is hidden; use
the MainPanel component, pass appropriate activeDemo values, and query for
unique text/icons (e.g., "claude", "setup", elements from SETUP_STEPS or
"Setting up new parallel environment...") to verify transitions and
pointerEvents behavior.
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsx`:
- Around line 66-75: The map uses a composite key `${file.path}-${index}` which
triggers a lint warning for using the index; replace that with the unique path
only by setting the key to file.path in the FILE_CHANGES mapping where
FileChangeItem is rendered (look for FILE_CHANGES.map(...) and the
FileChangeItem component) so each FileChangeItem uses key={file.path} instead of
including the index.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 03f56921-8486-4a07-b1b8-df31b0df2d9c
📒 Files selected for processing (22)
apps/marketing/src/app/components/HeroSection/components/AppMockup/AppMockup.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/AsciiSpinner/AsciiSpinner.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/AsciiSpinner/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/components/ExternalIdePopup/ExternalIdePopup.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/ExternalIdePopup/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/components/FileChangeItem/FileChangeItem.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/FileChangeItem/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/LeftSidebar.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/components/MainPanel/MainPanel.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/MainPanel/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/components/StatusIndicator/StatusIndicator.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/StatusIndicator/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/components/WindowChrome/WindowChrome.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/WindowChrome/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/components/WorkspaceItem/WorkspaceItem.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/WorkspaceItem/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/constants.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/index.tsapps/marketing/src/app/components/HeroSection/components/AppMockup/types.ts
| <motion.div | ||
| className="absolute bottom-6 right-6 w-[55%] overflow-hidden rounded-xl bg-black/50 shadow-[0_8px_40px_-8px_rgba(0,0,0,0.6)] backdrop-blur-xl" | ||
| style={{ aspectRatio: "16/10" }} | ||
| initial={{ opacity: 0, scale: 0.9, y: 20 }} | ||
| animate={{ | ||
| opacity: activeDemo === "Open in Any IDE" ? 1 : 0, | ||
| scale: activeDemo === "Open in Any IDE" ? 1 : 0.9, | ||
| y: activeDemo === "Open in Any IDE" ? 0 : 20, | ||
| }} | ||
| transition={{ duration: 0.3, ease: "easeOut" }} | ||
| > |
There was a problem hiding this comment.
Hidden popup can still block interactions.
Line 13 keeps the popup mounted, but Lines 18–20 only animate visibility. When hidden, it can still capture pointer events over underlying UI.
Proposed fix
<motion.div
className="absolute bottom-6 right-6 w-[55%] overflow-hidden rounded-xl bg-black/50 shadow-[0_8px_40px_-8px_rgba(0,0,0,0.6)] backdrop-blur-xl"
- style={{ aspectRatio: "16/10" }}
+ style={{
+ aspectRatio: "16/10",
+ pointerEvents: activeDemo === "Open in Any IDE" ? "auto" : "none",
+ }}
+ aria-hidden={activeDemo !== "Open in Any IDE"}
initial={{ opacity: 0, scale: 0.9, y: 20 }}
animate={{
opacity: activeDemo === "Open in Any IDE" ? 1 : 0,📝 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.
| <motion.div | |
| className="absolute bottom-6 right-6 w-[55%] overflow-hidden rounded-xl bg-black/50 shadow-[0_8px_40px_-8px_rgba(0,0,0,0.6)] backdrop-blur-xl" | |
| style={{ aspectRatio: "16/10" }} | |
| initial={{ opacity: 0, scale: 0.9, y: 20 }} | |
| animate={{ | |
| opacity: activeDemo === "Open in Any IDE" ? 1 : 0, | |
| scale: activeDemo === "Open in Any IDE" ? 1 : 0.9, | |
| y: activeDemo === "Open in Any IDE" ? 0 : 20, | |
| }} | |
| transition={{ duration: 0.3, ease: "easeOut" }} | |
| > | |
| <motion.div | |
| className="absolute bottom-6 right-6 w-[55%] overflow-hidden rounded-xl bg-black/50 shadow-[0_8px_40px_-8px_rgba(0,0,0,0.6)] backdrop-blur-xl" | |
| style={{ | |
| aspectRatio: "16/10", | |
| pointerEvents: activeDemo === "Open in Any IDE" ? "auto" : "none", | |
| }} | |
| aria-hidden={activeDemo !== "Open in Any IDE"} | |
| initial={{ opacity: 0, scale: 0.9, y: 20 }} | |
| animate={{ | |
| opacity: activeDemo === "Open in Any IDE" ? 1 : 0, | |
| scale: activeDemo === "Open in Any IDE" ? 1 : 0.9, | |
| y: activeDemo === "Open in Any IDE" ? 0 : 20, | |
| }} | |
| transition={{ duration: 0.3, ease: "easeOut" }} | |
| > |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/ExternalIdePopup/ExternalIdePopup.tsx`
around lines 13 - 23, The popup stays mounted in ExternalIdePopup and only
animates opacity/scale via the motion.div even when inactive, allowing it to
intercept pointer events; update the motion.div (the element using activeDemo
=== "Open in Any IDE" for animate) to prevent interaction when hidden by adding
pointer-events: active ? 'auto' : 'none' (or a conditional class like
'pointer-events-none' when inactive), and also set aria-hidden or entirely
unmount the motion.div when activeDemo !== "Open in Any IDE" if you prefer
removing it from the DOM to avoid focus/trap issues; modify the motion.div
render logic around the animate prop and activeDemo check to implement one of
these fixes.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
apps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/LeftSidebar.tsx (1)
67-84: Consider using an identifier instead of magic string comparison.The comparison
workspace.name === "use any agents"creates a fragile coupling—if the workspace name changes inconstants.ts, this special-case logic silently breaks. Consider adding anidfield to the workspace type or comparing by index if this is always the first item.💡 Suggested approach
Option 1 – Use index:
- {WORKSPACES.map((workspace) => { - const isFirstItem = workspace.name === "use any agents"; + {WORKSPACES.map((workspace, index) => { + const isFirstItem = index === 0;Option 2 – Add an
idfield toWorkspaceintypes.tsand use that for comparison.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/LeftSidebar.tsx` around lines 67 - 84, The code uses a fragile magic string comparison workspace.name === "use any agents" to special-case the first workspace; update the data shape and logic to avoid string coupling: add a stable identifier (e.g., id) to each workspace in WORKSPACES and Workspace type, then replace the comparison with workspace.id === "<stable-id>" (or use the index from WORKSPACES.map((workspace, i) => ...) and check i === 0 if this is always the first item) inside the rendering block that sets isFirstItem/shouldHideActiveState so WorkspaceItem receives the correct isActive/status values; adjust any types/initialization where WORKSPACES is defined to include the new id field.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsx`:
- Around line 13-177: Create a new co-located test file RightSidebar.test.tsx
that verifies RightSidebar's behavior: import RightSidebar and render with
different activeDemo values ("", "See Changes", "Create Parallel Branches");
assert the main elements render (the Review Changes header, FileChangeItem list
rendered from FILE_CHANGES), assert the overlay panel appears when activeDemo
=== "See Changes" and that its pointer-events style is "auto" while the
underlying panel pointer-events is "none"; also assert the alternate fade for
"Create Parallel Branches" hides the file list (check opacity/presence or
conditional classes) and verify the animated width change by asserting the
wrapper receives the expected inline style/class when activeDemo toggles. Use
React Testing Library (render, screen) and, if needed, mock framer-motion or
advance timers to avoid animation flakiness; reference the RightSidebar
component, activeDemo prop, FILE_CHANGES mapping and FileChangeItem usage to
locate the code under test.
- Around line 66-69: The list key currently uses the array index via
key={`${file.path}-${index}`} which can break React reconciliation; update the
FileChangeItem key to use a stable unique identifier such as key={file.path} (or
file.id if available) in the FILE_CHANGES.map callback, ensuring the
FileChangeItem rendering uses that stable unique key so reordering doesn’t cause
incorrect DOM updates.
---
Nitpick comments:
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/LeftSidebar.tsx`:
- Around line 67-84: The code uses a fragile magic string comparison
workspace.name === "use any agents" to special-case the first workspace; update
the data shape and logic to avoid string coupling: add a stable identifier
(e.g., id) to each workspace in WORKSPACES and Workspace type, then replace the
comparison with workspace.id === "<stable-id>" (or use the index from
WORKSPACES.map((workspace, i) => ...) and check i === 0 if this is always the
first item) inside the rendering block that sets
isFirstItem/shouldHideActiveState so WorkspaceItem receives the correct
isActive/status values; adjust any types/initialization where WORKSPACES is
defined to include the new id field.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5c612f20-0fc5-4d01-9649-e003237df337
📒 Files selected for processing (4)
apps/marketing/src/app/components/HeroSection/components/AppMockup/components/ExternalIdePopup/ExternalIdePopup.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/LeftSidebar/LeftSidebar.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/MainPanel/MainPanel.tsxapps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/marketing/src/app/components/HeroSection/components/AppMockup/components/ExternalIdePopup/ExternalIdePopup.tsx
| export function RightSidebar({ activeDemo }: RightSidebarProps) { | ||
| return ( | ||
| <motion.div | ||
| className="relative flex shrink-0 flex-col overflow-hidden border-l border-white/[0.06] bg-white/[0.02] backdrop-blur-lg" | ||
| initial={{ width: 230 }} | ||
| animate={{ | ||
| width: activeDemo === "See Changes" ? 380 : 230, | ||
| }} | ||
| transition={{ duration: 0.3, ease: "easeOut" }} | ||
| > | ||
| <motion.div | ||
| className="absolute inset-0 flex flex-col" | ||
| initial={{ opacity: 1 }} | ||
| animate={{ | ||
| opacity: activeDemo === "See Changes" ? 0 : 1, | ||
| }} | ||
| transition={{ duration: 0.2, ease: "easeOut" }} | ||
| style={{ | ||
| pointerEvents: activeDemo === "See Changes" ? "none" : "auto", | ||
| }} | ||
| > | ||
| <div className="flex items-center justify-between border-b border-white/[0.06] px-5 py-3.5 h-12"> | ||
| <span className="text-[10px] font-normal tracking-[0.14em] text-foreground/52"> | ||
| Review Changes | ||
| </span> | ||
| <div className="flex items-center gap-1 text-[11px]"> | ||
| <LuGitPullRequest className="size-4 text-emerald-300/70" /> | ||
| <span className="text-muted-foreground/36">#827</span> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="space-y-3 border-b border-white/[0.06] px-5 py-3.5"> | ||
| <div className="flex h-10 items-center rounded-xs border border-white/[0.06] bg-black/20 px-4 text-[11px] text-muted-foreground/30"> | ||
| Commit message... | ||
| </div> | ||
| <button | ||
| type="button" | ||
| className="flex w-full items-center justify-center gap-2 rounded-xs border border-white/[0.06] bg-white/[0.04] px-4 py-2.5 text-[11px] font-medium text-foreground/70 hover:bg-white/[0.07]" | ||
| > | ||
| <span>↑</span> | ||
| <span>Push</span> | ||
| <span className="text-[10px] text-muted-foreground/30">26</span> | ||
| </button> | ||
| </div> | ||
|
|
||
| <motion.div | ||
| className="flex-1 overflow-hidden" | ||
| initial={{ opacity: 1 }} | ||
| animate={{ | ||
| opacity: activeDemo === "Create Parallel Branches" ? 0 : 1, | ||
| }} | ||
| transition={{ duration: 0.3, ease: "easeOut" }} | ||
| > | ||
| {FILE_CHANGES.map((file, index) => ( | ||
| <FileChangeItem | ||
| key={`${file.path}-${index}`} | ||
| path={file.path} | ||
| add={file.add} | ||
| del={file.del} | ||
| indent={file.indent} | ||
| type={file.type} | ||
| /> | ||
| ))} | ||
| </motion.div> | ||
| </motion.div> | ||
|
|
||
| <motion.div | ||
| className="absolute inset-0 flex flex-col bg-black/30 backdrop-blur-md" | ||
| initial={{ opacity: 0 }} | ||
| animate={{ | ||
| opacity: activeDemo === "See Changes" ? 1 : 0, | ||
| }} | ||
| transition={{ | ||
| duration: 0.3, | ||
| ease: "easeOut", | ||
| delay: activeDemo === "See Changes" ? 0.1 : 0, | ||
| }} | ||
| style={{ | ||
| pointerEvents: activeDemo === "See Changes" ? "auto" : "none", | ||
| }} | ||
| > | ||
| <div className="flex items-center justify-between border-b border-white/[0.06] px-5 py-3.5"> | ||
| <div className="flex items-center gap-2"> | ||
| <LuGitPullRequest className="size-4.5 text-emerald-300/75" /> | ||
| <span className="text-[13px] font-medium text-foreground/72"> | ||
| Review PR #827 | ||
| </span> | ||
| </div> | ||
| <span className="rounded-xs border border-orange-500/[0.10] bg-orange-500/[0.08] px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.12em] text-orange-500/75"> | ||
| Open | ||
| </span> | ||
| </div> | ||
|
|
||
| <div className="flex items-center gap-1.5 border-b border-white/[0.06] px-5 py-3 text-[11px]"> | ||
| <span className="rounded-xs border border-white/[0.06] bg-white/[0.04] px-3 py-1.5 font-medium text-foreground/64"> | ||
| cloud-workspace.ts | ||
| </span> | ||
| <span className="px-3 py-1.5 text-muted-foreground/30">enums.ts</span> | ||
| <span className="px-3 py-1.5 text-muted-foreground/30">+4 more</span> | ||
| </div> | ||
|
|
||
| <div className="flex-1 overflow-hidden p-5 font-mono text-[11px]"> | ||
| <div className="space-y-1"> | ||
| <div className="py-1 text-muted-foreground/40">@@ -1,4 +1,6 @@</div> | ||
| <div className="flex"> | ||
| <span className="w-7 shrink-0 text-muted-foreground/25">1</span> | ||
| <span className="text-muted-foreground/60"> | ||
| import {"{"} db {"}"} from "../db" | ||
| </span> | ||
| </div> | ||
| <div className="flex bg-emerald-300/[0.08]"> | ||
| <span className="w-7 shrink-0 text-emerald-300/75">+</span> | ||
| <span className="text-emerald-300/75"> | ||
| import {"{"} CloudWorkspace {"}"} from "./types" | ||
| </span> | ||
| </div> | ||
| <div className="flex bg-emerald-300/[0.08]"> | ||
| <span className="w-7 shrink-0 text-emerald-300/75">+</span> | ||
| <span className="text-emerald-300/75"> | ||
| import {"{"} createSSHConnection {"}"} from "./ssh" | ||
| </span> | ||
| </div> | ||
| <div className="flex"> | ||
| <span className="w-7 shrink-0 text-muted-foreground/25">2</span> | ||
| <span className="text-muted-foreground/60"></span> | ||
| </div> | ||
| <div className="flex bg-rose-300/[0.08]"> | ||
| <span className="w-7 shrink-0 text-rose-300/75">-</span> | ||
| <span className="text-rose-300/75"> | ||
| export const getWorkspaces = () ={">"} {"{"} | ||
| </span> | ||
| </div> | ||
| <div className="flex bg-emerald-300/[0.08]"> | ||
| <span className="w-7 shrink-0 text-emerald-300/75">+</span> | ||
| <span className="text-emerald-300/75"> | ||
| export const getWorkspaces = async () ={">"} {"{"} | ||
| </span> | ||
| </div> | ||
| <div className="flex"> | ||
| <span className="w-7 shrink-0 text-muted-foreground/25">4</span> | ||
| <span className="text-muted-foreground/60"> | ||
| {" "}return db.query.workspaces | ||
| </span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="flex items-center gap-3 border-t border-white/[0.06] px-5 py-3.5"> | ||
| <button | ||
| type="button" | ||
| className="rounded-xs border border-emerald-300/[0.10] bg-emerald-300/[0.10] px-4 py-2 text-[11px] font-medium text-emerald-300/75 hover:bg-emerald-300/[0.16]" | ||
| > | ||
| Approve | ||
| </button> | ||
| <button | ||
| type="button" | ||
| className="rounded-xs border border-white/[0.06] bg-white/[0.04] px-4 py-2 text-[11px] font-medium text-foreground/50 hover:bg-white/[0.07]" | ||
| > | ||
| Comment | ||
| </button> | ||
| </div> | ||
| </motion.div> | ||
| </motion.div> | ||
| ); | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check whether a co-located test already exists for RightSidebar.
fd 'RightSidebar\.test\.(ts|tsx)$' apps/marketing/src/app/components/HeroSection/components/AppMockupRepository: superset-sh/superset
Length of output: 46
Add a co-located test file for this component
No RightSidebar.test.tsx exists next to RightSidebar.tsx. Per the coding guidelines for **/*.{ts,tsx}, tests must be co-located with their implementation files. This component's multiple activeDemo states, pointer-event gating, and animations warrant test coverage.
🧰 Tools
🪛 Biome (2.4.7)
[error] 68-68: Avoid using the index of an array as key property in an element.
(lint/suspicious/noArrayIndexKey)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsx`
around lines 13 - 177, Create a new co-located test file RightSidebar.test.tsx
that verifies RightSidebar's behavior: import RightSidebar and render with
different activeDemo values ("", "See Changes", "Create Parallel Branches");
assert the main elements render (the Review Changes header, FileChangeItem list
rendered from FILE_CHANGES), assert the overlay panel appears when activeDemo
=== "See Changes" and that its pointer-events style is "auto" while the
underlying panel pointer-events is "none"; also assert the alternate fade for
"Create Parallel Branches" hides the file list (check opacity/presence or
conditional classes) and verify the animated width change by asserting the
wrapper receives the expected inline style/class when activeDemo toggles. Use
React Testing Library (render, screen) and, if needed, mock framer-motion or
advance timers to avoid animation flakiness; reference the RightSidebar
component, activeDemo prop, FILE_CHANGES mapping and FileChangeItem usage to
locate the code under test.
| {FILE_CHANGES.map((file, index) => ( | ||
| <FileChangeItem | ||
| key={`${file.path}-${index}`} | ||
| path={file.path} |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify index-based React keys are not used in AppMockup components.
rg -nP --type=tsx 'map\(\([^)]*,\s*index\)\s*=>|key=\{[^}]*index[^}]*\}' apps/marketing/src/app/components/HeroSection/components/AppMockupRepository: superset-sh/superset
Length of output: 91
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# First, check the actual file content around lines 66-69
echo "=== File content around line 66-69 ==="
cat -n "apps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsx" | sed -n '60,75p'
# Search for index-based keys in AppMockup components using proper ripgrep syntax
echo ""
echo "=== Searching for index-based map patterns in AppMockup ==="
rg 'map\(\([^)]*,\s*index\)\s*=>' apps/marketing/src/app/components/HeroSection/components/AppMockup/ -A 2 -t ts || echo "No matches found with ripgrep"
# Also search for index in key props
echo ""
echo "=== Searching for index used in key attributes ==="
rg 'key=.*index' apps/marketing/src/app/components/HeroSection/components/AppMockup/ -t ts || echo "No matches found"Repository: superset-sh/superset
Length of output: 1315
Use unique key for file list instead of array index
Line 68 uses key={${file.path}-${index}}, which includes the array index and can cause incorrect reconciliation if list order changes. Use the unique path instead:
Suggested fix
- {FILE_CHANGES.map((file, index) => (
+ {FILE_CHANGES.map((file) => (
<FileChangeItem
- key={`${file.path}-${index}`}
+ key={file.path}
path={file.path}📝 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.
| {FILE_CHANGES.map((file, index) => ( | |
| <FileChangeItem | |
| key={`${file.path}-${index}`} | |
| path={file.path} | |
| {FILE_CHANGES.map((file) => ( | |
| <FileChangeItem | |
| key={file.path} | |
| path={file.path} |
🧰 Tools
🪛 Biome (2.4.7)
[error] 68-68: Avoid using the index of an array as key property in an element.
(lint/suspicious/noArrayIndexKey)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@apps/marketing/src/app/components/HeroSection/components/AppMockup/components/RightSidebar/RightSidebar.tsx`
around lines 66 - 69, The list key currently uses the array index via
key={`${file.path}-${index}`} which can break React reconciliation; update the
FileChangeItem key to use a stable unique identifier such as key={file.path} (or
file.id if available) in the FILE_CHANGES.map callback, ensuring the
FileChangeItem rendering uses that stable unique key so reordering doesn’t cause
incorrect DOM updates.
Summary
Testing
Summary by cubic
Refactored the marketing
AppMockupinto small, co-located components with shared data and types, preserving behavior while polishing visuals and icons.Refactors
LeftSidebar,MainPanel,RightSidebar,ExternalIdePopup,WindowChrome,WorkspaceItem,FileChangeItem,AsciiSpinner, andStatusIndicator.constants.tsandtypes.ts; updatedindex.tsto re-exportAppMockupandActiveDemo; reducedAppMockup.tsxby ~900 LOC.UI Polish
ExternalIdePopupheader and file tree icons; switchedFileChangeItemto VS Code diff icons and added a "delete" change type.Written for commit b4eec5d. Summary will update on new commits.
Summary by CodeRabbit