Skip to content

Commit 23ad1f3

Browse files
committed
improvement(resource): render options aside left of filter/sort
The options-bar aside has a single other consumer (the table editor's embedded run/stop control), so instead of adding a separate slot, render aside itself to the left of the filter/sort cluster. Drops the extra slot and keeps one canonical control position; the run/stop control moves left too, which is fine for a status widget.
1 parent ce4d024 commit 23ad1f3

3 files changed

Lines changed: 9 additions & 20 deletions

File tree

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,9 @@ interface ResourceOptionsProps {
8484
filterTags?: FilterTag[]
8585
/**
8686
* Lightweight control rendered immediately to the LEFT of the filter/sort
87-
* cluster (still right-aligned after the search) — e.g. the knowledge view's
88-
* connected-source badge, which reads as part of the control row. Use this for
89-
* controls that belong alongside filter/sort; use {@link aside} for status
90-
* widgets that should sit at the far right edge.
91-
*/
92-
leading?: ReactNode
93-
/**
94-
* Supplementary right-aligned slot (pushed opposite the left-aligned
95-
* filter/sort via `justify-between`) for lightweight status content — e.g.
96-
* the table editor's run/stop control in embedded mode. Keep it to
97-
* badges/status widgets; primary actions belong in the header's `actions`.
87+
* cluster (right-aligned after the search) — e.g. the knowledge view's
88+
* connected-source badge or the table editor's embedded run/stop control. Keep
89+
* it to badges/status widgets; primary actions belong in the header's `actions`.
9890
*/
9991
aside?: ReactNode
10092
}
@@ -104,7 +96,6 @@ export const ResourceOptions = memo(function ResourceOptions({
10496
sort,
10597
filter,
10698
filterTags,
107-
leading,
10899
aside,
109100
}: ResourceOptionsProps) {
110101
/**
@@ -118,15 +109,14 @@ export const ResourceOptions = memo(function ResourceOptions({
118109
const isToggleFilter = filter?.mode === 'toggle'
119110
const popoverFilter = filter && filter.mode !== 'toggle' ? filter : null
120111

121-
const hasContent =
122-
search || sort || filter || leading || aside || (filterTags && filterTags.length > 0)
112+
const hasContent = search || sort || filter || aside || (filterTags && filterTags.length > 0)
123113
if (!hasContent) return null
124114

125115
return (
126116
<div className={cn('border-[var(--border)] border-b py-2.5', search ? 'px-6' : 'px-4')}>
127117
<div className='flex items-center justify-between'>
128118
{search && <SearchSection search={search} />}
129-
{leading && <div className='flex shrink-0 items-center gap-1.5'>{leading}</div>}
119+
{aside && <div className='flex shrink-0 items-center gap-1.5'>{aside}</div>}
130120
<div className='flex items-center'>
131121
{filterTags?.map((tag) => (
132122
<Chip key={tag.label} rightIcon={X} onClick={tag.onRemove}>
@@ -182,7 +172,6 @@ export const ResourceOptions = memo(function ResourceOptions({
182172
) : null}
183173
{sort && (isToggleFilter || !popoverFilter) && <SortDropdown config={sort} />}
184174
</div>
185-
{aside && <div className='flex shrink-0 items-center gap-1.5'>{aside}</div>}
186175
</div>
187176
</div>
188177
)

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ export function KnowledgeBase({
11541154
sort={sortConfig}
11551155
filter={filterContent ? { content: filterContent } : undefined}
11561156
filterTags={filterTags}
1157-
leading={connectorBadges}
1157+
aside={connectorBadges}
11581158
/>
11591159
<Resource.Table
11601160
columns={DOCUMENT_COLUMNS}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,9 @@ export function Table({
640640
}
641641
/>
642642
)}
643-
{/* Sort + filter render in both modes (left-aligned). In embedded (mothership)
644-
mode there's no Resource.Header, so the run/stop control rides in the options
645-
bar's right-aligned `aside` slot — opposite the left-aligned filter/sort. */}
643+
{/* Sort + filter render in both modes. In embedded (mothership) mode there's no
644+
Resource.Header, so the run/stop control rides in the options bar's `aside`
645+
slot, just left of filter/sort. */}
646646
<Resource.Options
647647
sort={sortConfig}
648648
filter={filterConfig}

0 commit comments

Comments
 (0)