-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Activity filter memo and maximum amount #2807
base: master
Are you sure you want to change the base?
Conversation
stores/ActivityStore.ts
Outdated
endDate: undefined | ||
endDate: undefined, | ||
memo: '', | ||
maximumAmount: Infinity |
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 it might be better to just have Infinity
/No limit
/No maximum
be a placeholder for the text input
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 will change it such that the maximumAmount textbox will show no limits as a placeholder.
Gonna Remove the Infinity one
stores/ActivityStore.ts
Outdated
@@ -33,6 +33,8 @@ export interface Filter { | |||
minimumAmount: number; | |||
startDate?: Date; | |||
endDate?: Date; | |||
memo: string; | |||
maximumAmount: number; |
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.
nit: would probably just slot maximumAmount
right below minimumAmount
|
||
expect(filteredActivities.length).toBe(1); | ||
expect(filteredActivities[0].getNote).toBe('Payment for invoice'); | ||
}); |
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.
Love to see the test cases here!
nit: the merge commit is OK, but would be better to you rebase the PR instead |
nit: you can just put an x inbetween the [ ] brackets in PR description to check the boxes |
89a0557
to
edca2fd
Compare
Didn't test yet, but this looks pretty nice! Can you please localize the placeholders as well? |
edca2fd
to
1510996
Compare
The |
@myxmaster The Minimum Amount (sats) is 0 right? or should i make a placeholder similar to Maximum Amount sats for Minimum amount |
Where do I get all the data for memos and notes for testing purposes? As for now, I used lightning receive to create invoices to fill the activity list. |
Currently (before this PR) we have "0" as placeholder in this input and we should keep it that way imo. |
Yeah, you can just make invoices with memo... Notes are something else. (But I definitely like the idea to combine memo and notes for the filter.) |
alright so for minimum I will make it 0 and for maximum no limit |
1510996
to
85f16db
Compare
Looking good! Just one more thought: |
utils/ActivityFilterUtils.ts
Outdated
@@ -128,6 +136,24 @@ class ActivityFilterUtils { | |||
(activity) => activity.getDate.getTime() < endDate.getTime() | |||
); | |||
} | |||
if ((filter.memo || '').trim() !== '') { |
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.
|| ''
should be redundant since memo is initialized with ''
?
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.
Initally I used filter.memo.trim() !== ''
and a few test cases were failing so to tackle that I used (filter.memo || '').trim() !== ''
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.
Yes, you need to add memo: ''
to getDefaultFilter()
in utils\ActivityFilterUtils.test.ts
.
Trimming helps prevent accidental spaces but still allows multi-word filtering like 'payment memo'. Let me know if you'd still prefer to remove it |
Right now you can only paste Why do we even care if people filter |
fd7f732
to
549de9b
Compare
LGTM now :) |
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 have noticed the Activity view freezes after we set up the Memo/Note field.
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.
Not able to type in anything in the memo/note field , recreated it in both emulator and physical android device
Screen.Recording.2025-02-11.at.5.05.39.PM.mov
Yes, I see the It happens because we are not merging the filters, which we get from Storage, with DEFAULT_FILTERS in
This is something else and has nothing to do with this PR. I think it is some old workaround for the virtual keyboard covering some stuff. Edit: |
Hello @shubhamkmr04 and @myxmaster I believe the issue TypeError: Cannot read property 'toLowerCase' of undefined can be resolved by using filter.memo?.toLowerCase() || ''; Regarding the other two issues, I’m not entirely sure why they’re occurring. But if we put the memo filter textbox above the min and max, the keyboard opens up ![]() ![]() Please let me know the next steps or should I put the memo box above |
Screenrecording_20250211_231918.mp4 |
Yes, it should fix it, but it masks the underlying issue of incomplete filter data. Imo the updated |
Regarding the keyboard appear/disappear issue: Only minor code changes needed:
|
so should I make changes according to your suggestion? |
Merging the filters with Replacing FlatList with ScrollView |
We should try it out. I think it will work without issue. |
549de9b
to
7d7bfa5
Compare
Tested -> no issues now when coming from Zeus version without the new filter. ScrollView also working perfectly fine, no keyboard issues for me (tested with Android emulator only). |
@Mayank2808sharma so for iOS we still this small issue when we can't see the fields that are in the bottom of the view because keyboard won't go away Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-02-14.at.20.57.07.mp4It should be a small fix, you can take reference from here |
Thanks for the resource. I have made the changes, let me know what you think |
Description
Relates to issue: ZEUS-83
I added the functionality to filter the activity list using memo/note and maximum amount.
This pull request is categorized as a:
Checklist
yarn run tsc
and made sure my code compiles correctlyyarn run lint
and made sure my code didn’t contain any problematic patternsyarn run prettier
and made sure my code is formatted correctlyyarn run test
and made sure all of the tests passTesting
If you modified or added a utility file, did you add new unit tests?
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
Locales
Third Party Dependencies and Packages
yarn
after this PR is merged inpackage.json
andyarn.lock
have been properly updatedOther: