-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create advanced filters has #47918
create advanced filters has #47918
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, suggested only small renames
src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersHasPage.tsx
Outdated
Show resolved
Hide resolved
src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersHasPage.tsx
Outdated
Show resolved
Hide resolved
src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersHasPage.tsx
Outdated
Show resolved
Hide resolved
@rayane-djouah Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@289Adam289 can you please merge main so we can easily access the filters via the UI?
const shouldShowExpenseSpecificFilter = currentType === CONST.SEARCH.DATA_TYPES.EXPENSE; | ||
const shouldShowChatSpecificFilter = currentType === CONST.SEARCH.DATA_TYPES.CHAT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to determine which filters are present for invoice and trip types also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could declare different arrays for each type and then return the values depending on type, similar to what we do here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luacmartins could you create a short list of type-specific filters and indicate when they should be visible? (e.g., Has
is only visible when type=chat). It would be a huge help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the correct list. @JmillsExpensify could you please confirm?
Expense
Date, currency, merchant, description, reportID, total, category, keywords, taxRate, expenseType, tag, from, to
Invoice
Date, currency, merchant, description, reportID, total, category, keywords, taxRate, tag, from, to
Trip
Date, currency, merchant, description, reportID, total, category, keywords, taxRate, tag, from, to
Chat
Date, keywords, from, to, in, has, is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming we want to confirm the full list, aren't we missing card
? Then for total
did we decide to make that context-specific or will we have distinct filters for expense-total
and report-total
?
I also think we should have card
for invoice and trip given that those expenses could have been made on a credit card, right?
Finally comment is to
for chats. This is who you sent any message to? That could get a little confusing, as I guess it's implied that it's from "you" and you can change that if you want? I'm not convinced we need that filter to start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming we want to confirm the full list, aren't we missing card?
Ah yes, I missed the card filter.
Then for total did we decide to make that context-specific or will we have distinct filters for expense-total and report-total?
This is what we have in the doc:
The syntax is context specific, so if you are searching for a total on the Expenses filter, you’re searching for expense totals. If you are searching for a total on report-focused filter (e.g. Drafts), then you’re searching for report totals.
This is who you sent any message to?
Correct. We can remove the filter from chats.
So the final list is:
Expense
Date, currency, merchant, description, reportID, total, category, keywords, taxRate, expenseType, tag, from, to, cardID
Invoice
Date, currency, merchant, description, reportID, total, category, keywords, taxRate, tag, from, to, cardID
Trip
Date, currency, merchant, description, reportID, total, category, keywords, taxRate, tag, from, to, cardID
Chat
Date, keywords, from, in, has, is
Does that look right?
@289Adam289 Instead of defining arrays for each type, I think we can avoid code repetition by defining a const baseFilterConfig = {
date: { description: 'common.date', route: ROUTES.SEARCH_ADVANCED_FILTERS_DATE, title: ... },
currency: { description: 'common.currency', route: ROUTES.SEARCH_ADVANCED_FILTERS_CURRENCY, title: ...},
merchant: { description: 'common.merchant', route: ROUTES.SEARCH_ADVANCED_FILTERS_MERCHANT, title: ... },
description: { description: 'common.description', route: ROUTES.SEARCH_ADVANCED_FILTERS_DESCRIPTION, title: ... },
reportID: { description: 'common.reportID', route: ROUTES.SEARCH_ADVANCED_FILTERS_REPORT_ID, title: ... },
total: { description: 'common.total', route: ROUTES.SEARCH_ADVANCED_FILTERS_AMOUNT, title: ... },
category: { description: 'common.category', route: ROUTES.SEARCH_ADVANCED_FILTERS_CATEGORY, title: ... },
keywords: { description: 'search.filters.hasKeywords', route: ROUTES.SEARCH_ADVANCED_FILTERS_KEYWORD, title: ... },
taxRate: { description: 'workspace.taxes.taxRate', route: ROUTES.SEARCH_ADVANCED_FILTERS_TAX_RATE, title: ... },
expenseType: { description: 'search.expenseType', route: ROUTES.SEARCH_ADVANCED_FILTERS_EXPENSE_TYPE, title: ... },
tag: { description: 'common.tag', route: ROUTES.SEARCH_ADVANCED_FILTERS_TAG, title: ... },
from: { description: 'common.from', route: ROUTES.SEARCH_ADVANCED_FILTERS_FROM, title: ... },
to: { description: 'common.to', route: ROUTES.SEARCH_ADVANCED_FILTERS_TO, title: ... },
has: { description: 'search.filters.has', route: ROUTES.SEARCH_ADVANCED_FILTERS_HAS, title: ... }
...
};
const typeFiltersKeys = {
Expense: ['date', 'currency', 'merchant', 'description', 'reportID', 'total', 'category', 'keywords', 'taxRate', 'expenseType', 'tag', 'from', 'to'],
Invoice: ['date', 'currency', 'merchant', 'description', 'reportID', 'total', 'category', 'keywords', 'taxRate', 'tag', 'from', 'to'],
Trip: ['date', 'currency', 'merchant', 'description', 'reportID', 'total', 'category', 'keywords', 'taxRate', 'tag', 'from', 'to'],
Chat: ['date', 'keywords', 'from', 'to', 'has'],
}; and then create the filters array dynamically based on the type: const filters = useMemo(() => {
return typeFiltersKeys[searchAdvancedFilters.type].map((key) => ({
title: baseFilterConfig[key].title,
description: translate(baseFilterConfig[key].description),
route: baseFilterConfig[key].route
}));
}, [searchAdvancedFilters]); Another option is to define common filter subsets and then construct specific type configurations |
btw. this PR is waiting for #47789 merge because it's based on it. |
@rayane-djouah I applied changes suggested by you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We still need to address this comment: #47918 (comment) |
@289Adam289 - Accessing https://dev.new.expensify.com:8082/search?q=type%3Achat%20status%3Aall%20has%3Aattachment&isCustomQuery=true gives a 402 error response: |
I'm not sure whether the cause of the error is that the backend isn't ready for the 'has' filter or if we're missing something on the frontend |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-08-30.at.2.53.34.PM.movAndroid: mWeb ChromeScreen.Recording.2024-08-30.at.2.51.47.PM.moviOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-08-30.at.14.39.31.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-08-30.at.14.38.13.mp4MacOS: Chrome / SafariScreen.Recording.2024-08-30.at.2.36.27.PM.movMacOS: DesktopScreen.Recording.2024-08-30.at.2.49.22.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@luacmartins - What do you think about #47918 (comment)? |
Backend is returning a correct response for the |
@rayane-djouah the backend is not ready for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I have a PR up to add the |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.28-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.28-3 🚀
|
Details
Adds new
type=chat
specific filterHas
Fixed Issues
$#47497
PROPOSAL:
Tests
visit route
search/filters
Set type in onyx on "chat"
confirm
Has
filter only appears whentype="chat"
use
Has
filter and other filters that useSearchMultipleSelectionPicker
e.gExpenseType
Verify that no errors appear in the JS console
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2024-08-26.at.13.08.42.mp4
Android: mWeb Chrome
Screen.Recording.2024-08-26.at.13.11.11.mp4
iOS: Native
Screen.Recording.2024-08-26.at.13.02.06.mp4
iOS: mWeb Safari
Screen.Recording.2024-08-26.at.13.04.06.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop