Skip to content

sidebar-cards#696

Closed
AviPeltz wants to merge 1 commit intomainfrom
sidebar-cards
Closed

sidebar-cards#696
AviPeltz wants to merge 1 commit intomainfrom
sidebar-cards

Conversation

@AviPeltz
Copy link
Copy Markdown
Collaborator

@AviPeltz AviPeltz commented Jan 9, 2026

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

Release Notes

  • New Features

    • Local git changes now display in workspace list items
    • Added branch switcher for workspace management
    • Enhanced hover interactions with context menus for workspaces
  • Improvements

    • Better UI spacing and layout in workspace sidebar
    • Improved styling and readability of workspace status badges
    • Unified diff stats display with fallback logic

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 9, 2026

📝 Walkthrough

Walkthrough

The PR enhances WorkspaceSidebar components with lazy-loaded local git changes, interactive close workflows for worktrees, and refined UI styling. It adds optional props to WorkspaceDiffStats for close actions and active states, integrates local diff statistics via TRPC queries, and updates component layout and styling.

Changes

Cohort / File(s) Summary
Diff Stats & Close Workflow
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
WorkspaceDiffStats gains optional onClose and isActive props to support interactive close button on hover and active state styling. WorkspaceListItem now lazy-loads local git diffs via TRPC on hover, computes unified diffStats (prioritizing local over PR-based), and wires close callback for worktree deletion. UI structure refactored with richer hover interactions (HoverCard for worktrees, Tooltip for branches), inline rename input, and close/delete workflow.
UI Styling & Polish
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
Minor spacing adjustments in ProjectSection (bottom/top padding updates). WorkspaceStatusBadge refinements: badge border-radius changed to rounded-md, text size reduced to text-[10px], PR number formatted with tabular-nums.

Sequence Diagram

sequenceDiagram
    actor User
    participant UI as WorkspaceListItem
    participant TRPC as TRPC Query
    participant Server as Backend
    participant UI2 as WorkspaceDiffStats

    User->>UI: Hover over worktree item
    activate UI
    UI->>TRPC: Query worktree diffs (lazy-load)
    activate TRPC
    TRPC->>Server: Fetch staged/unstaged/untracked diffs
    Server-->>TRPC: Return diff stats
    deactivate TRPC
    TRPC-->>UI: diffStats (additions/deletions)
    UI->>UI2: Render with onClose & diffStats
    activate UI2
    UI2-->>User: Display diff stats + close button on hover
    deactivate UI2
    User->>UI2: Click close button
    UI2->>UI: Trigger onClose callback
    UI->>Server: Delete/close worktree
    deactivate UI
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

Poem

🐰 Behold, the sidebar springs to life with flair,
Local diffs now hover in the air,
Close buttons bloom on worktrees with a gentle click,
Spacing refined, styling so slick—
The workspace awaits, responsive and bright!

🚥 Pre-merge checks | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description consists entirely of an empty template with no substantive content, making it impossible to understand the rationale, context, or implications of the changes. Fill in all relevant template sections with concrete details about what changed, why, related issues, type of change, testing performed, and any additional context.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'sidebar-cards' is a vague, generic term that does not clearly describe the main changes in the changeset, which include workspace diff stats enhancements, hover-based git change loading, and UI restructuring. Revise the title to be more descriptive of the primary change, such as 'Add lazy-loaded diff stats and improve workspace sidebar interactions' or 'Enhance WorkspaceListItem with local git changes and hover interactions'.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx (1)

19-23: Consider extracting conditional styles for readability.

The container has cursor-pointer but lacks an onClick handler—only the nested button is clickable. This may confuse users expecting the entire area to be interactive.

♻️ Suggested improvement
 		<div
 			className={cn(
-				"group/diff flex items-center text-[10px] font-mono tabular-nums px-1.5 py-0.5 rounded relative cursor-pointer",
-				isActive ? "bg-foreground/10 group-hover:bg-transparent" : "bg-muted/50 group-hover:bg-transparent",
+				"group/diff flex items-center text-[10px] font-mono tabular-nums px-1.5 py-0.5 rounded relative",
+				isActive
+					? "bg-foreground/10 group-hover:bg-transparent"
+					: "bg-muted/50 group-hover:bg-transparent",
 			)}
 		>
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx (3)

115-122: Consider renaming the stale time constant for clarity.

Using GITHUB_STATUS_STALE_TIME for local git changes may be misleading. Consider extracting a more generic constant or renaming to reflect broader usage.

// In constants.ts, consider:
export const STATUS_STALE_TIME = 30_000; // or whatever value
// Then use STATUS_STALE_TIME for both queries

