From bd76bce87ccb1dfd6267a096f21feb78a75cf780 Mon Sep 17 00:00:00 2001 From: Talisson Costa Date: Tue, 17 Nov 2026 11:37:22 -0300 Subject: [PATCH 1/2] feat(Tables): Open table filters as a popover, a bottom sheet on phones TableFilter is built on Popover instead of InlineModal, so the feature list filters (Tags, Value, Users, Groups, View, Sort) open anchored on desktop and as a bottom sheet on phones, instead of a blank full-screen panel. - TableFilterOptions reuses TableFilter rather than duplicating the trigger and InlineModal. - Filters whose title carries a count take a label, so the sheet and the trigger's popup have a name. - Title, search and list share the same 16px indent. Co-Authored-By: Claude Opus 5.5 --- .../web/components/tables/TableFilter.tsx | 69 ++++---- .../components/tables/TableFilterOptions.tsx | 150 ++++++++---------- .../components/tables/TableGroupsFilter.tsx | 1 + .../components/tables/TableOwnerFilter.tsx | 1 + .../web/components/tables/TableTagFilter.tsx | 3 +- .../components/tables/TableValueFilter.tsx | 3 +- 6 files changed, 103 insertions(+), 124 deletions(-) diff --git a/frontend/web/components/tables/TableFilter.tsx b/frontend/web/components/tables/TableFilter.tsx index d22809f0abb1..f87dd6efae99 100644 --- a/frontend/web/components/tables/TableFilter.tsx +++ b/frontend/web/components/tables/TableFilter.tsx @@ -1,15 +1,19 @@ -import React, { FC, ReactNode, useState } from 'react' -import InlineModal from 'components/InlineModal' +import React, { FC, ReactNode } from 'react' import { IonIcon } from '@ionic/react' import { caretDown } from 'ionicons/icons' import classNames from 'classnames' +import Popover from 'components/base/Popover' +import BareButton from 'components/base/forms/BareButton' type TableFilterType = { title: string | ReactNode + // Names the filter when the title isn't plain text (it has a count) + label?: string hideTitle?: boolean dropdownTitle?: ReactNode | string className?: string - children: ReactNode + size?: 'sm' | 'lg' + children: ReactNode | ((close: () => void) => ReactNode) 'data-test'?: string } @@ -19,26 +23,26 @@ const TableFilter: FC = ({ 'data-test': dataTest, dropdownTitle, hideTitle, + label, + size = 'sm', title, -}) => { - const [open, setOpen] = useState(false) - const toggle = function () { - if (!open) { - setOpen(true) - } - } - return ( - <> - ( + ( + @@ -51,25 +55,20 @@ const TableFilter: FC = ({ }} icon={caretDown} /> - - {open && ( - { - setTimeout(() => { - setOpen(false) - }, 10) - }} - containerClassName='px-0' - className='inline-modal table-filter inline-modal--sm right' - > - {children} - - )} - - ) -} + + )} + > + {(close) => ( + <> + {!hideTitle && ( +
+ {dropdownTitle || title} +
+ )} + {typeof children === 'function' ? children(close) : children} + + )} + +) export default TableFilter diff --git a/frontend/web/components/tables/TableFilterOptions.tsx b/frontend/web/components/tables/TableFilterOptions.tsx index 86aa64310584..09684239d0a8 100644 --- a/frontend/web/components/tables/TableFilterOptions.tsx +++ b/frontend/web/components/tables/TableFilterOptions.tsx @@ -1,14 +1,13 @@ import React, { FC, ReactNode, useMemo, useState } from 'react' -import InlineModal from 'components/InlineModal' -import { IonIcon } from '@ionic/react' -import { caretDown } from 'ionicons/icons' import classNames from 'classnames' +import TableFilter from './TableFilter' import TableFilterItem from './TableFilterItem' import Input from 'components/base/forms/Input' import Utils from 'common/utils/utils' -type TableFilterType = { +type TableFilterOptionsType = { title: ReactNode + label?: string dropdownTitle?: ReactNode | string className?: string size?: 'sm' | 'lg' @@ -20,9 +19,10 @@ type TableFilterType = { showSearch?: boolean } -const TableFilter: FC = ({ +const TableFilterOptions: FC = ({ className, isLoading, + label, multiple, onChange, options, @@ -33,13 +33,6 @@ const TableFilter: FC = ({ }) => { const [filter, setFilter] = useState('') - const [open, setOpen] = useState(false) - const toggle = function () { - if (!open) { - setOpen(true) - } - } - const filteredOptions = useMemo(() => { const lowerSearch = filter?.toLowerCase() return filter @@ -51,86 +44,69 @@ const TableFilter: FC = ({ return (
- - {title} - - - {open && ( - { - setTimeout(() => { - setOpen(false) - }, 10) - }} - containerClassName='px-0' - className={`inline-modal table-filter inline-modal--${size} right`} - > - {!!showSearch && ( -
- { - setFilter(Utils.safeParseEventValue(e)) - }} - className='full-width' - value={filter} - type='text' - size='xSmall' - placeholder='Search' - search - /> - {!filteredOptions?.length && ( -
No results
- )} -
- )} -
- {filteredOptions.map((v) => ( - { - if (!multiple) { - setOpen(false) - } - if (multiple) { - if ((value || []).includes(v.value)) { - onChange( - ((value as string[]) || []).filter( - (item) => item !== v.value, - ), - ) + {(close) => ( + <> + {!!showSearch && ( +
+ { + setFilter(Utils.safeParseEventValue(e)) + }} + className='full-width' + value={filter} + type='text' + size='xSmall' + placeholder='Search' + search + /> + {!filteredOptions?.length && ( +
No results
+ )} +
+ )} +
+ {filteredOptions.map((v) => ( + { + if (!multiple) { + close() + } + if (multiple) { + if ((value || []).includes(v.value)) { + onChange( + ((value as string[]) || []).filter( + (item) => item !== v.value, + ), + ) + } else { + onChange(((value as string[]) || []).concat([v.value])) + } } else { - onChange(((value as string[]) || []).concat([v.value])) + onChange(v.value) } - } else { - onChange(v.value) + }} + isActive={ + multiple ? value?.includes(v.value) : value === v.value } - }} - isActive={ - multiple ? value?.includes(v.value) : value === v.value - } - /> - ))} -
- - )} + /> + ))} +
+ + )} +
) } -export default TableFilter +export default TableFilterOptions diff --git a/frontend/web/components/tables/TableGroupsFilter.tsx b/frontend/web/components/tables/TableGroupsFilter.tsx index b0c6f40dc57e..a98f73e25ef6 100644 --- a/frontend/web/components/tables/TableGroupsFilter.tsx +++ b/frontend/web/components/tables/TableGroupsFilter.tsx @@ -34,6 +34,7 @@ const TableGroupsFilter: FC = ({ return ( diff --git a/frontend/web/components/tables/TableOwnerFilter.tsx b/frontend/web/components/tables/TableOwnerFilter.tsx index 61fa869d0c6b..2d9ec64a5d57 100644 --- a/frontend/web/components/tables/TableOwnerFilter.tsx +++ b/frontend/web/components/tables/TableOwnerFilter.tsx @@ -27,6 +27,7 @@ const TableOwnerFilter: FC = ({ return ( = ({
@@ -101,7 +102,7 @@ const TableTagFilter: FC = ({ } >
-
+
{ diff --git a/frontend/web/components/tables/TableValueFilter.tsx b/frontend/web/components/tables/TableValueFilter.tsx index 8c0c277c9a91..f5456b5a8269 100644 --- a/frontend/web/components/tables/TableValueFilter.tsx +++ b/frontend/web/components/tables/TableValueFilter.tsx @@ -49,6 +49,7 @@ const TableTagFilter: FC = ({ return (
= ({ } >
-
+
Date: Tue, 17 Nov 2026 11:41:10 -0300 Subject: [PATCH 2/2] refactor(Tables): Drop the table filter size prop Only the Users filter passed size='lg' (a fixed 355px). The default already grows with its content up to 355px, and the phone sheet is full width. Co-Authored-By: Claude Opus 5.5 --- frontend/web/components/tables/TableFilter.tsx | 4 +--- frontend/web/components/tables/TableFilterOptions.tsx | 3 --- frontend/web/components/tables/TableOwnerFilter.tsx | 1 - frontend/web/styles/project/_modals.scss | 10 ---------- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/frontend/web/components/tables/TableFilter.tsx b/frontend/web/components/tables/TableFilter.tsx index f87dd6efae99..cd39d5bfeb23 100644 --- a/frontend/web/components/tables/TableFilter.tsx +++ b/frontend/web/components/tables/TableFilter.tsx @@ -12,7 +12,6 @@ type TableFilterType = { hideTitle?: boolean dropdownTitle?: ReactNode | string className?: string - size?: 'sm' | 'lg' children: ReactNode | ((close: () => void) => ReactNode) 'data-test'?: string } @@ -24,14 +23,13 @@ const TableFilter: FC = ({ dropdownTitle, hideTitle, label, - size = 'sm', title, }) => ( ( void | Promise @@ -27,7 +26,6 @@ const TableFilterOptions: FC = ({ onChange, options, showSearch, - size = 'sm', title, value, }) => { @@ -48,7 +46,6 @@ const TableFilterOptions: FC = ({ title={title} label={label} hideTitle - size={size} className={classNames('user-select-none', className)} > {(close) => ( diff --git a/frontend/web/components/tables/TableOwnerFilter.tsx b/frontend/web/components/tables/TableOwnerFilter.tsx index 2d9ec64a5d57..a7567c0e1e02 100644 --- a/frontend/web/components/tables/TableOwnerFilter.tsx +++ b/frontend/web/components/tables/TableOwnerFilter.tsx @@ -28,7 +28,6 @@ const TableOwnerFilter: FC = ({ return (