|
|
|
@ -13,6 +13,13 @@ import {IntlProvider, FormattedMessage} from 'react-intl' |
|
|
|
|
import {CustomTooltip} from '@remix-ui/helper' |
|
|
|
|
import {UsageTypes} from './types' |
|
|
|
|
|
|
|
|
|
declare global { |
|
|
|
|
interface Window { |
|
|
|
|
_paq: any |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const _paq = (window._paq = window._paq || []) |
|
|
|
|
|
|
|
|
|
interface IRemixAppUi { |
|
|
|
|
app: any |
|
|
|
|
} |
|
|
|
@ -80,16 +87,47 @@ const RemixApp = (props: IRemixAppUi) => { |
|
|
|
|
const value = { |
|
|
|
|
settings: props.app.settings, |
|
|
|
|
showMatamo: props.app.showMatamo, |
|
|
|
|
showEnter: props.app.showEnter, |
|
|
|
|
appManager: props.app.appManager, |
|
|
|
|
modal: props.app.notification, |
|
|
|
|
layout: props.app.layout |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleUserChosenType = (type) => { |
|
|
|
|
const handleUserChosenType = async (type) => { |
|
|
|
|
setShowEnterDialog(false) |
|
|
|
|
localStorage.setItem('hadUsageTypeAsked', "true") |
|
|
|
|
localStorage.setItem('hadUsageTypeAsked', "1") |
|
|
|
|
|
|
|
|
|
await props.app.appManager.call('walkthrough', 'start') |
|
|
|
|
|
|
|
|
|
// Use the type to setup the UI accordingly
|
|
|
|
|
switch (type) { |
|
|
|
|
case UsageTypes.Beginner: { |
|
|
|
|
await props.app.appManager.call('manager', 'activatePlugin', 'LearnEth') |
|
|
|
|
// const wName = 'Playground'
|
|
|
|
|
// const workspaces = await props.app.appManager.call('filePanel', 'getWorkspaces')
|
|
|
|
|
// if (!workspaces.find((workspace) => workspace.name === wName)) {
|
|
|
|
|
// await props.app.appManager.call('filePanel', 'createWorkspace', wName, 'playground')
|
|
|
|
|
// }
|
|
|
|
|
// await props.app.appManager.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false })
|
|
|
|
|
|
|
|
|
|
_paq.push(['trackEvent', 'enterDialog', 'usageType', 'beginner']) |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
case UsageTypes.Tutor: { |
|
|
|
|
_paq.push(['trackEvent', 'enterDialog', 'usageType', 'tutor']) |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
case UsageTypes.Prototyper: { |
|
|
|
|
_paq.push(['trackEvent', 'enterDialog', 'usageType', 'prototyper']) |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
case UsageTypes.Production: { |
|
|
|
|
_paq.push(['trackEvent', 'enterDialog', 'usageType', 'production']) |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
default: throw new Error() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
@ -97,13 +135,19 @@ const RemixApp = (props: IRemixAppUi) => { |
|
|
|
|
<IntlProvider locale={locale.code} messages={locale.messages}> |
|
|
|
|
<AppProvider value={value}> |
|
|
|
|
<OriginWarning></OriginWarning> |
|
|
|
|
<MatomoDialog hide={!appReady}></MatomoDialog> |
|
|
|
|
<MatomoDialog hide={!appReady} okFn={() => {setShowEnterDialog(true)}}> |
|
|
|
|
</MatomoDialog> |
|
|
|
|
<EnterDialog hide={!showEnterDialog} handleUserChoice={(type) => handleUserChosenType(type)}></EnterDialog> |
|
|
|
|
<div className={`remixIDE ${appReady ? '' : 'd-none'}`} data-id="remixIDE"> |
|
|
|
|
<div id="icon-panel" data-id="remixIdeIconPanel" className="custom_icon_panel iconpanel bg-light"> |
|
|
|
|
{props.app.menuicons.render()} |
|
|
|
|
</div> |
|
|
|
|
<div ref={sidePanelRef} id="side-panel" data-id="remixIdeSidePanel" className={`sidepanel border-right border-left ${hideSidePanel ? 'd-none' : ''}`}> |
|
|
|
|
<div |
|
|
|
|
ref={sidePanelRef} |
|
|
|
|
id="side-panel" |
|
|
|
|
data-id="remixIdeSidePanel" |
|
|
|
|
className={`sidepanel border-right border-left ${hideSidePanel ? 'd-none' : ''}`} |
|
|
|
|
> |
|
|
|
|
{props.app.sidePanel.render()} |
|
|
|
|
</div> |
|
|
|
|
<DragBar |
|
|
|
|