11import { div , eq , gt , toFixed } from 'biggystring'
2+ import { asMaybe } from 'cleaners'
23import {
34 DustSpendError ,
45 type EdgeCurrencyWallet ,
@@ -12,6 +13,7 @@ import { sprintf } from 'sprintf-js'
1213import { updateStakingPosition } from '../../../actions/scene/StakingActions'
1314import { useAsyncEffect } from '../../../hooks/useAsyncEffect'
1415import { useDisplayDenom } from '../../../hooks/useDisplayDenom'
16+ import { useWatch } from '../../../hooks/useWatch'
1517import { lstrings } from '../../../locales/strings'
1618import {
1719 type ChangeQuote ,
@@ -35,8 +37,10 @@ import {
3537 getPositionAllocations
3638} from '../../../util/stakeUtils'
3739import { zeroString } from '../../../util/utils'
40+ import { AlertCardUi4 } from '../../cards/AlertCard'
3841import { EdgeCard } from '../../cards/EdgeCard'
3942import { WarningCard } from '../../cards/WarningCard'
43+ import { EdgeAnim } from '../../common/EdgeAnim'
4044import { SceneWrapper } from '../../common/SceneWrapper'
4145import { withWallet } from '../../hoc/withWallet'
4246import { SceneContainer } from '../../layout/SceneContainer'
@@ -52,6 +56,7 @@ import { Airship, showError } from '../../services/AirshipInstance'
5256import { cacheStyles , type Theme , useTheme } from '../../services/ThemeContext'
5357import { Alert } from '../../themed/Alert'
5458import { EdgeText } from '../../themed/EdgeText'
59+ import { asPrivateNetworkingSetting } from '../../themed/MaybePrivateNetworkingSetting'
5560import { SafeSlider } from '../../themed/SafeSlider'
5661import { CryptoFiatAmountTile } from '../../tiles/CryptoFiatAmountTile'
5762import { 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