fix walkthrough

pull/1840/head
bunsenstraat 3 years ago
parent 5085b53fe7
commit 583cd1e384
  1. 17
      apps/remix-ide/src/app-component.js
  2. 114
      apps/remix-ide/src/walkthroughService.js
  3. 13
      libs/remix-ui/app/src/lib/remix-app/modals/matomo.tsx
  4. 2
      libs/remix-ui/app/src/lib/remix-app/remix-app.tsx

@ -86,9 +86,13 @@ class AppComponent {
self.engine = new RemixEngine()
self.engine.register(appManager)
// const queryParams = new QueryParams()
// const params = queryParams.get()
self.walkthroughService = new WalkthroughService(localStorage)
const matomoDomains = {
'remix-alpha.ethereum.org': 27,
'remix-beta.ethereum.org': 25,
'remix.ethereum.org': 23
}
self.showMatamo = (matomoDomains[window.location.hostname] && !registry.get('config').api.exists('settings/matomo-analytics'))
self.walkthroughService = new WalkthroughService(appManager, self.showMatamo)
const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080']
// workaround for Electron support
@ -169,7 +173,8 @@ class AppComponent {
web3Provider,
fetchAndCompile,
dGitProvider,
hardhatProvider
hardhatProvider,
self.walkthroughService
])
// LAYOUT & SYSTEM VIEWS
@ -240,8 +245,6 @@ class AppComponent {
filePanel.hardhatHandle,
filePanel.slitherHandle
])
}
async activate () {
@ -266,6 +269,8 @@ class AppComponent {
await self.appManager.activatePlugin(['home'])
await self.appManager.activatePlugin(['settings'])
await self.appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'contextualListener', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport'])
await self.appManager.activatePlugin(['settings'])
await self.appManager.activatePlugin(['walkthrough'])
self.appManager.on('filePanel', 'workspaceInitializationCompleted', async () => {
await self.appManager.registerContextMenuItems()

@ -1,58 +1,70 @@
import { ViewPlugin } from '@remixproject/engine-web'
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../package.json'
const introJs = require('intro.js')
export class WalkthroughService extends ViewPlugin {
constructor (params) {
super()
this.params = params
}
const profile = {
name: 'walkthrough',
displayName: 'Walkthrough',
description: '',
version: packageJson.version,
methods: ['start']
}
start (params) {
document.addEventListener('doWalkThrough', (e) => {
if (!localStorage.getItem('hadTour_initial')) {
introJs().setOptions({
steps: [{
title: 'Welcome to Remix IDE',
intro: 'Click to launch the Home tab that contains links, tips, and shortcuts..',
element: document.querySelector('#verticalIconsHomeIcon'),
tooltipClass: 'bg-light text-dark',
position: 'right'
},
{
element: document.querySelector('#compileIcons'),
title: 'Solidity Compiler',
intro: 'Having selected a .sol file in the File Explorers (the icon above), compile it with the Solidity Compiler.',
tooltipClass: 'bg-light text-dark',
position: 'right'
},
{
title: 'Deploy your contract',
element: document.querySelector('#verticalIconsKindudapp'),
intro: 'Choose a chain, deploy a contract and play with your functions.',
tooltipClass: 'bg-light text-dark',
position: 'right'
}
]
}).onafterchange((targetElement) => {
const header = document.getElementsByClassName('introjs-tooltip-header')[0]
if (header) {
header.classList.add('d-flex')
header.classList.add('justify-content-between')
header.classList.add('text-nowrap')
header.classList.add('pr-0')
}
const skipbutton = document.getElementsByClassName('introjs-skipbutton')[0]
if (skipbutton) {
skipbutton.classList.add('ml-3')
skipbutton.classList.add('text-decoration-none')
skipbutton.id = 'remixTourSkipbtn'
}
}).start()
localStorage.setItem('hadTour_initial', true)
} else {
console.log('had walkthrough')
export class WalkthroughService extends Plugin {
constructor (appManager, showMatamo) {
super(profile)
appManager.event.on('activate', (plugin) => {
if (plugin.name === 'udapp' && !showMatamo) {
console.log('start')
this.start()
}
})
}
start () {
console.log('start')
if (!localStorage.getItem('hadTour_initial')) {
introJs().setOptions({
steps: [{
title: 'Welcome to Remix IDE',
intro: 'Click to launch the Home tab that contains links, tips, and shortcuts..',
element: document.querySelector('#verticalIconsHomeIcon'),
tooltipClass: 'bg-light text-dark',
position: 'right'
},
{
element: document.querySelector('#compileIcons'),
title: 'Solidity Compiler',
intro: 'Having selected a .sol file in the File Explorers (the icon above), compile it with the Solidity Compiler.',
tooltipClass: 'bg-light text-dark',
position: 'right'
},
{
title: 'Deploy your contract',
element: document.querySelector('#verticalIconsKindudapp'),
intro: 'Choose a chain, deploy a contract and play with your functions.',
tooltipClass: 'bg-light text-dark',
position: 'right'
}
]
}).onafterchange((targetElement) => {
const header = document.getElementsByClassName('introjs-tooltip-header')[0]
if (header) {
header.classList.add('d-flex')
header.classList.add('justify-content-between')
header.classList.add('text-nowrap')
header.classList.add('pr-0')
}
const skipbutton = document.getElementsByClassName('introjs-skipbutton')[0]
if (skipbutton) {
skipbutton.classList.add('ml-3')
skipbutton.classList.add('text-decoration-none')
skipbutton.id = 'remixTourSkipbtn'
}
}).start()
localStorage.setItem('hadTour_initial', true)
} else {
console.log('had walkthrough')
}
}
}

@ -4,16 +4,10 @@ import AppContext from '../context/context'
const _paq = window._paq = window._paq || []
const MatomoDialog = (props) => {
const { settings, registry } = useContext(AppContext)
const { settings, showMatamo, appManager } = useContext(AppContext)
const [visible, setVisible] = useState<boolean>(props.hide)
useEffect(() => {
const matomoDomains = {
'remix-alpha.ethereum.org': 27,
'remix-beta.ethereum.org': 25,
'remix.ethereum.org': 23,
localhost: 24
}
if (matomoDomains[window.location.hostname] && !registry.get('config').api.exists('settings/matomo-analytics')) {
if (showMatamo) {
setVisible(true)
} else {
setVisible(false)
@ -22,9 +16,11 @@ const MatomoDialog = (props) => {
const declineModal = async () => {
settings.updateMatomoAnalyticsChoice(false)
_paq.push(['optUserOut'])
appManager.call('walkthrough', 'start')
setVisible(false)
}
const hideModal = async () => {
console.log('handle hide')
setVisible(false)
}
const handleModalOkClick = async () => {
@ -32,6 +28,7 @@ const MatomoDialog = (props) => {
// @TODO remove next line when https://github.com/matomo-org/matomo/commit/9e10a150585522ca30ecdd275007a882a70c6df5 is used
document.cookie = 'mtm_consent_removed=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'
settings.updateMatomoAnalyticsChoice(true)
appManager.call('walkthrough', 'start')
setVisible(false)
}
return (<ModalDialog

@ -57,7 +57,7 @@ const RemixApp = (props: IRemixAppUi) => {
}
return (
<AppContext.Provider value={{ settings: props.app.settings, registry: props.app.registry }}>
<AppContext.Provider value={{ settings: props.app.settings, showMatamo: props.app.showMatamo, appManager: props.app.appManager }}>
<RemixSplashScreen hide={appReady}></RemixSplashScreen>
<AlertModal></AlertModal>
<MatomoDialog hide={!appReady}></MatomoDialog>

Loading…
Cancel
Save