Skip to content

[Due for payment 2025-07-04] Bring design patterns inline for all search filters #64021

Closed

Description

@JmillsExpensify

Background

We recently introduced two types of search filters. The first is "pop-over" filters, which live above the search results on the Reports page. The second kind of filter are "UI" filters, which are accessed when clicking on Filters.

Scope of changes

We'd like to extend the newer design patterns introduced with the "pop-over" filters, and make sure that every filter in Filters works exactly the same.

What this means in practice is:

Single-select

All single select UI filters should look like this.

Image

The relevant single-select UI filters are:

Note: The single-select workspace filter is moving to multi-select in #61628.

Multi-select

All multi-select UI filters should look like this.

Image

The current multi-select UI filters are:

From and To are also special multi-select cases, and should look like this.

Image

Date

All date UI filters should look like this.

Image

The current list of date UI filters are:

  • Date
  • Posted date
  • Approved date
  • Exported date
  • Paid date
  • Submitted date
Issue OwnerCurrent Issue Owner: @JmillsExpensify

Activity

  1. added
    External
    on Jun 11, 2025
  2. added
    Daily
    Bug
    on Jun 11, 2025
  3. added
    Help Wanted
    on Jun 11, 2025
  4. melvin-bot commented on Jun 11, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @ZhenjaHorbach (External)

  5. melvin-bot commented on Jun 11, 2025

    @melvin-bot

    Current assignee @JmillsExpensify is eligible for the Bug assigner, not assigning anyone new.

  6. sofi-a commented on Jun 11, 2025

    @sofi-a
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-06-11 23:31:46 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Bring design patterns inline for all search filters

    What is the root cause of that problem?

    New feature request

    What changes do you think we should make in order to solve the problem?

    1. Create a component MultiSelectMembersListItem in src/components for rendering a list of user avatars with checkboxes like in the design.
    2. Update src/components/Search/SearchFiltersParticipantsSelector to use MultiSelectMembersListItem.
    function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate}: SearchFiltersParticipantsSelectorProps) {
    ...
        return (
            <SelectionList
                ....
                ListItem={MultiSelectMembersListItem}
                ....
            />
        );
    ...
    }
    1. Update the SearchFiltersToPage and SearchFiltersFromPage pages to match the new design.
    function SearchFiltersToPage() { // or SearchFiltersFromPage
    ...
        const [selectedAccountIDs, setSelectedAccountIDs] = useState<string[]>(searchAdvancedFiltersForm?.to ?? []); // change to searchAdvancedFiltersForm?.from ?? [] for SearchFiltersFromPage
    
        const updateSelectedAccountIDs = useCallback((accountIDs: string[]) => {
            setSelectedAccountIDs(accountIDs);
        }, []);
    
        const resetChanges = useCallback(() => {
            setSelectedAccountIDs([]);
        }, []);
    
        const applyChanges = useCallback(() => {
            updateAdvancedFilters({to: selectedAccountIDs.length ? selectedAccountIDs : null}); // change "to" to "from" for SearchFiltersFromPage
            Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS);
        }, [selectedAccountIDs]);
    
        return (
            <ScreenWrapper
                testID={SearchFiltersToPage.displayName} // SearchFiltersToPage.displayName for SearchFiltersFromPage
                ...
            >
                <HeaderWithBackButton
                    title={translate('common.to')} // 'common.from' for SearchFiltersFromPage
                    onBackButtonPress={() => {
                        Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS);
                    }}
                />
                <View style={[styles.flex1]}>
                    <SearchFiltersParticipantsSelector
                        initialAccountIDs={searchAdvancedFiltersForm?.to ?? []} // change to searchAdvancedFiltersForm?.from ?? [] for SearchFiltersFromPage
                        onFiltersUpdate={updateSelectedAccountIDs}
                    />
                </View>
                <FixedFooter style={styles.mtAuto}>
                    <Button
                        ...
                        text={translate('common.reset')}
                        onPress={resetChanges}
                    />
                    <Button
                        ...
                        success
                        text={translate('common.save')}
                        onPress={applyChanges}
                    />
                </FixedFooter>
            </ScreenWrapper>
        );
    }
    1. Create a new component SearchFiltersDateRootView in src/pages/Search/SearchAdvancedFiltersPage/SearchDateFilterBase/RootView.tsx
    type RootViewProps = {
        title: string;
        value: SearchFiltersExportedPageValues;
        applyChanges: () => void;
        resetChanges: () => void;
        setView: (view: SearchDateModifier) => void;
        setValue: (key: SearchDateModifier, value: string | null) => void;
    };
    
    function SearchFiltersDateRootView({title, value, applyChanges, resetChanges, setView, setValue}: RootViewProps) {
        const styles = useThemeStyles();
        const {translate} = useLocalize();
    
        const unformattedDateOn = value?.[CONST.SEARCH.DATE_MODIFIERS.ON];
        const unformattedDateAfter = value?.[CONST.SEARCH.DATE_MODIFIERS.AFTER];
        const unformattedDateBefore = value?.[CONST.SEARCH.DATE_MODIFIERS.BEFORE];
    
        const dateOn = unformattedDateOn ? undefined;
        const dateAfter = unformattedDateAfter ?? undefined;
        const dateBefore = unformattedDateBefore ?? undefined;
    
        return (
            <ScreenWrapper
                testID={SearchFiltersDateRootView.displayName}
                ...
            >
                <HeaderWithBackButton
                    title={title}
                    onBackButtonPress={() => {
                        Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS);
                    }}
                />
    
                <View>
                    <MenuItem
                        ...
                        title={translate('common.on')}
                        description={dateOn}
                        onPress={() => setView(CONST.SEARCH.DATE_MODIFIERS.ON)}
                    />
                    <MenuItem
                        ...
                        title={translate('common.after')}
                        description={dateAfter}
                        onPress={() => setView(CONST.SEARCH.DATE_MODIFIERS.AFTER)}
                    />
                    <MenuItem
                        ...
                        title={translate('common.before')}
                        description={dateBefore}
                        onPress={() => setView(CONST.SEARCH.DATE_MODIFIERS.BEFORE)}
                    />
                </View>
    
                <FixedFooter style={styles.mtAuto}>
                    <Button
                        ...
                        text={translate('common.reset')}
                        onPress={resetChanges}
                    />
                    <Button
                        ...
                        success
                        text={translate('common.save')}
                        onPress={applyChanges}
                    />
                </FixedFooter>
            </ScreenWrapper>
        );
    }
    1. Create another component SearchFiltersDateCalendarView in src/pages/Search/SearchAdvancedFiltersPage/SearchDateFilterBase/CalendarView.tsx
    type CalendarViewProps = {
        view: SearchDateModifier;
        value: string | null;
        navigateBack: () => void;
        setValue: (key: SearchDateModifier, value: string | null) => void;
    };
    
    function SearchFiltersDateCalendarView({view, value, navigateBack, setValue}: CalendarViewProps) {
        const styles = useThemeStyles();
        const {translate} = useLocalize();
        const [localDateValue, setLocalDateValue] = useState(value);
    
        const lowerDateModifier = view.toLowerCase();
    
        const resetChanges = () => {
            setValue(view, null);
            navigateBack();
        };
    
        const applyChanges = () => {
            setValue(view, localDateValue);
            navigateBack();
        };
    
        return (
            <ScreenWrapper
                testID={SearchFiltersDateCalendarView.displayName}
                ...
            >
                <HeaderWithBackButton
                    title={translate(`common.${lowerDateModifier}`)}
                    onBackButtonPress={navigateBack}
                />
    
                <CalendarPicker
                    value={localDateValue ?? undefined}
                    onSelected={setLocalDateValue}
                    maxDate={CONST.CALENDAR_PICKER.MAX_DATE}
                    minDate={CONST.CALENDAR_PICKER.MIN_DATE}
                />
    
                <FixedFooter style={styles.mtAuto}>
                    <Button
                        ...
                        text={translate('common.reset')}
                        onPress={resetChanges}
                    />
                    <Button
                        ...
                        success
                        text={translate('common.save')}
                        onPress={applyChanges}
                    />
                </FixedFooter>
            </ScreenWrapper>
        );
    }
    1. Move SearchDateFilterBase to src/components/Search/SearchDateFilterBase/index.tsx and update it to match the new design.
    function SearchDateFilterBase({dateKey, titleKey}: SearchDateFilterBaseProps) {
        const [searchAdvancedFiltersForm] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true});
    
        const [view, setView] = useState<SearchDateModifier | null>(null);
        const [localDateValues, setLocalDateValues] = useState<SearchFiltersExportedPageValues>({
            After: searchAdvancedFiltersForm?.[`${dateKey}${CONST.SEARCH.DATE_MODIFIERS.AFTER}`] ?? null,
            Before: searchAdvancedFiltersForm?.[`${dateKey}${CONST.SEARCH.DATE_MODIFIERS.BEFORE}`] ?? null,
            On: searchAdvancedFiltersForm?.[`${dateKey}${CONST.SEARCH.DATE_MODIFIERS.ON}`] ?? null,
        });
    
        const setDateValue = (key: SearchDateModifier, dateValue: string | null) => {
            setLocalDateValues((currentValue) => {
                return {
                    ...currentValue,
                    [key]: dateValue,
                };
            });
        };
    
        const navigateToRootView = useCallback(() => {
            setView(null);
        }, [setView]);
    
        const resetChanges = useCallback(() => {
            // Reset each field back to null
            setLocalDateValues((prev) => {
                return Object.fromEntries(Object.entries(prev).map(([key]) => [key, null]));
            });
        }, [setLocalDateValues]);
    
        const applyChanges = useCallback(() => {
            updateAdvancedFilters({
                [`${dateKey}${CONST.SEARCH.DATE_MODIFIERS.ON}`]: localDateValues?.[CONST.SEARCH.DATE_MODIFIERS.ON],
                [`${dateKey}${CONST.SEARCH.DATE_MODIFIERS.AFTER}`]: localDateValues?.[CONST.SEARCH.DATE_MODIFIERS.AFTER],
                [`${dateKey}${CONST.SEARCH.DATE_MODIFIERS.BEFORE}`]: localDateValues?.[CONST.SEARCH.DATE_MODIFIERS.BEFORE],
            });
            Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS);
        }, [dateKey, localDateValues]);
    
        if (!view) {
            return (
                <SearchFiltersDateRootView
                    title={translate('titleKey')}
                    value={localDateValues}
                    setView={setView}
                    setValue={setDateValue}
                    applyChanges={applyChanges}
                    resetChanges={resetChanges}
                />
            );
        }
    
        return (
            <SearchFiltersDateCalendarView
                view={view}
                value={localDateValues[view]}
                setValue={setDateValue}
                navigateBack={navigateToRootView}
            />
        );
    }

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    N/A

  7. sofi-a commented on Jun 11, 2025

    @sofi-a
    Contributor

    @JmillsExpensify I'd like to take this one since I'm already working on #63152.

  8. ZhenjaHorbach commented on Jun 11, 2025

    @ZhenjaHorbach
    Contributor

    @JmillsExpensify I'd like to take this one since I'm already working on #63152.

    Sorry
    But I don't see any details in your proposal 😅

  9. sofi-a commented on Jun 12, 2025

    @sofi-a
    Contributor

    Updated proposal.

  10. ZhenjaHorbach commented on Jun 12, 2025

    @ZhenjaHorbach
    Contributor

    Okay
    Now it looks solid
    Thanks !

    In this case I don't mind to go with this proposal !

    🎀 👀 🎀 C+ reviewed !

  11. 19 remaining items

  12. ZhenjaHorbach commented on Jul 3, 2025

    @ZhenjaHorbach
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      New feature

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    I'm not sure that tests are needed here since these are UI updates
    and part of a project
    But ....

    Regression Test Proposal

    Test:

    1. Navigate to the search page.
    2. Open the Filters modal.
    3. Verify the Assignee, To, and From filters use the updated design.
    4. Verify that the "Reset" button unchecks all selected users.
    5. Verify that changing the From filter in the filters bar also updates the From filter in the filters list, and vice versa.
    6. Verify that the Date, Approved date, Paid date, and Submitted date filters use the updated design.
    7. Verify the "Reset" button in the calendar view only unsets the value for the selected modifier (i.e. After, Before, or On).
    8. Verify the "Reset" button in the root filter view unsets the value for all modifiers (i.e. After, Before, and On).
    9. Verify that changing the Date filter in the filters bar also updates the Date filter in the filters list, and vice versa.
    10. Verify that the Billable and Reimbursable filters use the updated design.
    11. Verify that the Card, Category, Currency, Expense type, and Tag filters use the updated design.

    Do we agree 👍 or 👎

  13. added
    Daily
    and removed
    Weekly
    on Jul 4, 2025
  14. melvin-bot commented on Jul 4, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@JmillsExpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  15. melvin-bot commented on Jul 7, 2025

    @melvin-bot

    @JmillsExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  16. ZhenjaHorbach commented on Jul 7, 2025

    @ZhenjaHorbach
    Contributor

    Not overdue
    We are ready for payment !

  17. JmillsExpensify commented on Jul 9, 2025

    @JmillsExpensify
    ContributorAuthor

    Back from OOO. Payment summary as follows:

  18. JmillsExpensify commented on Jul 9, 2025

    @JmillsExpensify
    ContributorAuthor

    Upwork offer sent and regression steps added.

  19. ZhenjaHorbach commented on Jul 9, 2025

    @ZhenjaHorbach
    Contributor

    Requested in ND

  20. JmillsExpensify commented on Jul 9, 2025

    @JmillsExpensify
    ContributorAuthor

    Awesome, also paid out Upwork contract, so closing this one out.

  21. garrettmknight commented on Jul 21, 2025

    @garrettmknight
    Contributor

    $250 approved for @ZhenjaHorbach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions