|
1 | | -import { BulkActionButton, cn, Tooltip } from '@sim/emcn' |
| 1 | +import { BulkActionBar, BulkActionButton, cn, Tooltip } from '@sim/emcn' |
2 | 2 | import { Ban, Circle, Trash } from '@sim/emcn/icons' |
3 | 3 | import { domAnimation, LazyMotion, m } from 'framer-motion' |
4 | 4 | import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' |
@@ -53,70 +53,70 @@ export function ActionBar({ |
53 | 53 | transition={{ duration: 0.2 }} |
54 | 54 | className={cn('-translate-x-1/2 fixed bottom-6 left-1/2 z-[var(--z-dropdown)]', className)} |
55 | 55 | > |
56 | | - <div className='flex items-center gap-2 rounded-[10px] border border-[var(--border)] bg-[var(--surface-2)] px-2 py-1.5'> |
57 | | - <span className='px-1 text-[var(--text-secondary)] text-small'> |
58 | | - {isAllSelected ? totalCount : selectedCount} selected |
59 | | - {showSelectAllOption && ( |
60 | | - <> |
61 | | - {' · '} |
62 | | - <button |
63 | | - type='button' |
64 | | - onClick={onSelectAll} |
65 | | - className='text-[var(--brand-secondary)] hover-hover:underline' |
66 | | - > |
67 | | - Select all |
68 | | - </button> |
69 | | - </> |
70 | | - )} |
71 | | - {isAllSelected && onClearSelectAll && ( |
72 | | - <> |
73 | | - {' · '} |
74 | | - <button |
75 | | - type='button' |
76 | | - onClick={onClearSelectAll} |
77 | | - className='text-[var(--brand-secondary)] hover-hover:underline' |
78 | | - > |
79 | | - Clear |
80 | | - </button> |
81 | | - </> |
82 | | - )} |
83 | | - </span> |
| 56 | + <BulkActionBar |
| 57 | + label={ |
| 58 | + <> |
| 59 | + {isAllSelected ? totalCount : selectedCount} selected |
| 60 | + {showSelectAllOption && ( |
| 61 | + <> |
| 62 | + {' · '} |
| 63 | + <button |
| 64 | + type='button' |
| 65 | + onClick={onSelectAll} |
| 66 | + className='text-[var(--brand-secondary)] hover-hover:underline' |
| 67 | + > |
| 68 | + Select all |
| 69 | + </button> |
| 70 | + </> |
| 71 | + )} |
| 72 | + {isAllSelected && onClearSelectAll && ( |
| 73 | + <> |
| 74 | + {' · '} |
| 75 | + <button |
| 76 | + type='button' |
| 77 | + onClick={onClearSelectAll} |
| 78 | + className='text-[var(--brand-secondary)] hover-hover:underline' |
| 79 | + > |
| 80 | + Clear |
| 81 | + </button> |
| 82 | + </> |
| 83 | + )} |
| 84 | + </> |
| 85 | + } |
| 86 | + > |
| 87 | + {showEnableButton && ( |
| 88 | + <Tooltip.Root> |
| 89 | + <Tooltip.Trigger asChild> |
| 90 | + <BulkActionButton aria-label='Enable' onClick={onEnable} disabled={isLoading}> |
| 91 | + <Circle className='size-[12px]' /> |
| 92 | + </BulkActionButton> |
| 93 | + </Tooltip.Trigger> |
| 94 | + <Tooltip.Content side='top'>Enable</Tooltip.Content> |
| 95 | + </Tooltip.Root> |
| 96 | + )} |
84 | 97 |
|
85 | | - <div className='flex items-center gap-[5px]'> |
86 | | - {showEnableButton && ( |
87 | | - <Tooltip.Root> |
88 | | - <Tooltip.Trigger asChild> |
89 | | - <BulkActionButton aria-label='Enable' onClick={onEnable} disabled={isLoading}> |
90 | | - <Circle className='size-[12px]' /> |
91 | | - </BulkActionButton> |
92 | | - </Tooltip.Trigger> |
93 | | - <Tooltip.Content side='top'>Enable</Tooltip.Content> |
94 | | - </Tooltip.Root> |
95 | | - )} |
| 98 | + {showDisableButton && ( |
| 99 | + <Tooltip.Root> |
| 100 | + <Tooltip.Trigger asChild> |
| 101 | + <BulkActionButton aria-label='Disable' onClick={onDisable} disabled={isLoading}> |
| 102 | + <Ban className='size-[12px]' /> |
| 103 | + </BulkActionButton> |
| 104 | + </Tooltip.Trigger> |
| 105 | + <Tooltip.Content side='top'>Disable</Tooltip.Content> |
| 106 | + </Tooltip.Root> |
| 107 | + )} |
96 | 108 |
|
97 | | - {showDisableButton && ( |
98 | | - <Tooltip.Root> |
99 | | - <Tooltip.Trigger asChild> |
100 | | - <BulkActionButton aria-label='Disable' onClick={onDisable} disabled={isLoading}> |
101 | | - <Ban className='size-[12px]' /> |
102 | | - </BulkActionButton> |
103 | | - </Tooltip.Trigger> |
104 | | - <Tooltip.Content side='top'>Disable</Tooltip.Content> |
105 | | - </Tooltip.Root> |
106 | | - )} |
107 | | - |
108 | | - {onDelete && canEdit && ( |
109 | | - <Tooltip.Root> |
110 | | - <Tooltip.Trigger asChild> |
111 | | - <BulkActionButton aria-label='Delete' onClick={onDelete} disabled={isLoading}> |
112 | | - <Trash className='size-[12px]' /> |
113 | | - </BulkActionButton> |
114 | | - </Tooltip.Trigger> |
115 | | - <Tooltip.Content side='top'>Delete</Tooltip.Content> |
116 | | - </Tooltip.Root> |
117 | | - )} |
118 | | - </div> |
119 | | - </div> |
| 109 | + {onDelete && canEdit && ( |
| 110 | + <Tooltip.Root> |
| 111 | + <Tooltip.Trigger asChild> |
| 112 | + <BulkActionButton aria-label='Delete' onClick={onDelete} disabled={isLoading}> |
| 113 | + <Trash className='size-[12px]' /> |
| 114 | + </BulkActionButton> |
| 115 | + </Tooltip.Trigger> |
| 116 | + <Tooltip.Content side='top'>Delete</Tooltip.Content> |
| 117 | + </Tooltip.Root> |
| 118 | + )} |
| 119 | + </BulkActionBar> |
120 | 120 | </m.div> |
121 | 121 | </LazyMotion> |
122 | 122 | ) |
|
0 commit comments