|
|
@ -2,6 +2,7 @@ |
|
|
|
import React, { useEffect, useState, useContext } from 'react' |
|
|
|
import React, { useEffect, useState, useContext } from 'react' |
|
|
|
import { FormattedMessage } from 'react-intl' |
|
|
|
import { FormattedMessage } from 'react-intl' |
|
|
|
import { ThemeContext } from '../themeContext' |
|
|
|
import { ThemeContext } from '../themeContext' |
|
|
|
|
|
|
|
import { CustomTooltip } from '@remix-ui/helper' |
|
|
|
declare global { |
|
|
|
declare global { |
|
|
|
interface Window { |
|
|
|
interface Window { |
|
|
|
_paq: any |
|
|
|
_paq: any |
|
|
@ -27,10 +28,6 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
|
|
|
|
|
|
|
|
const themeFilter = useContext(ThemeContext) |
|
|
|
const themeFilter = useContext(ThemeContext) |
|
|
|
|
|
|
|
|
|
|
|
const openLink = () => { |
|
|
|
|
|
|
|
window.open("https://remix-ide.readthedocs.io/en/latest/remix_tutorials_learneth.html?highlight=learneth#learneth-tutorial-repos", '_blank') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const startLearnEthTutorial = async (tutorial: 'basics' | 'soliditybeginner' | 'deploylibraries') => { |
|
|
|
const startLearnEthTutorial = async (tutorial: 'basics' | 'soliditybeginner' | 'deploylibraries') => { |
|
|
|
await plugin.appManager.activatePlugin(['solidity', 'LearnEth', 'solidityUnitTesting']) |
|
|
|
await plugin.appManager.activatePlugin(['solidity', 'LearnEth', 'solidityUnitTesting']) |
|
|
|
plugin.verticalIcons.select('LearnEth') |
|
|
|
plugin.verticalIcons.select('LearnEth') |
|
|
@ -52,17 +49,25 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="d-flex px-2 pb-2 pt-2 d-flex flex-column" id="hTLearnSection"> |
|
|
|
<div className="d-flex px-2 pb-2 pt-2 d-flex flex-column" id="hTLearnSection"> |
|
|
|
<div className="d-flex justify-content-between"> |
|
|
|
<div className="d-flex justify-content-between"> |
|
|
|
<label className="py-2 align-self-center m-0" style={{fontSize: "1.2rem"}}> |
|
|
|
<label className="py-2 pt-3 align-self-center m-0" style={{fontSize: "1.2rem"}}> |
|
|
|
<FormattedMessage id="home.learn" /> |
|
|
|
<FormattedMessage id="home.learn" /> |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
<button |
|
|
|
<CustomTooltip |
|
|
|
onClick={ async () => { |
|
|
|
placement={'top'} |
|
|
|
await goToLearnEthHome() |
|
|
|
tooltipId="overlay-tooltip" |
|
|
|
}} |
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
className="h-100 px-2 pt-0 btn" |
|
|
|
tooltipText={"See all tutorials"} |
|
|
|
|
|
|
|
tooltipTextClasses="border bg-light text-dark p-1 pr-3" |
|
|
|
> |
|
|
|
> |
|
|
|
<img className="align-self-center" src="assets/img/learnEthLogo.webp" alt="" style={ { filter: themeFilter.filter, width: "1rem", height: "1ren" } } /> |
|
|
|
<button |
|
|
|
</button> |
|
|
|
onClick={ async () => { |
|
|
|
|
|
|
|
await goToLearnEthHome() |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
className="h-100 px-2 pt-0 btn" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<img className="align-self-center" src="assets/img/learnEthLogo.webp" alt="" style={ { filter: themeFilter.filter, width: "1rem", height: "1ren" } } /> |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
</CustomTooltip> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="d-flex flex-column"> |
|
|
|
<div className="d-flex flex-column"> |
|
|
|
<label className="d-flex flex-column btn border" onClick={() => setState((prevState) => {return { ...prevState, visibleTutorial: VisibleTutorial.Basics }})}> |
|
|
|
<label className="d-flex flex-column btn border" onClick={() => setState((prevState) => {return { ...prevState, visibleTutorial: VisibleTutorial.Basics }})}> |
|
|
@ -70,7 +75,7 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
<FormattedMessage id="home.learnEth1" /> |
|
|
|
<FormattedMessage id="home.learnEth1" /> |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
{(state.visibleTutorial === VisibleTutorial.Basics) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
{(state.visibleTutorial === VisibleTutorial.Basics) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
<span> |
|
|
|
<span className="py-1" style={{fontSize: "0.8rem"}}> |
|
|
|
<FormattedMessage id="home.learnEth1Desc" /> |
|
|
|
<FormattedMessage id="home.learnEth1Desc" /> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('basics')}> |
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('basics')}> |
|
|
@ -83,11 +88,12 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
<FormattedMessage id="home.learnEth2" /> |
|
|
|
<FormattedMessage id="home.learnEth2" /> |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
{(state.visibleTutorial === VisibleTutorial.Intermediate) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
{(state.visibleTutorial === VisibleTutorial.Intermediate) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
<span> |
|
|
|
<span className="py-1" style={{fontSize: "0.8rem"}}> |
|
|
|
<FormattedMessage id="home.learnEth2Desc" /></span> |
|
|
|
<FormattedMessage id="home.learnEth2Desc" /> |
|
|
|
|
|
|
|
</span> |
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('soliditybeginner')}> |
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('soliditybeginner')}> |
|
|
|
<FormattedMessage id="home.getStarted" /> |
|
|
|
<FormattedMessage id="home.getStarted" /> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div>} |
|
|
|
</div>} |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
<label className="d-flex flex-column btn border" onClick={() => setState((prevState) => {return { ...prevState, visibleTutorial: VisibleTutorial.Advanced }})}> |
|
|
|
<label className="d-flex flex-column btn border" onClick={() => setState((prevState) => {return { ...prevState, visibleTutorial: VisibleTutorial.Advanced }})}> |
|
|
@ -95,11 +101,12 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
<FormattedMessage id="home.remixAdvanced" /> |
|
|
|
<FormattedMessage id="home.remixAdvanced" /> |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
{(state.visibleTutorial === VisibleTutorial.Advanced) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
{(state.visibleTutorial === VisibleTutorial.Advanced) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
<span> |
|
|
|
<span className="py-1" style={{fontSize: "0.8rem"}}> |
|
|
|
<FormattedMessage id="home.remixAdvancedDesc" /></span> |
|
|
|
<FormattedMessage id="home.remixAdvancedDesc" /> |
|
|
|
|
|
|
|
</span> |
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('deploylibraries')}> |
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('deploylibraries')}> |
|
|
|
<FormattedMessage id="home.getStarted" /> |
|
|
|
<FormattedMessage id="home.getStarted" /> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div>} |
|
|
|
</div>} |
|
|
|
</label> |
|
|
|
</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|