Skip to content

Commit 8baa3a3

Browse files
committed
Merge branch 'mmpay_recipient_update' of https://github.com/MetaMask/metamask-mobile into mmpay_recipient_update
2 parents aa1bc2e + 8d1a4da commit 8baa3a3

36 files changed

Lines changed: 1921 additions & 381 deletions

app/components/Nav/Main/MainNavigator.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ import {
123123
TopTradersView,
124124
TraderProfileView,
125125
TraderPositionView,
126+
NotificationPreferencesView,
126127
} from '../../Views/SocialLeaderboard';
127128
import { selectSocialLeaderboardEnabled } from '../../../selectors/featureFlagController/socialLeaderboard';
128129
import PerpsPositionTransactionView from '../../UI/Perps/Views/PerpsTransactionsView/PerpsPositionTransactionView';
@@ -1309,6 +1310,13 @@ const MainNavigator = () => {
13091310
options={{ headerShown: false, ...slideFromRightAnimation }}
13101311
/>
13111312
)}
1313+
{isSocialLeaderboardEnabled && (
1314+
<Stack.Screen
1315+
name={Routes.SOCIAL_LEADERBOARD.NOTIFICATION_PREFERENCES}
1316+
component={NotificationPreferencesView}
1317+
options={{ headerShown: false, ...slideFromRightAnimation }}
1318+
/>
1319+
)}
13121320
<>
13131321
<Stack.Screen
13141322
name={Routes.EXPLORE_SEARCH}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ import {
4444
TextColor,
4545
TextVariant,
4646
} from '@metamask/design-system-react-native';
47+
import { useTheme, LIGHT_MODE_SUCCESS_GREEN } from '../../../../util/theme';
48+
import { AppThemeKey } from '../../../../util/theme/models';
4749
import { MetaMetricsEvents } from '../../../../core/Analytics';
4850
import { useAnalytics } from '../../../hooks/useAnalytics/useAnalytics';
4951
import { selectTokenOverviewChartType } from '../../../../reducers/user/selectors';
@@ -285,6 +287,8 @@ const PriceAdvanced = ({
285287
: dateLabel;
286288

287289
const { styles, theme } = useStyles(styleSheet);
290+
const { themeAppearance } = useTheme();
291+
const isLightMode = themeAppearance === AppThemeKey.light;
288292

289293
const shouldFallbackToLegacy =
290294
!chartLoading &&
@@ -357,6 +361,11 @@ const PriceAdvanced = ({
357361
? TextColor.ErrorDefault
358362
: TextColor.TextAlternative
359363
}
364+
style={
365+
isLightMode && displayDiff > 0
366+
? { color: LIGHT_MODE_SUCCESS_GREEN }
367+
: undefined
368+
}
360369
allowFontScaling={false}
361370
>
362371
{displayDiff > 0 ? '+' : ''}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {
1717
TextColor,
1818
TextVariant,
1919
} from '@metamask/design-system-react-native';
20+
import { useTheme, LIGHT_MODE_SUCCESS_GREEN } from '../../../../util/theme';
21+
import { AppThemeKey } from '../../../../util/theme/models';
2022

2123
import PriceChart from '../PriceChart/PriceChart';
2224
import { distributeDataPoints } from '../PriceChart/utils';
@@ -93,6 +95,8 @@ const PriceLegacy = ({
9395
const diffSign = displayDiff > 0 ? '+' : displayDiff < 0 ? '-' : '';
9496

9597
const { styles, theme } = useStyles(styleSheet);
98+
const { themeAppearance } = useTheme();
99+
const isLightMode = themeAppearance === AppThemeKey.light;
96100

97101
return (
98102
<>
@@ -145,6 +149,11 @@ const PriceLegacy = ({
145149
? TextColor.ErrorDefault
146150
: TextColor.TextAlternative
147151
}
152+
style={
153+
isLightMode && displayDiff > 0
154+
? { color: LIGHT_MODE_SUCCESS_GREEN }
155+
: undefined
156+
}
148157
allowFontScaling={false}
149158
>
150159
{diffSign}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { AreaChart } from 'react-native-svg-charts';
1212

1313
import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
1414
import { useStyles } from '../../../../component-library/hooks';
15+
import { useTheme, LIGHT_MODE_SUCCESS_GREEN } from '../../../../util/theme';
16+
import { AppThemeKey } from '../../../../util/theme/models';
1517
import { MetaMetricsEvents } from '../../../../core/Analytics';
1618
import { useAnalytics } from '../../../hooks/useAnalytics/useAnalytics';
1719
import {
@@ -63,14 +65,16 @@ const PriceChart = ({
6365
/** Laid-out width of the chart row — used for touch mapping and skeleton (not screen width). */
6466
const [chartRowWidth, setChartRowWidth] = useState(0);
6567
const { styles, theme } = useStyles(styleSheet, { chartHeight });
68+
const { themeAppearance } = useTheme();
69+
const chartColor =
70+
themeAppearance === AppThemeKey.light
71+
? LIGHT_MODE_SUCCESS_GREEN
72+
: theme.colors.success.default;
6673

6774
useEffect(() => {
6875
setPositionX(-1);
6976
}, [prices]);
7077

71-
/** Align with AdvancedChart / TradingView line: success up, error down (not legacy primary blue). */
72-
const chartColor = theme.colors.success.default;
73-
7478
const apx = (size = 0) => {
7579
const width = Dimensions.get('window').width;
7680
return (width / 750) * size;

app/components/UI/Charts/AdvancedChart/AdvancedChartTemplate.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { Theme } from '../../../../util/theme/models';
1+
import { AppThemeKey, type Theme } from '../../../../util/theme/models';
2+
import { LIGHT_MODE_SUCCESS_GREEN } from '../../../../util/theme';
23
import {
34
type LineChromeOptions,
45
resolveLineChromeOptions,
@@ -43,6 +44,11 @@ const CHARTING_LIBRARY_ORIGIN = (() => {
4344
const stripHexAlpha = (hex: string): string =>
4445
hex.length === 9 && hex.startsWith('#') ? hex.slice(0, 7) : hex;
4546

47+
const getChartSuccessColor = (theme: Theme): string =>
48+
theme.themeAppearance === AppThemeKey.light
49+
? LIGHT_MODE_SUCCESS_GREEN
50+
: theme.colors.success.default;
51+
4652
interface ChartFeatures {
4753
enableDrawingTools?: boolean;
4854
disabledFeatures?: string[];
@@ -62,7 +68,7 @@ window.CONFIG = {
6268
backgroundColor: '${theme.colors.background.default}',
6369
borderColor: '${stripHexAlpha(theme.colors.border.muted)}',
6470
textColor: '${stripHexAlpha(theme.colors.text.muted)}',
65-
successColor: '${theme.colors.success.default}',
71+
successColor: '${getChartSuccessColor(theme)}',
6672
errorColor: '${theme.colors.error.default}',
6773
primaryColor: '${theme.colors.primary.default}'
6874
},
@@ -206,7 +212,7 @@ export const createAdvancedChartTemplate = (
206212
*/
207213
#last-close-price-label {
208214
z-index: 50;
209-
background: ${stripHexAlpha(theme.colors.success.default)};
215+
background: ${stripHexAlpha(getChartSuccessColor(theme))};
210216
color: ${stripHexAlpha(theme.colors.success.inverse)};
211217
}
212218
/*
@@ -218,8 +224,8 @@ export const createAdvancedChartTemplate = (
218224
#custom-series-last-value-label {
219225
z-index: 55;
220226
background: transparent;
221-
border: 1px solid ${stripHexAlpha(theme.colors.success.default)};
222-
color: ${stripHexAlpha(theme.colors.success.default)};
227+
border: 1px solid ${stripHexAlpha(getChartSuccessColor(theme))};
228+
color: ${stripHexAlpha(getChartSuccessColor(theme))};
223229
}
224230
/*
225231
* Crosshair price pill draws above last-close when both share the same Y so text stays readable.

0 commit comments

Comments
 (0)