Skip to content

Commit 3e4135a

Browse files
committed
usertype modal removed
1 parent 6976575 commit 3e4135a

File tree

4 files changed

+2
-143
lines changed

4 files changed

+2
-143
lines changed

libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx

Lines changed: 0 additions & 54 deletions
This file was deleted.

libs/remix-ui/app/src/lib/remix-app/components/modals/managePreferences.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ const ManagePreferencesDialog = (props) => {
121121
_paq.push(['trackEvent', 'landingPage', 'MatomoAIModal', `MatomoPerfStatus: ${switcherState.current.matPerfSwitch}`])
122122
_paq.push(['trackEvent', 'landingPage', 'MatomoAIModal', `AICopilotStatus: ${switcherState.current.remixAISwitch}`])
123123
setVisible(false)
124-
props.savePreferencesFn()
125124
}
126125

127126
return <></>

libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ declare global {
1010
const _paq = (window._paq = window._paq || [])
1111

1212
interface MatomoDialogProps {
13-
acceptAllFn: () => void
1413
managePreferencesFn: () => void
1514
hide: boolean
1615
}
@@ -72,7 +71,6 @@ const MatomoDialog = (props: MatomoDialogProps) => {
7271
settings.updateCopilotChoice(true) // Enable RemixAI copilot
7372
_paq.push(['trackEvent', 'landingPage', 'MatomoAIModal', 'AcceptClicked'])
7473
setVisible(false)
75-
props.acceptAllFn()
7674
}
7775

7876
const handleManagePreferencesClick = async () => {

libs/remix-ui/app/src/lib/remix-app/remix-app.tsx

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useEffect, useReducer, useRef, useState } from 'react'
22
import './style/remix-app.css'
33
import { RemixUIMainPanel } from '@remix-ui/panel'
44
import MatomoDialog from './components/modals/matomo'
5-
import EnterDialog from './components/modals/enter'
65
import ManagePreferencesDialog from './components/modals/managePreferences'
76
import OriginWarning from './components/modals/origin-warning'
87
import DragBar from './components/dragbar/dragbar'
@@ -11,7 +10,6 @@ import AppDialogs from './components/modals/dialogs'
1110
import DialogViewPlugin from './components/modals/dialogViewPlugin'
1211
import { appProviderContextType, onLineContext, platformContext } from './context/context'
1312
import { IntlProvider } from 'react-intl'
14-
import { UsageTypes } from './types'
1513
import { appReducer } from './reducer/app'
1614
import { appInitialState } from './state/app'
1715
import isElectron from 'is-electron'
@@ -29,7 +27,6 @@ interface IRemixAppUi {
2927
}
3028
const RemixApp = (props: IRemixAppUi) => {
3129
const [appReady, setAppReady] = useState<boolean>(false)
32-
const [showEnterDialog, setShowEnterDialog] = useState<boolean>(false)
3330
const [showManagePreferencesDialog, setShowManagePreferencesDialog] = useState<boolean>(false)
3431
const [hideSidePanel, setHideSidePanel] = useState<boolean>(false)
3532
const [hidePinnedPanel, setHidePinnedPanel] = useState<boolean>(true)
@@ -47,8 +44,6 @@ const RemixApp = (props: IRemixAppUi) => {
4744
const sidePanelRef = useRef(null)
4845
const pinnedPanelRef = useRef(null)
4946

50-
//console.log('RemixApp props', props)
51-
5247
const [appState, appStateDispatch] = useReducer(appReducer, {
5348
...appInitialState,
5449
showPopupPanel: !window.localStorage.getItem('did_show_popup_panel') && !isElectron(),
@@ -70,48 +65,6 @@ const RemixApp = (props: IRemixAppUi) => {
7065
if (props.app) {
7166
activateApp()
7267
}
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-
}
11568
}, [])
11669

11770
useEffect(() => {
@@ -202,52 +155,15 @@ const RemixApp = (props: IRemixAppUi) => {
202155
appStateDispatch: appStateDispatch
203156
}
204157

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-
241158
return (
242159
//@ts-ignore
243160
<IntlProvider locale={locale.code} messages={locale.messages}>
244161
<platformContext.Provider value={props.app.platform}>
245162
<onLineContext.Provider value={online}>
246163
<AppProvider value={value}>
247164
<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>}
251167
<div className='d-flex flex-column'>
252168
<div className='top-bar'>
253169
{props.app.topBar.render()}

0 commit comments

Comments
 (0)