|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
import React, { useEffect, useState, useContext } from 'react' |
|
|
|
|
import { FormattedMessage } from 'react-intl' |
|
|
|
|
import { ThemeContext } from '../themeContext' |
|
|
|
|
import { CustomTooltip } from '@remix-ui/helper' |
|
|
|
|
declare global { |
|
|
|
|
interface Window { |
|
|
|
|
_paq: any |
|
|
|
@ -27,10 +28,6 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
|
|
|
|
|
|
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') => { |
|
|
|
|
await plugin.appManager.activatePlugin(['solidity', 'LearnEth', 'solidityUnitTesting']) |
|
|
|
|
plugin.verticalIcons.select('LearnEth') |
|
|
|
@ -52,17 +49,25 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
|
return ( |
|
|
|
|
<div className="d-flex px-2 pb-2 pt-2 d-flex flex-column" id="hTLearnSection"> |
|
|
|
|
<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" /> |
|
|
|
|
</label> |
|
|
|
|
<button |
|
|
|
|
onClick={ async () => { |
|
|
|
|
await goToLearnEthHome() |
|
|
|
|
}} |
|
|
|
|
className="h-100 px-2 pt-0 btn" |
|
|
|
|
<CustomTooltip |
|
|
|
|
placement={'top'} |
|
|
|
|
tooltipId="overlay-tooltip" |
|
|
|
|
tooltipClasses="text-nowrap" |
|
|
|
|
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 className="d-flex flex-column"> |
|
|
|
|
<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" /> |
|
|
|
|
</label> |
|
|
|
|
{(state.visibleTutorial === VisibleTutorial.Basics) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
|
<span style={{fontSize: "0.8rem"}}> |
|
|
|
|
<span className="py-1" style={{fontSize: "0.8rem"}}> |
|
|
|
|
<FormattedMessage id="home.learnEth1Desc" /> |
|
|
|
|
</span> |
|
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('basics')}> |
|
|
|
@ -83,7 +88,7 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
|
<FormattedMessage id="home.learnEth2" /> |
|
|
|
|
</label> |
|
|
|
|
{(state.visibleTutorial === VisibleTutorial.Intermediate) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
|
<span style={{fontSize: "0.8rem"}}> |
|
|
|
|
<span className="py-1" style={{fontSize: "0.8rem"}}> |
|
|
|
|
<FormattedMessage id="home.learnEth2Desc" /> |
|
|
|
|
</span> |
|
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('soliditybeginner')}> |
|
|
|
@ -96,7 +101,7 @@ function HomeTabLearn ({plugin}: HomeTabLearnProps) { |
|
|
|
|
<FormattedMessage id="home.remixAdvanced" /> |
|
|
|
|
</label> |
|
|
|
|
{(state.visibleTutorial === VisibleTutorial.Advanced) && <div className="pt-2 d-flex flex-column text-left"> |
|
|
|
|
<span style={{fontSize: "0.8rem"}}> |
|
|
|
|
<span className="py-1" style={{fontSize: "0.8rem"}}> |
|
|
|
|
<FormattedMessage id="home.remixAdvancedDesc" /> |
|
|
|
|
</span> |
|
|
|
|
<button className="btn btn-sm btn-secondary mt-2" style={{width: 'fit-content'}} onClick={() => startLearnEthTutorial('deploylibraries')}> |
|
|
|
|