-
Notifications
You must be signed in to change notification settings - Fork 79
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
Feat/request payment modal 16736 #16744
base: master
Are you sure you want to change the base?
Conversation
Jenkins Builds
|
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 in general, apart from the vertical (mis)alignment between the amount and the token selector when looking at the screenshot :)
if (!valid) | ||
return 0 | ||
|
||
return parseFloat(text.replace(LocaleUtils.userInputLocale.decimalPoint, ".")) |
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.
Are we fine with loss of precision here? 🤔
Build fails on all platforms
|
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.
Nice work! LGTM in general!
A few findings below.
id: reopenButton | ||
anchors.centerIn: parent | ||
text: "Reopen" | ||
enabled: !requestPaymentModalComponent.visible |
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.
Probably not needed. Also, here we're using the Component
and visible
is undefined.
StatusDialog { | ||
id: root | ||
|
||
required property SharedStores.RequestPaymentStore store |
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.
WDYT of removing the store dependency here and replace it with properties? Would be much clearer what is needed for this Modal.
I see we're not using many properties/functions from the store and could be easely done.
|
||
readonly property bool isSelectedHoldingValidAsset: !!selectedHolding.item | ||
|
||
readonly property var adaptor: TokenSelectorViewAdaptor { |
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 have this warning in storybook:
file:///status-desktop/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml:285:17: Unable to assign [undefined] to QAbstractItemModel*
store: control.requestPaymentStore | ||
|
||
onAccepted: { | ||
control.requestPaymentStore.addPaymentRequest(selectedTokenKey, amount, selectedAccountAddress, selectedNetworkChainId) |
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.
Missing requestPaymentStore.addPaymentRequest
implementation.
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 qml tests for the new component (or add a task to do it before we need to add more features on top of this)
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.
Definitely good job in general, however I have several concerns regarding the architecture which are worth amending imo:
- The modal should be fully decoupled from
StatusChatInput
.StatusChatInput
should only emit signal with request to launch the modal instead of managing it internally, because it causes thatStatusChagInput
depends on everything the modal depends on now and will depend on in the future. Those two things become tightly coupled unnecessarily. RequestPaymentStore
is probably not needed at all. Broadly speaking, the store is not intended to be a container to move stuff around UI components. It's to expose backend's functionality. And every backend's mode/signal/function should be exposed only once via a single store.- The
RequestPaymentModal
should be a plain UI component taking some models and emitting some signals with no dependency on any store. Also transformations like that done byTokenSelectorViewAdaptor
should not be done internally. Instead the modal should depend on the model. It's up to the caller to compose data using any adaptor that's needed.
In case of any doubts please ping me, I will be happy to discuss about that.
todo: remove unused imports todo: finish handling amount input
cfc1b4c
to
6556a35
Compare
Closes #16736
What does the PR do
Affected areas
Architecture compliance
My PR is consistent with this document: Status Desktop Architecture Guide
Screenshot of functionality (including design for comparison)
Impact on end user
What is the impact of these changes on the end user (before/after behaviour)
How to test
Enable request payment feature flag, go to any chat on mainnet.
Risk
Described potential risks and worst case scenarios.
Tick one: