@@ -2,7 +2,6 @@ import React, { useEffect, useReducer, useRef, useState } from 'react'
2
2
import './style/remix-app.css'
3
3
import { RemixUIMainPanel } from '@remix-ui/panel'
4
4
import MatomoDialog from './components/modals/matomo'
5
- import EnterDialog from './components/modals/enter'
6
5
import ManagePreferencesDialog from './components/modals/managePreferences'
7
6
import OriginWarning from './components/modals/origin-warning'
8
7
import DragBar from './components/dragbar/dragbar'
@@ -11,7 +10,6 @@ import AppDialogs from './components/modals/dialogs'
11
10
import DialogViewPlugin from './components/modals/dialogViewPlugin'
12
11
import { appProviderContextType , onLineContext , platformContext } from './context/context'
13
12
import { IntlProvider } from 'react-intl'
14
- import { UsageTypes } from './types'
15
13
import { appReducer } from './reducer/app'
16
14
import { appInitialState } from './state/app'
17
15
import isElectron from 'is-electron'
@@ -29,7 +27,6 @@ interface IRemixAppUi {
29
27
}
30
28
const RemixApp = ( props : IRemixAppUi ) => {
31
29
const [ appReady , setAppReady ] = useState < boolean > ( false )
32
- const [ showEnterDialog , setShowEnterDialog ] = useState < boolean > ( false )
33
30
const [ showManagePreferencesDialog , setShowManagePreferencesDialog ] = useState < boolean > ( false )
34
31
const [ hideSidePanel , setHideSidePanel ] = useState < boolean > ( false )
35
32
const [ hidePinnedPanel , setHidePinnedPanel ] = useState < boolean > ( true )
@@ -47,8 +44,6 @@ const RemixApp = (props: IRemixAppUi) => {
47
44
const sidePanelRef = useRef ( null )
48
45
const pinnedPanelRef = useRef ( null )
49
46
50
- //console.log('RemixApp props', props)
51
-
52
47
const [ appState , appStateDispatch ] = useReducer ( appReducer , {
53
48
...appInitialState ,
54
49
showPopupPanel : ! window . localStorage . getItem ( 'did_show_popup_panel' ) && ! isElectron ( ) ,
@@ -70,48 +65,6 @@ const RemixApp = (props: IRemixAppUi) => {
70
65
if ( props . app ) {
71
66
activateApp ( )
72
67
}
73
- let hadUsageTypeAsked = localStorage . getItem ( 'hadUsageTypeAsked' )
74
-
75
- if ( props . app . showMatomo ) {
76
- // if matomo dialog is displayed, it will take care of calling "setShowEnterDialog",
77
- // if the user approves matomo tracking.
78
- // so "showEnterDialog" stays false
79
- } else {
80
- // if matomo dialog isn't displayed, we show the "enter dialog" only if:
81
- // - it wasn't already set
82
- // - (and) if user has given consent
83
- if ( ! hadUsageTypeAsked && props . app . matomoCurrentSetting ) {
84
- setShowEnterDialog ( true )
85
- }
86
- }
87
- if ( hadUsageTypeAsked ) {
88
- // rewriting the data in user's local storage for consistency
89
- switch ( hadUsageTypeAsked ) {
90
- case '1' : {
91
- hadUsageTypeAsked = 'beginner'
92
- break
93
- }
94
- case '2' : {
95
- hadUsageTypeAsked = 'prototyper'
96
- break
97
- }
98
- case '3' : {
99
- hadUsageTypeAsked = 'advanced'
100
- break
101
- }
102
- case '4' : {
103
- hadUsageTypeAsked = 'production'
104
- break
105
- }
106
- default : {
107
- // choosing beginner as default
108
- hadUsageTypeAsked = 'beginner'
109
- break
110
- }
111
- }
112
- localStorage . setItem ( 'hadUsageTypeAsked' , hadUsageTypeAsked )
113
- _paq . push ( [ 'trackEvent' , 'userEntry' , 'usageType' , hadUsageTypeAsked ] )
114
- }
115
68
} , [ ] )
116
69
117
70
useEffect ( ( ) => {
@@ -202,52 +155,15 @@ const RemixApp = (props: IRemixAppUi) => {
202
155
appStateDispatch : appStateDispatch
203
156
}
204
157
205
- const handleUserChosenType = async ( type ) => {
206
- setShowEnterDialog ( false )
207
- localStorage . setItem ( 'hadUsageTypeAsked' , type )
208
- // Use the type to setup the UI accordingly
209
- switch ( type ) {
210
- case UsageTypes . Beginner : {
211
- await props . app . appManager . call ( 'manager' , 'activatePlugin' , 'LearnEth' )
212
- await props . app . appManager . call ( 'walkthrough' , 'start' )
213
- // const wName = 'Playground'
214
- // const workspaces = await props.app.appManager.call('filePanel', 'getWorkspaces')
215
- // if (!workspaces.find((workspace) => workspace.name === wName)) {
216
- // await props.app.appManager.call('filePanel', 'createWorkspace', wName, 'playground')
217
- // }
218
- // await props.app.appManager.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false })
219
- break
220
- }
221
- case UsageTypes . Advance : {
222
- // Here activate necessary plugins, walkthrough. Filter hometab features slides and plugins.
223
- break
224
- }
225
- case UsageTypes . Prototyper : {
226
- // Here activate necessary plugins, walkthrough. Filter hometab features slides and plugins.
227
- break
228
- }
229
- case UsageTypes . Production : {
230
- // Here activate necessary plugins, walkthrough. Filter hometab features slides and plugins.
231
- break
232
- }
233
- default : throw new Error ( )
234
- }
235
- // enterDialog tracks first time users
236
- // userEntry tracks both first time and returning users
237
- _paq . push ( [ 'trackEvent' , 'enterDialog' , 'usageType' , type ] )
238
- _paq . push ( [ 'trackEvent' , 'userEntry' , 'usageType' , type ] )
239
- }
240
-
241
158
return (
242
159
//@ts -ignore
243
160
< IntlProvider locale = { locale . code } messages = { locale . messages } >
244
161
< platformContext . Provider value = { props . app . platform } >
245
162
< onLineContext . Provider value = { online } >
246
163
< AppProvider value = { value } >
247
164
< OriginWarning > </ OriginWarning >
248
- < MatomoDialog hide = { ! appReady } acceptAllFn = { ( ) => setShowEnterDialog ( true ) } managePreferencesFn = { ( ) => setShowManagePreferencesDialog ( true ) } > </ MatomoDialog >
249
- { showEnterDialog && < EnterDialog handleUserChoice = { ( type ) => handleUserChosenType ( type ) } > </ EnterDialog > }
250
- { showManagePreferencesDialog && < ManagePreferencesDialog savePreferencesFn = { ( ) => setShowEnterDialog ( true ) } > </ ManagePreferencesDialog > }
165
+ < MatomoDialog hide = { ! appReady } managePreferencesFn = { ( ) => setShowManagePreferencesDialog ( true ) } > </ MatomoDialog >
166
+ { showManagePreferencesDialog && < ManagePreferencesDialog > </ ManagePreferencesDialog > }
251
167
< div className = 'd-flex flex-column' >
252
168
< div className = 'top-bar' >
253
169
{ props . app . topBar . render ( ) }
0 commit comments