Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • make divider on context menu aware of available options
  • remove xl avatar

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Jan 10, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 10, 2026 9:55pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 10, 2026

Greptile Overview

Greptile Summary

This PR makes two unrelated but clean improvements to the codebase:

Context Menu Divider Logic (Primary Change)

What changed: The context menu now intelligently shows/hides dividers based on whether menu sections actually have visible items, not just whether the section flags are enabled.

Why this matters: The old implementation had a bug where dividers would appear even when no menu items existed in a section. For example:

  • Old: {(showDuplicate || showExport) && <PopoverDivider />} - shows divider if flags are true
  • New: {hasEditSection && hasCopySection && <PopoverDivider />} - shows divider only if both sections have actual items

Implementation: Three boolean flags track section visibility:

  • hasNavigationSection - checks showOpenInNewTab && onOpenInNewTab
  • hasEditSection - checks rename/create/createFolder items
  • hasCopySection - checks duplicate/export items

These flags are used to conditionally render dividers, preventing empty sections from creating visual clutter with unnecessary dividers.

Edge cases handled correctly:

  • Single item menus (just Delete) - no dividers shown ✓
  • Multiple workflows selected - hides navigation/edit sections, shows only relevant dividers ✓
  • Missing callbacks - divider hidden when no items will render ✓

Avatar Component Cleanup (Secondary Change)

What changed: Removed the unused xl size variant from the Avatar component.

Impact: Safe removal - no usages found in codebase outside the playground examples. The component still supports xs, sm, md, and lg sizes, which cover all current use cases.

Changes:

  • Removed xl: 'h-16 w-16' from avatarVariants
  • Removed xl: 'h-4 w-4' from avatarStatusVariants
  • Removed playground examples demonstrating the xl size

Both changes improve code quality: the context menu fix prevents UI bugs with orphaned dividers, and the Avatar cleanup removes dead code.

Confidence Score: 5/5

  • This PR is safe to merge - fixes a UI bug and removes unused code with no breaking changes
  • Score reflects that this PR fixes an actual bug in the context menu divider logic (preventing orphaned dividers when sections are empty) and safely removes unused Avatar sizes. The context menu logic was thoroughly verified against multiple usage scenarios (single workflow, multiple workflows, folders) and all edge cases are handled correctly. The Avatar xl size removal has no impact as it's not used anywhere in the codebase.
  • No files require special attention - all changes are straightforward improvements

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/playground/page.tsx 5/5 Removed 'xl' size Avatar examples from playground - safe cleanup following component change
apps/sim/components/emcn/components/avatar/avatar.tsx 5/5 Removed 'xl' size variant from Avatar component - no breaking changes, not used elsewhere in codebase
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/context-menu/context-menu.tsx 3/5 Added conditional divider rendering logic - has a critical bug where dividers show even when no items are visible

Sequence Diagram

sequenceDiagram
    participant User
    participant ContextMenu
    participant MenuItem
    participant Divider
    
    User->>ContextMenu: Right-click item
    ContextMenu->>ContextMenu: Calculate section visibility
    Note over ContextMenu: hasNavigationSection = showOpenInNewTab && onOpenInNewTab
    Note over ContextMenu: hasEditSection = (showRename && onRename) || (showCreate && onCreate) || (showCreateFolder && onCreateFolder)
    Note over ContextMenu: hasCopySection = (showDuplicate && onDuplicate) || (showExport && onExport)
    
    alt hasNavigationSection
        ContextMenu->>MenuItem: Render "Open in new tab"
        alt hasEditSection OR hasCopySection
            ContextMenu->>Divider: Render divider
        end
    end
    
    alt hasEditSection
        ContextMenu->>MenuItem: Render Edit items (Rename/Create/CreateFolder)
        alt hasCopySection
            ContextMenu->>Divider: Render divider
        end
    end
    
    alt hasCopySection
        ContextMenu->>MenuItem: Render Copy items (Duplicate/Export)
    end
    
    alt hasNavigationSection OR hasEditSection OR hasCopySection
        ContextMenu->>Divider: Render divider before Delete
    end
    
    ContextMenu->>MenuItem: Render "Delete" (always visible)
    ContextMenu->>User: Display context menu
Loading

Copy link
Contributor

@greptile-apps greptile-apps 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 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit ead2413 into staging Jan 10, 2026
10 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/picker branch January 10, 2026 22:06
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.

2 participants