Commit 55f232b
authored
feat: TAT-1921 add adl link to perps trade history ADL pill (#21970)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
- Updated ADL fill tag to be clickable and redirect to the MetaMask ADL
support article.
- Fixed TP/SL tags not appearing
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: updated ADL fill tag to be clickable and redirect to
the MetaMask ADL support article
CHANGELOG entry: fixed TP/SL tags not appearing
## **Related issues**
Fixes:
- [TAT-1921: Add link to ADL article when user tap on ADL pill in trade
history](https://consensyssoftware.atlassian.net/browse/TAT-1921)
- [TAT-1955: Fix missing tp/sl pills in trades activity view
regression](https://consensyssoftware.atlassian.net/browse/TAT-1955)
## **Manual testing steps**
1. Update `getUserAddressWithDefault` function to use ADL testing
address - (`HyperLiquidWalletService.ts`)
```ts
public async getUserAddressWithDefault(
accountId?: CaipAccountId,
): Promise<Hex> {
return "0x186e806622d9A8209d99694804Ff61bE830bEB2C";
const id = accountId || (await this.getCurrentAccountId());
return this.getUserAddress(id);
}
```
2. Check the Perps Trade history list for the "Auto-Deleveraging" tag
3. Click the tag to be redirected to the ADL support article
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<img width="461" height="88" alt="image"
src="https://github.com/user-attachments/assets/c6d388a8-f675-42b9-96c8-6bddfec53dec"
/>
<img width="461" height="88" alt="image"
src="https://github.com/user-attachments/assets/9878b953-36d8-445b-9561-2802efe6d41e"
/>
https://github.com/user-attachments/assets/9f8120d1-b401-4db2-bcd5-efb90598b719
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Makes the ADL tag in trades history tappable to open a support article
with analytics tracking, and enriches fills from orders to display TP/SL
pills; adds supporting constants and tests.
>
> - **Perps UI**:
> - **ADL tag interaction**: Wrap `PerpsTransactionItem` ADL tag in a
pressable; opens `PERPS_SUPPORT_ARTICLES_URLS.ADL_URL` via
`Linking.openURL` and tracks tap with `usePerpsEventTracking`
(`PERPS_ACTIVITY_HISTORY`, `TRADES`, `ADL_LEARN_MORE`, plus `asset` and
`order_timestamp`).
> - Use `TouchableOpacity` around tag; minor deps added to memo.
> - **Hooks**:
> - **Transaction history enrichment**: In `usePerpsTransactionHistory`,
map fills with matching order `detailedOrderType` before
`transformFillsToTransactions` to enable TP/SL pills in trade history.
> - **Constants/Events**:
> - Add `PERPS_SUPPORT_ARTICLES_URLS.ADL_URL` in `perpsConfig`.
> - Extend `eventNames`: add `TAB_NAME`, `ORDER_TIMESTAMP`,
`SCREEN_NAME.PERPS_ACTIVITY_HISTORY`, `ACTION_TYPE.ADL_LEARN_MORE`, and
`PERPS_HISTORY_TABS`.
> - **Tests**:
> - Update/add tests for ADL tag press to open URL and emit tracking
event.
> - Add tests validating fill enrichment for `detailedOrderType` across
scenarios.
> - Wire `usePerpsEventTracking` in `PerpsTransactionsView` test setup.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d91cdc8. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent efe74c4 commit 55f232b
File tree
7 files changed
+405
-16
lines changed- app/components/UI/Perps
- Views/PerpsTransactionsView
- components/PerpsTransactionItem
- constants
- hooks
7 files changed
+405
-16
lines changedLines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| |||
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
| 117 | + | |
| 118 | + | |
112 | 119 | | |
113 | 120 | | |
114 | 121 | | |
| |||
131 | 138 | | |
132 | 139 | | |
133 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
134 | 145 | | |
135 | 146 | | |
136 | 147 | | |
| |||
Lines changed: 68 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
64 | 80 | | |
65 | 81 | | |
66 | 82 | | |
| |||
144 | 160 | | |
145 | 161 | | |
146 | 162 | | |
| 163 | + | |
147 | 164 | | |
148 | 165 | | |
149 | 166 | | |
| |||
156 | 173 | | |
157 | 174 | | |
158 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
159 | 182 | | |
160 | 183 | | |
161 | | - | |
| 184 | + | |
162 | 185 | | |
163 | 186 | | |
164 | 187 | | |
| |||
490 | 513 | | |
491 | 514 | | |
492 | 515 | | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
493 | 559 | | |
494 | 560 | | |
495 | 561 | | |
| |||
Lines changed: 51 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
3 | 9 | | |
4 | 10 | | |
5 | 11 | | |
| |||
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
19 | 33 | | |
20 | 34 | | |
21 | 35 | | |
| |||
53 | 67 | | |
54 | 68 | | |
55 | 69 | | |
| 70 | + | |
| 71 | + | |
56 | 72 | | |
57 | 73 | | |
58 | 74 | | |
| |||
101 | 117 | | |
102 | 118 | | |
103 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
104 | 142 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
114 | 154 | | |
115 | | - | |
| 155 | + | |
116 | 156 | | |
117 | 157 | | |
118 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
| 174 | + | |
172 | 175 | | |
173 | 176 | | |
174 | 177 | | |
| |||
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| 221 | + | |
218 | 222 | | |
219 | 223 | | |
220 | 224 | | |
221 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
222 | 232 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
0 commit comments