remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/apps/remix-ide/src/walkthroughService.js

131 lines
5.0 KiB

3 years ago
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../package.json'
const introJs = require('intro.js')
3 years ago
const profile = {
name: 'walkthrough',
displayName: 'Walkthrough',
description: 'Remix walkthrough for beginner',
3 years ago
version: packageJson.version,
methods: ['start', 'startRecorderW']
3 years ago
}
3 years ago
export class WalkthroughService extends Plugin {
constructor (appManager, showWalkthrough) {
3 years ago
super(profile)
/*let readyToStart = 0;
appManager.event.on('activate', (plugin) => {
if (plugin.name === 'udapp') readyToStart++
if (readyToStart == 2 && showWalkthrough) {
3 years ago
this.start()
}
})
appManager.event.on('activate', (plugin) => {
if (plugin.name === 'solidity') readyToStart++
if (readyToStart == 2 && showWalkthrough) {
this.start()
}
})*/
}
3 years ago
startRecorderW () {
introJs().setOptions({
steps: [{
title: 'Transactions Recorder',
intro: 'Save transactions (deployed contracts and function executions) and replay them in another environment e.g Transactions created in Remix VM can be replayed in the Injected Provider.Click to launch the Home tab that contains links, tips, and shortcuts..',
element: document.querySelector('#udappRecorderCard'),
tooltipClass: 'bg-light text-dark',
position: 'right',
highlightClass: 'bg-light border border-warning'
},
{
element: document.querySelector('#udappRecorderUseLatest'),
title: 'Transactions Recorder',
intro: 'If set the recorder will run transactions using the latest compilation result.',
tooltipClass: 'bg-light text-dark',
position: 'right',
highlightClass: 'bg-light border border-warning'
},
{
element: document.querySelector('#udappRecorderSave'),
title: 'Transactions Recorder',
intro: 'Once there is a one or a few transactions have been executed from Remix, click this button to save these transactions as a scenario file.',
tooltipClass: 'bg-light text-dark',
position: 'right',
highlightClass: 'bg-light border border-warning'
},
{
element: document.querySelector('#udappRecorderRun'),
title: 'Transactions Recorder',
1 year ago
intro: 'Open a scenario file and click this button to run it against the current selected provider.',
tooltipClass: 'bg-light text-dark',
position: 'right',
highlightClass: 'bg-light border border-warning'
}
]
}).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')
1 year ago
header.id="remixRecorderWalkthrowTitle"
}
const skipbutton = document.getElementsByClassName('introjs-skipbutton')[0]
if (skipbutton) {
skipbutton.classList.add('ml-3')
skipbutton.classList.add('text-decoration-none')
skipbutton.id = 'remixTourSkipbtn'
}
}).start()
}
3 years ago
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',
highlightClass: 'bg-light border border-warning'
3 years ago
},
{
3 years ago
element: document.querySelector('#verticalIconsKindsolidity'),
3 years ago
title: 'Solidity Compiler',
intro: 'Having selected a .sol file in the File Explorer (the icon above), compile it with the Solidity Compiler.',
3 years ago
tooltipClass: 'bg-light text-dark',
position: 'right',
highlightClass: 'bg-light border border-warning'
3 years ago
},
{
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',
highlightClass: 'bg-light border border-warning'
3 years ago
}
]
}).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)
}
}
}