11import React , { useEffect } from 'react' ;
2- import { MigrationState } from '../../../../api/migration-tool/migrator/migration-state.data' ;
2+ import {
3+ MigrationState ,
4+ MIGRATION_KEY ,
5+ } from '../../../../api/migration-tool/migrator/migration-state.data' ;
36import { Carousel } from '../carousel/carousel.component' ;
47import { Slide1 } from '../carousel/slides/Slide1.component' ;
58import { Slide2 } from '../carousel/slides/Slide2.component' ;
69import { Slide3 } from '../carousel/slides/Slide3.component' ;
710import { AlmostThere } from '../almost-there/almost-there.component' ;
811import { AllDone } from '../all-done/all-done.component' ;
912import { NoWallet } from '../no-wallet/no-wallet.component' ;
10- import { useColorModeValue , Flex } from '@chakra-ui/react' ;
13+ import { useColorModeValue , Flex , Link } from '@chakra-ui/react' ;
1114import { useFeatureFlagsContext } from '../../../../features/feature-flags/provider' ;
1215import { Events } from '../../../../features/analytics/events' ;
1316import { useCaptureEvent } from '../../../../features/analytics/hooks' ;
1417import { AnalyticsConsentModal } from '../../../../features/analytics/ui/AnalyticsConsentModal' ;
1518import { useAnalyticsContext } from '../../../../features/analytics/provider' ;
19+ import { storage } from 'webextension-polyfill' ;
1620
1721export const MigrationView = ( {
1822 migrationState,
@@ -42,36 +46,44 @@ export const MigrationView = ({
4246 const dismissibleSeconds =
4347 featureFlags ?. [ 'is-migration-active' ] ?. dismissInterval ;
4448
49+ const hasShowIssuesButton =
50+ featureFlags ?. [ 'show-having-issues-button' ] || false ;
51+
52+ const handleHavingIssuesClick = ( ) => {
53+ storage . local . set ( {
54+ [ MIGRATION_KEY ] : MigrationState . None ,
55+ } ) ;
56+ captureEvent ( Events . NamiMigrationHavingIssuesClick ) ;
57+ } ;
58+
4559 if ( ! hasWallet ) {
4660 captureEvent ( Events . MigrationViewNoWalletViewed ) ;
4761 return (
48- < > < Flex
49- h = "100%"
50- backgroundColor = { panelBg }
51- >
52- < Flex
53- pt = "40px"
54- pb = "30px"
55- px = "40px"
56- borderTopRadius = '20px'
57- backgroundColor = { bgColor }
58- mt = '17px'
59- flexDirection = 'column'
60- h = 'calc(100% - 17px)'
61- w = "100%"
62- >
63- < NoWallet
64- isLaceInstalled = { isLaceInstalled }
65- onAction = { onNoWalletActionClick }
66- isDismissable = { isDismissable }
67- dismissibleSeconds = { dismissibleSeconds }
68- />
62+ < >
63+ < Flex h = "100%" backgroundColor = { panelBg } >
64+ < Flex
65+ pt = "40px"
66+ pb = "30px"
67+ px = "40px"
68+ borderTopRadius = "20px"
69+ backgroundColor = { bgColor }
70+ mt = "17px"
71+ flexDirection = "column"
72+ h = "calc(100% - 17px)"
73+ w = "100%"
74+ >
75+ < NoWallet
76+ isLaceInstalled = { isLaceInstalled }
77+ onAction = { onNoWalletActionClick }
78+ isDismissable = { isDismissable }
79+ dismissibleSeconds = { dismissibleSeconds }
80+ />
81+ </ Flex >
6982 </ Flex >
70- </ Flex >
71- < AnalyticsConsentModal
72- askForConsent = { analytics . consent === undefined }
73- setConsent = { setAnalyticsConsent }
74- />
83+ < AnalyticsConsentModal
84+ askForConsent = { analytics . consent === undefined }
85+ setConsent = { setAnalyticsConsent }
86+ />
7587 </ >
7688 ) ;
7789 }
@@ -81,19 +93,16 @@ export const MigrationView = ({
8193 case MigrationState . None :
8294 captureEvent ( Events . MigrationNoStartedViewed ) ;
8395 return (
84- < Flex
85- h = "100%"
86- backgroundColor = { panelBg }
87- >
96+ < Flex h = "100%" backgroundColor = { panelBg } >
8897 < Flex
8998 flexDirection = { 'column' }
9099 pt = "40px"
91100 pb = "30px"
92101 px = "0px"
93- borderTopRadius = ' 20px'
102+ borderTopRadius = " 20px"
94103 backgroundColor = { bgColor }
95- mt = ' 17px'
96- h = ' calc(100% - 17px)'
104+ mt = " 17px"
105+ h = " calc(100% - 17px)"
97106 w = "100%"
98107 >
99108 < Carousel onSlideSwitched = { onSlideSwitched } >
@@ -124,19 +133,16 @@ export const MigrationView = ({
124133 if ( ! isLaceInstalled ) {
125134 onWaitingForLaceScreenViewed ?. ( ) ;
126135 return (
127- < Flex
128- h = "100%"
129- backgroundColor = { panelBg }
130- >
136+ < Flex h = "100%" backgroundColor = { panelBg } >
131137 < Flex
132138 pt = "40px"
133139 pb = "30px"
134140 px = "40px"
135- borderTopRadius = ' 20px'
141+ borderTopRadius = " 20px"
136142 backgroundColor = { bgColor }
137- mt = ' 17px'
138- flexDirection = ' column'
139- h = ' calc(100% - 17px)'
143+ mt = " 17px"
144+ flexDirection = " column"
145+ h = " calc(100% - 17px)"
140146 w = "100%"
141147 >
142148 < AlmostThere
@@ -151,19 +157,16 @@ export const MigrationView = ({
151157 } else {
152158 onOpenLaceScreenViewed ?. ( ) ;
153159 return (
154- < Flex
155- h = "100%"
156- backgroundColor = { panelBg }
157- >
160+ < Flex h = "100%" backgroundColor = { panelBg } >
158161 < Flex
159162 pt = "40px"
160163 pb = "30px"
161164 px = "40px"
162- borderTopRadius = ' 20px'
165+ borderTopRadius = " 20px"
163166 backgroundColor = { bgColor }
164- mt = ' 17px'
165- flexDirection = ' column'
166- h = ' calc(100% - 17px)'
167+ mt = " 17px"
168+ flexDirection = " column"
169+ h = " calc(100% - 17px)"
167170 w = "100%"
168171 >
169172 < AlmostThere
@@ -180,19 +183,16 @@ export const MigrationView = ({
180183 case MigrationState . Completed :
181184 onAllDoneScreenViewed ?. ( ) ;
182185 return (
183- < Flex
184- h = "100%"
185- backgroundColor = { panelBg }
186- >
186+ < Flex h = "100%" backgroundColor = { panelBg } >
187187 < Flex
188188 pt = "40px"
189189 pb = "30px"
190190 px = "40px"
191- borderTopRadius = ' 20px'
191+ borderTopRadius = " 20px"
192192 backgroundColor = { bgColor }
193- mt = ' 17px'
194- flexDirection = ' column'
195- h = ' calc(100% - 17px)'
193+ mt = " 17px"
194+ flexDirection = " column"
195+ h = " calc(100% - 17px)"
196196 w = "100%"
197197 >
198198 < AllDone
@@ -201,6 +201,15 @@ export const MigrationView = ({
201201 isLaceInstalled ? onOpenLaceClicked : onDownloadLaceClicked
202202 }
203203 />
204+ { hasShowIssuesButton && (
205+ < Link
206+ textAlign = "center"
207+ marginTop = { 4 }
208+ onClick = { handleHavingIssuesClick }
209+ >
210+ Having issues? Click here to continue using Nami
211+ </ Link >
212+ ) }
204213 </ Flex >
205214 </ Flex >
206215 ) ;
0 commit comments