Commit 3633f95
refactor(ramps): organize folder structure separating Views from components (#25791)
## **Description**
Reorganizes the Ramp code domain (`app/components/UI/Ramp/`) to clearly
separate Views (screens/modals) from reusable components, and moves
`RegionSelector` from the Settings domain into Ramp ownership.
**Problem:**
1. `RegionSelector` lived in `app/components/Views/Settings/` which is
owned by `@MetaMask/mobile-core-ux` in CODEOWNERS. Any Ramp changes to
it triggered cross-team reviews.
2. `app/components/UI/Ramp/components/` mixed navigable Views
(screens/modals) with pure reusable components, making the codebase
harder to navigate and understand.
**Solution:**
- Created `app/components/UI/Ramp/Views/` directory for all navigable
screens and modals
- Moved `RegionSelector` from
`app/components/Views/Settings/RegionSelector/` to
`app/components/UI/Ramp/Views/Settings/RegionSelector/`
- Moved all screen-like components from `components/` to `Views/`:
- `BuildQuote` → `Views/BuildQuote/`
- `TokenSelection` → `Views/TokenSelection/`
- `PaymentSelectionModal` → `Views/Modals/PaymentSelectionModal/`
- `SettingsModal` → `Views/Modals/SettingsModal/`
- `UnsupportedTokenModal` → `Views/Modals/UnsupportedTokenModal/`
- Updated all import paths across the codebase
- Regenerated snapshots for moved test files
**New structure:**
```
app/components/UI/Ramp/
├── Views/ # Screens & modals (navigated to)
│ ├── BuildQuote/
│ ├── TokenSelection/
│ ├── Settings/
│ │ └── RegionSelector/ # ← moved from Views/Settings/
│ └── Modals/
│ ├── PaymentSelectionModal/
│ ├── SettingsModal/
│ └── UnsupportedTokenModal/
└── components/ # Pure reusable components only
├── PaymentMethodPill/
├── QuickAmounts/
├── TokenListItem/
└── ...
```
This follows the same pattern already established by `Aggregator/Views/`
and `Deposit/Views/`.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Refs: #25615 (the PR that introduced `RegionSelector` usage in Ramp,
which highlighted the cross-team ownership issue)
## **Manual testing steps**
```gherkin
Feature: Ramp folder reorganization
Scenario: User navigates through token selection flow
Given the app is running on the BuildQuote screen (post-merge of #25615)
When user taps back to go to token selection
Then the token list should load and display correctly
And user can search for tokens
And tapping an unsupported token's info icon shows the modal
Scenario: User selects payment method
Given user is on the BuildQuote screen with an amount entered
When user taps the payment method pill
Then the payment selection modal should open
And payment methods should display correctly
And tapping "change provider" should slide to provider selection
And selecting a provider should return to payment methods
Scenario: User opens build quote settings
Given user is on the BuildQuote screen
When user taps the settings gear icon
Then the settings modal should open with order history option
And contact support option should be visible if provider has support URL
Scenario: User changes region in settings
Given user navigates to Settings > Region
When user opens the region selector
Then countries should load and display with flags
And user can search for countries
And tapping USA should show states view
And selecting California should save and navigate back
And the back button in states view should return to countries
Scenario: Cold start verification
Given the app is freshly started
When user navigates through the complete Buy flow
Then no blank screens or navigation crashes occur
And all screens render correctly
```
**Video recording is attached showing all scenarios working correctly.**
## **Screenshots/Recordings**
### **Before**
N/A - Internal refactor only, no UI changes
### **After**
Video recording demonstrating all manual testing scenarios:
https://github.com/user-attachments/assets/b73ae1f3-252f-4210-875e-1a222297574f
## **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]
> **Low Risk**
> Mostly folder/import re-wiring plus snapshot updates; main risk is a
broken import/navigation route if the moved `RegionSelector` path is
incorrect.
>
> **Overview**
> Moves the `RegionSelector` screen import used by main navigation from
`Views/Settings` into the Ramp-owned
`UI/Ramp/Views/Settings/RegionSelector` location.
>
> Updates Ramp Aggregator/Deposit Jest snapshots to match the new UI
rendering for icon buttons (notably smaller icon sizes and reduced
`borderRadius`).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5af35f1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Amitabh Aggarwal <aggarwal.amitabh@gmail.com>1 parent 40a2820 commit 3633f95
File tree
40 files changed
+78
-80
lines changed- app/components
- UI/Ramp
- Views
- BuildQuote
- __snapshots__
- Modals
- PaymentSelectionModal
- __snapshots__
- SettingsModal
- __snapshots__
- UnsupportedTokenModal
- __snapshots__
- Settings/RegionSelector
- __snapshots__
- TokenSelection
- __snapshots__
- hooks
40 files changed
+78
-80
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| 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 | | - | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
0 commit comments