Skip to content

Commit d18c95d

Browse files
waleedlatif1emir-karabeg
authored andcommitted
fix(context-menu): make divider on context menu aware of available options (#2766)
1 parent 14570e7 commit d18c95d

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
@@ -465,9 +465,6 @@ export default function PlaygroundPage() {
465465
<Avatar size='lg'>
466466
<AvatarFallback>LG</AvatarFallback>
467467
</Avatar>
468-
<Avatar size='xl'>
469-
<AvatarFallback>XL</AvatarFallback>
470-
</Avatar>
471468
</VariantRow>
472469
<VariantRow label='with image'>
473470
<Avatar size='md'>
@@ -508,9 +505,6 @@ export default function PlaygroundPage() {
508505
<Avatar size='lg' status='online'>
509506
<AvatarFallback>LG</AvatarFallback>
510507
</Avatar>
511-
<Avatar size='xl' status='online'>
512-
<AvatarFallback>XL</AvatarFallback>
513-
</Avatar>
514508
</VariantRow>
515509
</Section>
516510

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)