Skip to content

Commit 2018c48

Browse files
committed
Show Nym mixnet warning in stake/unstake/claim scenes
1 parent 833d8fe commit 2018c48

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased (develop)
44

5+
- added: Nym mixnet warning in Stake, Unstake, and Claim Rewards scenes
6+
57
## 4.48.0 (staging)
68

79
- added: (iOS) Disable Liquid Glass UI for iOS 26 compatibility

src/components/scenes/Staking/StakeModifyScene.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { div, eq, gt, toFixed } from 'biggystring'
2+
import { asMaybe } from 'cleaners'
23
import {
34
DustSpendError,
45
type EdgeCurrencyWallet,
@@ -12,6 +13,7 @@ import { sprintf } from 'sprintf-js'
1213
import { updateStakingPosition } from '../../../actions/scene/StakingActions'
1314
import { useAsyncEffect } from '../../../hooks/useAsyncEffect'
1415
import { useDisplayDenom } from '../../../hooks/useDisplayDenom'
16+
import { useWatch } from '../../../hooks/useWatch'
1517
import { lstrings } from '../../../locales/strings'
1618
import {
1719
type ChangeQuote,
@@ -35,8 +37,10 @@ import {
3537
getPositionAllocations
3638
} from '../../../util/stakeUtils'
3739
import { zeroString } from '../../../util/utils'
40+
import { AlertCardUi4 } from '../../cards/AlertCard'
3841
import { EdgeCard } from '../../cards/EdgeCard'
3942
import { WarningCard } from '../../cards/WarningCard'
43+
import { EdgeAnim } from '../../common/EdgeAnim'
4044
import { SceneWrapper } from '../../common/SceneWrapper'
4145
import { withWallet } from '../../hoc/withWallet'
4246
import { SceneContainer } from '../../layout/SceneContainer'
@@ -52,6 +56,7 @@ import { Airship, showError } from '../../services/AirshipInstance'
5256
import { cacheStyles, type Theme, useTheme } from '../../services/ThemeContext'
5357
import { Alert } from '../../themed/Alert'
5458
import { EdgeText } from '../../themed/EdgeText'
59+
import { asPrivateNetworkingSetting } from '../../themed/MaybePrivateNetworkingSetting'
5560
import { SafeSlider } from '../../themed/SafeSlider'
5661
import { CryptoFiatAmountTile } from '../../tiles/CryptoFiatAmountTile'
5762
import { EditableAmountTile } from '../../tiles/EditableAmountTile'
@@ -94,6 +99,10 @@ const StakeModifySceneComponent: React.FC<Props> = props => {
9499
const guiExchangeRates = useSelector(state => state.exchangeRates)
95100
const nativeAssetDenomination = useDisplayDenom(wallet.currencyConfig, null)
96101

102+
const userSettings = useWatch(wallet.currencyConfig, 'userSettings')
103+
const isNymActive =
104+
asMaybe(asPrivateNetworkingSetting)(userSettings)?.networkPrivacy === 'nym'
105+
97106
// ChangeQuote that gets rendered in the rows
98107
const [changeQuote, setChangeQuote] = React.useState<ChangeQuote | null>(null)
99108
const changeQuoteAllocations =
@@ -627,7 +636,7 @@ const StakeModifySceneComponent: React.FC<Props> = props => {
627636
return warningMessage == null ? null : (
628637
<Alert
629638
key="warning"
630-
marginRem={[0, 1, 1, 1]}
639+
marginRem={[0, 1, 0, 1]}
631640
title={lstrings.wc_smartcontract_warning_title}
632641
message={warningMessage}
633642
numberOfLines={0}
@@ -636,6 +645,24 @@ const StakeModifySceneComponent: React.FC<Props> = props => {
636645
)
637646
}
638647

648+
const renderNymWarning = (): React.ReactElement | null => {
649+
if (!isNymActive) return null
650+
651+
return (
652+
<EdgeAnim
653+
enter={{ type: 'fadeInUp', distance: 60 }}
654+
exit={{ type: 'fadeOutDown' }}
655+
>
656+
<AlertCardUi4
657+
type="warning"
658+
title={lstrings.settings_nym_mixnet_warning_title}
659+
body={lstrings.settings_nym_mixnet_warning_body}
660+
marginRem={[0, 0.5, 0, 0.5]}
661+
/>
662+
</EdgeAnim>
663+
)
664+
}
665+
639666
const renderChangeQuoteAmountTiles = (
640667
modification: ChangeQuoteRequest['action']
641668
): React.ReactElement => {
@@ -741,6 +768,7 @@ const StakeModifySceneComponent: React.FC<Props> = props => {
741768
<SceneContainer headerTitle={title} headerTitleChildren={icon}>
742769
{renderChangeQuoteAmountTiles(modification)}
743770
{renderWarning()}
771+
{renderNymWarning()}
744772
<View style={styles.footer}>
745773
<SafeSlider
746774
onSlidingComplete={handleSlideComplete}
@@ -775,6 +803,7 @@ const getStyles = cacheStyles((theme: Theme) => ({
775803
marginTop: theme.rem(0.5)
776804
},
777805
footer: {
806+
marginTop: theme.rem(1),
778807
marginBottom: theme.rem(2)
779808
}
780809
}))

0 commit comments

Comments
 (0)