-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add feed
syntax key
#57454
base: main
Are you sure you want to change the base?
Add feed
syntax key
#57454
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.
Good job. There are things that we can improve here, because the code surrounding cards is already pretty complex, so I think it's worth taking another look.
Also congratz for trying to write some tests 👍
General comment about commiting project.pbxproj
: if you have not changed anything in package.json, did not update any dependencies and/or pods - just app code, then do not commit changes to this file - just discard them.
@@ -43,6 +43,7 @@ const FILTER_KEYS = { | |||
FROM: 'from', | |||
TO: 'to', | |||
IN: 'in', | |||
FEED: 'feed', |
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.
this is super tiny nitpick but can you move this right below line 33, so that it is kinda "grouped" together with CARD_ID
import {getCardFeedNames, getSelectedCardsFromFeeds} from '@pages/Search/SearchAdvancedFiltersPage/SearchFiltersCardPage'; | ||
import type {WorkspaceCardsList} from '@src/types/onyx'; | ||
|
||
/* eslint-disable @typescript-eslint/naming-convention */ |
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.
why do we need this disable?
@@ -23,11 +25,9 @@ import ROUTES from '@src/ROUTES'; | |||
import type {Card, CardList, CompanyCardFeed, PersonalDetailsList, WorkspaceCardsList} from '@src/types/onyx'; | |||
import {isEmptyObject} from '@src/types/utils/EmptyObject'; | |||
|
|||
type CardFilterItem = Partial<OptionData> & AdditionalCardProps & {isCardFeed?: boolean; correspondingCards?: string[]}; | |||
type CardFilterItem = Partial<OptionData> & AdditionalCardProps & {isCardFeed?: boolean; correspondingCards?: string[]; keyForFeed: string}; |
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.
why not more simple name like: cardFeedKey
?
@@ -63,6 +63,7 @@ function createIndividualCardFilterItem(card: Card, personalDetailsList: Persona | |||
icon, | |||
}, | |||
isCardFeed: false, | |||
keyForFeed: '', |
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.
keyForFeed: '', | |
cardFeedKey: '', |
workspaceCardFeeds: Record<string, WorkspaceCardsList | undefined>, | ||
domainFeedsData: Record<string, DomainFeedData>, | ||
propsTranslate?: LocaleContextProps['translate'], | ||
): Record<string, CardFeedData> { |
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.
): Record<string, CardFeedData> { | |
): { |
If return types are not required, then we don't write them explicitly. TS can infer return types 99% of the time.
) { | ||
const displayValue = getFilterDisplayValue(filterKey, filterValue, personalDetails, reports, cardList); | ||
const displayValue = getFilterDisplayValue(filterKey, filterValue, personalDetails, reports, cardList, cardFeedNames); |
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.
please add 1 test case to buildSubstitutionsMap
tests that will cover cardFeedNames
@@ -69,6 +69,29 @@ function isCorporateCard(cardID: number) { | |||
return !!allCards[cardID]; | |||
} | |||
|
|||
/** | |||
* @param cardID |
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.
if there is no extra description to @param then please remove it.
This code used to be JS only, so IMO all the empty @param XXX
are leftovers from JS.
if (cardID.split('_').at(0) !== 'cards') { | ||
return `cards_${cardID}`; | ||
} | ||
return cardID; |
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.
double check if these 2 functions can be improved
: undefined; | ||
const cardIdsFilter = filters[CONST.SEARCH.SYNTAX_FILTER_KEYS.CARD_ID] ?? []; | ||
const feedFilter = filters[CONST.SEARCH.SYNTAX_FILTER_KEYS.FEED] ?? []; | ||
const groupedCards: Record<string, WorkspaceCardsList> = {}; |
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.
It is hard to understand just from name groupedCards
what is the purpose of this const. Can we come up with a better name?
@@ -453,6 +469,10 @@ function AdvancedSearchFilters() { | |||
.map((section) => { | |||
return section | |||
.map((key) => { | |||
// visually feeds resist into cards so they cannot be pressed directly and are not redirecting anywhere |
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.
This sentence sounds very strange, please update this comment
Explanation of Change
Fixed Issues
$ #56855
PROPOSAL: N/A
Tests
feed:
followed by existing card feed (workspace or domain).feed
:fundID
_bank
.Card
row.Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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
Android.mov
Android: mWeb Chrome
iOS: Native
iOS.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Web.mov
MacOS: Desktop
Desktop.mov