Skip to content

Commit ead2413

Browse files
authored
fix(context-menu): make divider on context menu aware of available options (#2766)
1 parent 9a16e7c commit ead2413

File tree

3 files changed

+9
-11
lines changed
  • apps/sim
    • app
      • playground
      • workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/context-menu
    • components/emcn/components/avatar

3 files changed

+9
-11
lines changed

apps/sim/app/playground/page.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,6 @@ export default function PlaygroundPage() {
462462
<Avatar size='lg'>
463463
<AvatarFallback>LG</AvatarFallback>
464464
</Avatar>
465-
<Avatar size='xl'>
466-
<AvatarFallback>XL</AvatarFallback>
467-
</Avatar>
468465
</VariantRow>
469466
<VariantRow label='with image'>
470467
<Avatar size='md'>
@@ -505,9 +502,6 @@ export default function PlaygroundPage() {
505502
<Avatar size='lg' status='online'>
506503
<AvatarFallback>LG</AvatarFallback>
507504
</Avatar>
508-
<Avatar size='xl' status='online'>
509-
<AvatarFallback>XL</AvatarFallback>
510-
</Avatar>
511505
</VariantRow>
512506
</Section>
513507

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/context-menu/context-menu.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ export function ContextMenu({
147147
disableCreate = false,
148148
disableCreateFolder = false,
149149
}: ContextMenuProps) {
150+
// Section visibility for divider logic
151+
const hasNavigationSection = showOpenInNewTab && onOpenInNewTab
152+
const hasEditSection =
153+
(showRename && onRename) || (showCreate && onCreate) || (showCreateFolder && onCreateFolder)
154+
const hasCopySection = (showDuplicate && onDuplicate) || (showExport && onExport)
155+
150156
return (
151157
<Popover
152158
open={isOpen}
@@ -176,7 +182,7 @@ export function ContextMenu({
176182
Open in new tab
177183
</PopoverItem>
178184
)}
179-
{showOpenInNewTab && onOpenInNewTab && <PopoverDivider />}
185+
{hasNavigationSection && (hasEditSection || hasCopySection) && <PopoverDivider />}
180186

181187
{/* Edit and create actions */}
182188
{showRename && onRename && (
@@ -214,7 +220,7 @@ export function ContextMenu({
214220
)}
215221

216222
{/* Copy and export actions */}
217-
{(showDuplicate || showExport) && <PopoverDivider />}
223+
{hasEditSection && hasCopySection && <PopoverDivider />}
218224
{showDuplicate && onDuplicate && (
219225
<PopoverItem
220226
disabled={disableDuplicate}
@@ -239,7 +245,7 @@ export function ContextMenu({
239245
)}
240246

241247
{/* Destructive action */}
242-
<PopoverDivider />
248+
{(hasNavigationSection || hasEditSection || hasCopySection) && <PopoverDivider />}
243249
<PopoverItem
244250
disabled={disableDelete}
245251
onClick={() => {

apps/sim/components/emcn/components/avatar/avatar.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const avatarVariants = cva('relative flex shrink-0 overflow-hidden rounded-full'
1616
sm: 'h-8 w-8',
1717
md: 'h-10 w-10',
1818
lg: 'h-12 w-12',
19-
xl: 'h-16 w-16',
2019
},
2120
},
2221
defaultVariants: {
@@ -42,7 +41,6 @@ const avatarStatusVariants = cva(
4241
sm: 'h-2.5 w-2.5',
4342
md: 'h-3 w-3',
4443
lg: 'h-3.5 w-3.5',
45-
xl: 'h-4 w-4',
4644
},
4745
},
4846
defaultVariants: {

0 commit comments

Comments
 (0)