Skip to content

Commit 41d7707

Browse files
authored
Merge branch 'main' into jc/WAPI-1348
2 parents 8b86d4a + 2577e38 commit 41d7707

108 files changed

Lines changed: 1675 additions & 762 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/components/UI/AssetOverview/ChartNavigationButton/ChartNavigationButton.styles.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@ const styleSheet = (params: {
1212
vars: { selected },
1313
} = params;
1414
const { colors } = theme;
15+
const finalBackgroundColor = selected
16+
? colors.background.muted
17+
: 'transparent';
18+
/** Matches {@link TimeRangeSelector} segment Pressables: `py-1`, `px-4`, `rounded-lg`, `flex-1`, `bg-muted` when selected. */
1519
return StyleSheet.create({
1620
button: {
17-
backgroundColor: selected
18-
? colors.background.pressed
19-
: colors.background.default,
20-
borderRadius: 40,
21-
paddingVertical: 2,
22-
paddingHorizontal: 8,
23-
// compensates for letter spacing
24-
paddingLeft: 10,
21+
flex: 1,
22+
minWidth: 0,
2523
alignItems: 'center',
2624
justifyContent: 'center',
25+
backgroundColor: finalBackgroundColor,
26+
borderRadius: 8,
27+
paddingVertical: 4,
28+
paddingHorizontal: 16,
2729
},
2830
label: {
29-
letterSpacing: 3,
3031
textAlign: 'center',
3132
} as TextStyle,
3233
});

app/components/UI/AssetOverview/Price/Price.advanced.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ const PriceAdvanced = ({
370370
) : null}
371371
</Text>
372372
</View>
373-
<Box twClassName="mt-3">
373+
<Box twClassName="mt-3 w-full overflow-hidden">
374374
{crosshairData && chartType === ChartType.Candles && (
375375
<OHLCVBar data={crosshairData} currency={currentCurrency} />
376376
)}

app/components/UI/AssetOverview/Price/Price.legacy.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const PriceLegacy = ({
173173
)}
174174
</Text>
175175
</View>
176-
<Box twClassName={'mt-3'}>
176+
<Box twClassName="mt-3 w-full overflow-hidden">
177177
<PriceChart
178178
prices={distributedPriceData}
179179
priceDiff={priceDiff}
@@ -182,17 +182,21 @@ const PriceLegacy = ({
182182
/>
183183
</Box>
184184
{chartNavigationButtons.length > 0 && onTimePeriodChange && (
185-
<View style={styles.chartNavigationWrapper}>
186-
{chartNavigationButtons.map((label) => (
187-
<ChartNavigationButton
188-
key={label}
189-
label={strings(
190-
`asset_overview.chart_time_period_navigation.${label}`,
191-
)}
192-
onPress={() => onTimePeriodChange(label)}
193-
selected={timePeriod === label}
194-
/>
195-
))}
185+
<View style={styles.timeRangeContainer}>
186+
<Box twClassName="w-full px-4">
187+
<View style={styles.chartNavigationWrapper}>
188+
{chartNavigationButtons.map((label) => (
189+
<ChartNavigationButton
190+
key={label}
191+
label={strings(
192+
`asset_overview.chart_time_period_navigation.${label}`,
193+
)}
194+
onPress={() => onTimePeriodChange(label)}
195+
selected={timePeriod === label}
196+
/>
197+
))}
198+
</View>
199+
</Box>
196200
</View>
197201
)}
198202
</>

app/components/UI/AssetOverview/Price/Price.styles.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { Theme } from '@metamask/design-tokens';
22
import { StyleSheet, ViewStyle } from 'react-native';
3+
import { TOKEN_OVERVIEW_TIME_RANGE_ROW_HEIGHT } from './tokenOverviewChart.constants';
34

4-
const styleSheet = (params: { theme: Theme }) => {
5-
const { theme } = params;
6-
return StyleSheet.create({
5+
const styleSheet = (_params: { theme: Theme }) =>
6+
StyleSheet.create({
77
wrapper: {
88
width: '100%',
99
paddingHorizontal: 16,
@@ -49,15 +49,19 @@ const styleSheet = (params: { theme: Theme }) => {
4949
alignItems: 'center',
5050
zIndex: 2,
5151
} as ViewStyle,
52+
/**
53+
* Segment row for legacy chart periods; matches {@link TimeRangeSelector} segment padding (`py-1` / `px-4`).
54+
* Vertical spacing chart→selector and selector→actions comes from the parent `timeRangeContainer`
55+
* (same as `Price.advanced`).
56+
*/
5257
chartNavigationWrapper: {
5358
display: 'flex',
5459
flexDirection: 'row',
55-
justifyContent: 'space-around',
56-
paddingHorizontal: 10,
57-
paddingTop: 20,
58-
marginBottom: 16,
60+
alignItems: 'center',
61+
width: '100%',
62+
borderRadius: 8,
63+
minHeight: TOKEN_OVERVIEW_TIME_RANGE_ROW_HEIGHT,
5964
} as ViewStyle,
6065
});
61-
};
6266

6367
export default styleSheet;

app/components/UI/AssetOverview/Price/tokenOverviewChart.constants.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ export const TOKEN_OVERVIEW_CHART_HEIGHT =
99

1010
/** Minimum distributed price points to draw the legacy line chart (matches advanced fallback). */
1111
export const CHART_DATA_THRESHOLD = 5;
12+
13+
/**
14+
* Min height for the token overview time-range row (advanced selector + legacy period nav).
15+
* Matches TimeRangeSelector skeleton height so swapping loading/loaded does not shift content
16+
* below (e.g. Receive/More).
17+
*/
18+
export const TOKEN_OVERVIEW_TIME_RANGE_ROW_HEIGHT = 34;

app/components/UI/AssetOverview/PriceChart/PriceChart.styles.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,23 @@ const styleSheet = (params: {
2020
alignSelf: 'stretch',
2121
overflow: 'visible',
2222
},
23+
/** Touch + overlay host; `AreaChart` stays full-size while overlays are absolutely positioned. */
24+
chartAreaWrapper: {
25+
flex: 1,
26+
position: 'relative',
27+
},
2328
chartArea: {
2429
flex: 1,
2530
},
31+
/** Same pattern as AdvancedChart: overlay does not participate in flex layout with AreaChart. */
32+
loadingOverlayContainer: {
33+
...StyleSheet.absoluteFillObject,
34+
justifyContent: 'center',
35+
alignItems: 'center',
36+
},
37+
noDataOverlayContainer: {
38+
...StyleSheet.absoluteFillObject,
39+
},
2640
chartLoading: {
2741
width: '100%',
2842
alignSelf: 'stretch',

app/components/UI/AssetOverview/PriceChart/PriceChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ const PriceChart = ({
363363
}}
364364
>
365365
<View
366-
style={styles.chartArea}
366+
style={styles.chartAreaWrapper}
367367
testID={chartHasData ? 'price-chart-area' : undefined}
368368
{...panResponder.current.panHandlers}
369369
>
@@ -386,12 +386,12 @@ const PriceChart = ({
386386
{chartHasData && !isLoading ? <EndDot /> : null}
387387
</AreaChart>
388388
{isLoading && (
389-
<View>
389+
<View style={styles.loadingOverlayContainer}>
390390
<LoadingOverlay />
391391
</View>
392392
)}
393393
{!isLoading && !chartHasData && (
394-
<View>
394+
<View style={styles.noDataOverlayContainer} pointerEvents="box-none">
395395
<NoDataOverlay
396396
chartHeight={chartHeight}
397397
chartPlaceholderFill={theme.colors.border.muted}

0 commit comments

Comments
 (0)