215-217: Refactor the long conditional for readability.

The current line is dense and hard to parse quickly.

♻️ Suggested refactor
-	// Show diff stats from PR if available, otherwise from local changes
-	const diffStats = localDiffStats || (pr && (pr.additions > 0 || pr.deletions > 0) ? { additions: pr.additions, deletions: pr.deletions } : null);
+	// Show diff stats from local changes if available, otherwise from PR
+	const prDiffStats = pr && (pr.additions > 0 || pr.deletions > 0)
+		? { additions: pr.additions, deletions: pr.deletions }
+		: null;
+	const diffStats = localDiffStats ?? prDiffStats;

Note: The comment also appears inverted ("from PR if available, otherwise from local") when the code prioritizes local first.


447-478: Simplify redundant conditional check.

showDiffStats is defined as !!diffStats (line 217), so showDiffStats && diffStats is redundant—if showDiffStats is true, diffStats is guaranteed to be truthy.

♻️ Suggested simplification
 								{/* Diff stats (transforms to X on hover) or close button for worktree workspaces */}
 								{!isBranchWorkspace && (
-									showDiffStats && diffStats ? (
+									diffStats ? (
 										<WorkspaceDiffStats
 											additions={diffStats.additions}
 											deletions={diffStats.deletions}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a83467 and ac909f8.

📒 Files selected for processing (4)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc
Use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.
For tRPC subscriptions with trpc-electron, ALWAYS use the observable pattern from @trpc/server/observable instead of async generators, as the library explicitly checks isObservable(result) and throws an error otherwise

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use object parameters for functions with 2+ parameters instead of positional arguments
Functions with 2+ parameters should accept a single params object with named properties for self-documentation and extensibility
Use prefixed console logging with context pattern: [domain/operation] message
Extract magic numbers and hardcoded values to named constants at module top
Use lookup objects/maps instead of repeated if (type === ...) conditionals
Avoid using any type - maintain type safety in TypeScript code
Never swallow errors silently - at minimum log them with context
Import from concrete files directly when possible - avoid barrel file abuse that creates circular dependencies
Avoid deep nesting (4+ levels) - use early returns, extract functions, and invert conditions
Use named properties in options objects instead of boolean parameters to avoid boolean blindness

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
apps/desktop/src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never import Node.js modules (fs, path, os, net) in renderer process or shared code - they are externalized for browser compatibility

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

One component per file - do not create multi-component files

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
apps/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Drizzle ORM for all database operations - never use raw SQL

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for formatting and linting - run at root level with bun run lint:fix or biome check --write

Files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
🧠 Learnings (1)
📚 Learning: 2026-01-02T06:50:28.671Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T06:50:28.671Z
Learning: Applies to apps/*/src/components/{ui,ai-elements,react-flow}/*.tsx : Use kebab-case single files for shadcn/ui components (e.g., button.tsx, base-node.tsx) in src/components/ui/, src/components/ai-elements, and src/components/react-flow/

Applied to files:

  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
🧬 Code graph analysis (1)
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx (2)
packages/ui/src/lib/utils.ts (1)
  • cn (4-6)
packages/ui/src/components/ui/tooltip.tsx (3)
  • Tooltip (76-76)
  • TooltipTrigger (76-76)
  • TooltipContent (76-76)
⏰ 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: Build
🔇 Additional comments (6)
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/ProjectSection/ProjectSection.tsx (1)

127-127: LGTM! Minor spacing refinement.

The padding adjustment improves vertical spacing balance for the workspace list in the expanded sidebar state.

apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx (1)

62-70: LGTM!

Good UI refinements. The tabular-nums class ensures consistent digit widths for PR numbers, and rounded-md provides a cleaner badge appearance.

apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceDiffStats.tsx (1)

31-46: LGTM!

Good implementation of the conditional close button with tooltip for accessibility. The hover-to-reveal pattern is clean.

apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx (3)

124-136: LGTM!

The computation correctly aggregates changes across staged, unstaged, and untracked files. The || 0 fallback handles cases where properties may be undefined.


319-332: LGTM!

Good accessibility implementation. The role="button" with proper keyboard handling is the correct approach when nesting interactive elements (BranchSwitcher, close button) inside a clickable container.


350-402: LGTM!

Good use of Tooltip to provide contextual information about workspace types. The icon section with status indicators is well-structured.

@AviPeltz AviPeltz changed the title more progress sidebar-cards Jan 10, 2026
@AviPeltz AviPeltz closed this Jan 19, 2026
@Kitenite Kitenite deleted the sidebar-cards branch January 22, 2026 17:48
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.

1 participant