Skip to content

Commit d04c96e

Browse files
improvement(tables): order the bar filter, sort, columns and drop the hidden count
1 parent 37f7db0 commit d04c96e

3 files changed

Lines changed: 36 additions & 18 deletions

File tree

apps/sim/app/workspace/[workspaceId]/components/resource/components/resource-options/resource-options.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ interface ResourceOptionsProps {
9191
* widgets; primary actions belong in the header's `actions`.
9292
*/
9393
aside?: ReactNode
94+
/**
95+
* Mirror of {@link aside} on the other side: rendered immediately to the RIGHT
96+
* of the filter/sort cluster and still grouped with it — e.g. the table editor's
97+
* Columns menu, which reads as the last item in the Filter/Sort/Columns row.
98+
*/
99+
asideEnd?: ReactNode
94100
/**
95101
* Control pinned to the far RIGHT of the bar, opposite the filter/sort cluster —
96102
* e.g. the table editor's Save-view button. Unlike `aside` it is a real action,
@@ -105,6 +111,7 @@ export const ResourceOptions = memo(function ResourceOptions({
105111
filter,
106112
filterTags,
107113
aside,
114+
asideEnd,
108115
trailing,
109116
}: ResourceOptionsProps) {
110117
/**
@@ -119,7 +126,13 @@ export const ResourceOptions = memo(function ResourceOptions({
119126
const popoverFilter = filter && filter.mode !== 'toggle' ? filter : null
120127

121128
const hasContent =
122-
search || sort || filter || aside || trailing || (filterTags && filterTags.length > 0)
129+
search ||
130+
sort ||
131+
filter ||
132+
aside ||
133+
asideEnd ||
134+
trailing ||
135+
(filterTags && filterTags.length > 0)
123136
if (!hasContent) return null
124137

125138
return (
@@ -187,6 +200,7 @@ export const ResourceOptions = memo(function ResourceOptions({
187200
) : null}
188201
{sort && (isToggleFilter || !popoverFilter) && <SortDropdown config={sort} />}
189202
</div>
203+
{asideEnd}
190204
</div>
191205
{trailing && <div className='ml-auto flex shrink-0 items-center gap-1.5'>{trailing}</div>}
192206
</div>

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/columns-menu/columns-menu.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ export const ColumnsMenu = memo(function ColumnsMenu({
8080
return (
8181
<Popover size='md' open={open} onOpenChange={setOpen}>
8282
<PopoverTrigger asChild>
83+
{/* `active` alone signals that something is hidden — the label stays fixed
84+
so the bar doesn't reflow as columns are toggled. */}
8385
<Chip active={hiddenCount > 0} leftIcon={Columns3}>
84-
{hiddenCount > 0 ? `Columns (${hiddenCount} hidden)` : 'Columns'}
86+
Columns
8587
</Chip>
8688
</PopoverTrigger>
8789
<PopoverContent

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -979,22 +979,14 @@ export function Table({
979979
aside={
980980
<>
981981
{viewsEnabled && (
982-
<>
983-
<ViewsMenu
984-
views={views}
985-
activeViewId={activeView?.id ?? null}
986-
onSelect={handleSelectView}
987-
onRename={handleRenameView}
988-
onDelete={handleDeleteView}
989-
canEdit={userPermissions.canEdit}
990-
/>
991-
<ColumnsMenu
992-
columns={columns}
993-
workflowGroups={tableWorkflowGroups}
994-
hiddenColumns={hiddenColumns}
995-
onChange={setHiddenColumns}
996-
/>
997-
</>
982+
<ViewsMenu
983+
views={views}
984+
activeViewId={activeView?.id ?? null}
985+
onSelect={handleSelectView}
986+
onRename={handleRenameView}
987+
onDelete={handleDeleteView}
988+
canEdit={userPermissions.canEdit}
989+
/>
998990
)}
999991
{embedded && (selection.totalRunning > 0 || selection.hasActiveDispatch) ? (
1000992
<RunStatusControl
@@ -1006,6 +998,16 @@ export function Table({
1006998
) : null}
1007999
</>
10081000
}
1001+
asideEnd={
1002+
viewsEnabled ? (
1003+
<ColumnsMenu
1004+
columns={columns}
1005+
workflowGroups={tableWorkflowGroups}
1006+
hiddenColumns={hiddenColumns}
1007+
onChange={setHiddenColumns}
1008+
/>
1009+
) : undefined
1010+
}
10091011
trailing={
10101012
viewsEnabled && isViewDirty && userPermissions.canEdit ? (
10111013
<Chip onClick={handleSaveView} disabled={updateViewMutation.isPending}>

0 commit comments

Comments
 (0)