Skip to content

Commit d17b22c

Browse files
committed
improvement(sidebar): overlay lock indicator on leading icon
1 parent 31cfb74 commit d17b22c

2 files changed

Lines changed: 49 additions & 31 deletions

File tree

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

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { generateId } from '@sim/utils/id'
66
import clsx from 'clsx'
77
import { ChevronRight, Folder, FolderOpen, MoreHorizontal } from 'lucide-react'
88
import { useParams, useRouter } from 'next/navigation'
9+
import { Tooltip } from '@/components/emcn'
910
import { Lock } from '@/components/emcn/icons'
1011
import { SIM_RESOURCES_DRAG_TYPE } from '@/lib/copilot/resource-types'
1112
import { getNextWorkflowColor } from '@/lib/workflows/colors'
@@ -513,17 +514,28 @@ export function FolderItem({
513514
)}
514515
aria-hidden='true'
515516
/>
516-
{isExpanded ? (
517-
<FolderOpen
518-
className='h-[16px] w-[16px] flex-shrink-0 text-[var(--text-icon)]'
519-
aria-hidden='true'
520-
/>
521-
) : (
522-
<Folder
523-
className='h-[16px] w-[16px] flex-shrink-0 text-[var(--text-icon)]'
524-
aria-hidden='true'
525-
/>
526-
)}
517+
<span className='relative flex-shrink-0'>
518+
{isExpanded ? (
519+
<FolderOpen className='h-[16px] w-[16px] text-[var(--text-icon)]' aria-hidden='true' />
520+
) : (
521+
<Folder className='h-[16px] w-[16px] text-[var(--text-icon)]' aria-hidden='true' />
522+
)}
523+
{folder.locked && (
524+
<Tooltip.Root>
525+
<Tooltip.Trigger asChild>
526+
<span className='-right-[4px] -bottom-[4px] absolute flex h-[12px] w-[12px] items-center justify-center rounded-full bg-[var(--surface-1)]'>
527+
<Lock
528+
className='pointer-events-none h-[10px] w-[10px] text-[var(--text-icon)]'
529+
aria-hidden='true'
530+
/>
531+
</span>
532+
</Tooltip.Trigger>
533+
<Tooltip.Content side='bottom'>
534+
<span>Locked</span>
535+
</Tooltip.Content>
536+
</Tooltip.Root>
537+
)}
538+
</span>
527539
{isEditing ? (
528540
<input
529541
ref={inputRef}
@@ -552,12 +564,6 @@ export function FolderItem({
552564
>
553565
{folder.name}
554566
</span>
555-
{folder.locked && (
556-
<Lock
557-
className='pointer-events-none h-[12px] w-[12px] flex-shrink-0 text-[var(--text-icon)]'
558-
aria-label='Folder is locked'
559-
/>
560-
)}
561567
</div>
562568
<button
563569
type='button'

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

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import clsx from 'clsx'
55
import { MoreHorizontal } from 'lucide-react'
66
import Link from 'next/link'
77
import { useParams } from 'next/navigation'
8+
import { Tooltip } from '@/components/emcn'
89
import { Lock } from '@/components/emcn/icons'
910
import { SIM_RESOURCES_DRAG_TYPE } from '@/lib/copilot/resource-types'
1011
import { workflowBorderColor } from '@/lib/workspaces/colors'
@@ -431,14 +432,31 @@ export function WorkflowItem({
431432
onClick={handleClick}
432433
onContextMenu={handleContextMenu}
433434
>
434-
<div
435-
className='h-[16px] w-[16px] flex-shrink-0 rounded-sm border-[2.5px]'
436-
style={{
437-
backgroundColor: workflow.color,
438-
borderColor: workflowBorderColor(workflow.color),
439-
backgroundClip: 'padding-box',
440-
}}
441-
/>
435+
<span className='relative flex-shrink-0'>
436+
<div
437+
className='h-[16px] w-[16px] rounded-sm border-[2.5px]'
438+
style={{
439+
backgroundColor: workflow.color,
440+
borderColor: workflowBorderColor(workflow.color),
441+
backgroundClip: 'padding-box',
442+
}}
443+
/>
444+
{workflow.locked && (
445+
<Tooltip.Root>
446+
<Tooltip.Trigger asChild>
447+
<span className='-right-[4px] -bottom-[4px] absolute flex h-[12px] w-[12px] items-center justify-center rounded-full bg-[var(--surface-1)]'>
448+
<Lock
449+
className='pointer-events-none h-[10px] w-[10px] text-[var(--text-icon)]'
450+
aria-hidden='true'
451+
/>
452+
</span>
453+
</Tooltip.Trigger>
454+
<Tooltip.Content side='bottom'>
455+
<span>Locked</span>
456+
</Tooltip.Content>
457+
</Tooltip.Root>
458+
)}
459+
</span>
442460
<div className='min-w-0 flex-1'>
443461
<div className='flex min-w-0 items-center gap-2'>
444462
{isEditing ? (
@@ -468,12 +486,6 @@ export function WorkflowItem({
468486
{workflow.name}
469487
</div>
470488
)}
471-
{!isEditing && workflow.locked && (
472-
<Lock
473-
className='pointer-events-none h-[12px] w-[12px] flex-shrink-0 text-[var(--text-icon)]'
474-
aria-label='Workflow is locked'
475-
/>
476-
)}
477489
{!isEditing && <Avatars workflowId={workflow.id} />}
478490
</div>
479491
</div>

0 commit comments

Comments
 (0)