Skip to content

Commit c8672f7

Browse files
committed
improvement(tables): remove column type filter
1 parent 483c35c commit c8672f7

1 file changed

Lines changed: 3 additions & 71 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/tables

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

Lines changed: 3 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export function Tables() {
7676
} | null>(null)
7777
const [rowCountFilter, setRowCountFilter] = useState<string[]>([])
7878
const [ownerFilter, setOwnerFilter] = useState<string[]>([])
79-
const [columnTypeFilter, setColumnTypeFilter] = useState<string[]>([])
8079
const [uploading, setUploading] = useState(false)
8180
const [uploadProgress, setUploadProgress] = useState({ completed: 0, total: 0 })
8281
const csvInputRef = useRef<HTMLInputElement>(null)
@@ -111,12 +110,6 @@ export function Tables() {
111110
if (ownerFilter.length > 0) {
112111
result = result.filter((t) => ownerFilter.includes(t.createdBy))
113112
}
114-
if (columnTypeFilter.length > 0) {
115-
result = result.filter((t) =>
116-
t.schema.columns.some((col) => columnTypeFilter.includes(col.type))
117-
)
118-
}
119-
120113
const col = activeSort?.column ?? 'created'
121114
const dir = activeSort?.direction ?? 'desc'
122115
return [...result].sort((a, b) => {
@@ -146,15 +139,7 @@ export function Tables() {
146139
}
147140
return dir === 'asc' ? cmp : -cmp
148141
})
149-
}, [
150-
tables,
151-
debouncedSearchTerm,
152-
rowCountFilter,
153-
ownerFilter,
154-
columnTypeFilter,
155-
activeSort,
156-
members,
157-
])
142+
}, [tables, debouncedSearchTerm, rowCountFilter, ownerFilter, activeSort, members])
158143

159144
const rows: ResourceRow[] = useMemo(
160145
() =>
@@ -221,21 +206,6 @@ export function Tables() {
221206
return `${rowCountFilter.length} selected`
222207
}, [rowCountFilter])
223208

224-
const columnTypeDisplayLabel = useMemo(() => {
225-
if (columnTypeFilter.length === 0) return 'All'
226-
if (columnTypeFilter.length === 1) {
227-
const labels: Record<string, string> = {
228-
string: 'Text',
229-
number: 'Number',
230-
boolean: 'Boolean',
231-
date: 'Date',
232-
json: 'JSON',
233-
}
234-
return labels[columnTypeFilter[0]] ?? columnTypeFilter[0]
235-
}
236-
return `${columnTypeFilter.length} selected`
237-
}, [columnTypeFilter])
238-
239209
const ownerDisplayLabel = useMemo(() => {
240210
if (ownerFilter.length === 0) return 'All'
241211
if (ownerFilter.length === 1)
@@ -264,8 +234,7 @@ export function Tables() {
264234
[members]
265235
)
266236

267-
const hasActiveFilters =
268-
rowCountFilter.length > 0 || columnTypeFilter.length > 0 || ownerFilter.length > 0
237+
const hasActiveFilters = rowCountFilter.length > 0 || ownerFilter.length > 0
269238

270239
const filterContent = (
271240
<div className='flex w-[240px] flex-col gap-3 p-3'>
@@ -289,28 +258,6 @@ export function Tables() {
289258
className='h-[32px] w-full rounded-md'
290259
/>
291260
</div>
292-
<div className='flex flex-col gap-1.5'>
293-
<span className='font-medium text-[var(--text-secondary)] text-caption'>Column Types</span>
294-
<Combobox
295-
options={[
296-
{ value: 'string', label: 'Text' },
297-
{ value: 'number', label: 'Number' },
298-
{ value: 'boolean', label: 'Boolean' },
299-
{ value: 'date', label: 'Date' },
300-
{ value: 'json', label: 'JSON' },
301-
]}
302-
multiSelect
303-
multiSelectValues={columnTypeFilter}
304-
onMultiSelectChange={setColumnTypeFilter}
305-
overlayContent={
306-
<span className='truncate text-[var(--text-primary)]'>{columnTypeDisplayLabel}</span>
307-
}
308-
showAllOption
309-
allOptionLabel='All'
310-
size='sm'
311-
className='h-[32px] w-full rounded-md'
312-
/>
313-
</div>
314261
{memberOptions.length > 0 && (
315262
<div className='flex flex-col gap-1.5'>
316263
<span className='font-medium text-[var(--text-secondary)] text-caption'>Owner</span>
@@ -336,7 +283,6 @@ export function Tables() {
336283
type='button'
337284
onClick={() => {
338285
setRowCountFilter([])
339-
setColumnTypeFilter([])
340286
setOwnerFilter([])
341287
}}
342288
className='flex h-[32px] w-full items-center justify-center rounded-md text-[var(--text-secondary)] text-caption transition-colors hover-hover:bg-[var(--surface-active)]'
@@ -357,20 +303,6 @@ export function Tables() {
357303
: `Rows: ${rowCountFilter.length} selected`
358304
tags.push({ label, onRemove: () => setRowCountFilter([]) })
359305
}
360-
if (columnTypeFilter.length > 0) {
361-
const typeLabels: Record<string, string> = {
362-
string: 'Text',
363-
number: 'Number',
364-
boolean: 'Boolean',
365-
date: 'Date',
366-
json: 'JSON',
367-
}
368-
const label =
369-
columnTypeFilter.length === 1
370-
? `Type: ${typeLabels[columnTypeFilter[0]]}`
371-
: `Types: ${columnTypeFilter.length} selected`
372-
tags.push({ label, onRemove: () => setColumnTypeFilter([]) })
373-
}
374306
if (ownerFilter.length > 0) {
375307
const label =
376308
ownerFilter.length === 1
@@ -379,7 +311,7 @@ export function Tables() {
379311
tags.push({ label, onRemove: () => setOwnerFilter([]) })
380312
}
381313
return tags
382-
}, [rowCountFilter, columnTypeFilter, ownerFilter, members])
314+
}, [rowCountFilter, ownerFilter, members])
383315

384316
const handleContentContextMenu = useCallback(
385317
(e: React.MouseEvent) => {

0 commit comments

Comments
 (0)