@@ -13,7 +13,9 @@ import ToggleButton from 'react-bootstrap/ToggleButton'
1313import Button from 'react-bootstrap/Button'
1414
1515import './app.css'
16- import { CustomTooltip } from '@remix-ui/helper'
16+ import { CustomTooltip } from '@remix-ui/helper'
17+ import { Form } from 'react-bootstrap'
18+ import { CompileErrorCard } from './components/CompileErrorCard'
1719
1820interface AppState {
1921 status : 'idle' | 'inProgress'
@@ -32,10 +34,9 @@ const App = () => {
3234 const [ state , setState ] = useState < AppState > ( {
3335 status : 'idle' ,
3436 environment : 'remote' ,
35- localUrl : 'http://localhost:8000/'
37+ localUrl : 'http://localhost:8000/' ,
3638 } )
3739
38-
3940 useEffect ( ( ) => {
4041 async function start ( ) {
4142 try {
@@ -67,6 +68,9 @@ const App = () => {
6768
6869 useEffect ( ( ) => {
6970 remixClient . eventEmitter . on ( 'setOutput' , ( payload ) => {
71+ if ( payload . status === 'failed' ) {
72+ console . error ( 'Error in the compiler' , payload )
73+ }
7074 setOutput ( payload )
7175 } )
7276
@@ -96,43 +100,43 @@ const App = () => {
96100
97101 return (
98102 < main id = "vyper-plugin" >
103+ < header >
104+ < div className = "title" >
105+ < img src = { 'assets/vyperLogo_v2.webp' } alt = "Vyper logo" />
106+ < h4 className = "pl-1" > yper Compiler</ h4 >
107+ </ div >
108+ < a rel = "noopener noreferrer" href = "https://github.com/ethereum/remix-project/tree/master/apps/vyper" target = "_blank" >
109+ < i className = "fab fa-github" > </ i >
110+ </ a >
111+ </ header >
99112 < section >
100113 < div className = "px-3 pt-3 mb-3 w-100" >
101- < CustomTooltip
102- placement = "bottom"
103- tooltipText = "Clone Vyper examples. Switch to the File Explorer to see the examples."
104- >
105- < Button data-id = "add-repository" className = "w-100 text-dark bg-light btn-outline-primary " onClick = { ( ) => remixClient . cloneVyperRepo ( ) } >
106- Clone Vyper examples repository
114+ < CustomTooltip placement = "bottom" tooltipText = "Clone Vyper examples. Switch to the File Explorer to see the examples." >
115+ < Button data-id = "add-repository" className = "w-100 btn btn-secondary" onClick = { ( ) => remixClient . cloneVyperRepo ( ) } >
116+ Clone Vyper examples repository
107117 </ Button >
108118 </ CustomTooltip >
109119 </ div >
110- < ToggleButtonGroup name = "remote" className = "mb-3" onChange = { setEnvironment } type = "radio" value = { state . environment } >
111- < ToggleButton data-id = "remote-compiler" variant = "secondary" name = "remote" value = "remote" >
112- Remote Compiler
113- </ ToggleButton >
114- < ToggleButton id = "local-compiler" data-id = "local-compiler" variant = "secondary" name = "local" value = "local" >
115- Local Compiler
116- </ ToggleButton >
117- </ ToggleButtonGroup >
120+ < Form >
121+ < div className = "d-flex flex-row gap-5 mb-3 mt-2" >
122+ < Form . Check inline data-id = "remote-compiler" type = "radio" value = { state . environment } checked = { state . environment === 'remote' } onChange = { ( ) => setEnvironment ( 'remote' ) } label = "Remote Compiler" style = { { cursor : state . environment === 'remote' ? 'default' : 'pointer' } } className = "d-flex mr-4" />
123+ < Form . Check inline id = "local-compiler" data-id = "local-compiler" checked = { state . environment === 'local' } type = "radio" name = "local" value = { state . environment } onChange = { ( ) => setEnvironment ( 'local' ) } label = "Local Compiler" style = { { cursor : state . environment === 'local' ? 'default' : 'pointer' } } />
124+ </ div >
125+ </ Form >
126+ < span className = "px-3 mt-1 mb-1 small text-warning" > Specify the compiler version & EVM version in the . vy file </ span >
118127 < LocalUrlInput url = { state . localUrl } setUrl = { setLocalUrl } environment = { state . environment } />
119128 < div className = "px-3 w-100 mb-3 mt-1" id = "compile-btn" >
120- < CompilerButton
121- compilerUrl = { compilerUrl ( ) }
122- contract = { contract }
123- setOutput = { ( name , update ) => setOutput ( { ...output , [ name ] : update } ) }
124- resetCompilerState = { resetCompilerResultState }
125- />
129+ < CompilerButton compilerUrl = { compilerUrl ( ) } contract = { contract } setOutput = { ( name , update ) => setOutput ( { ...output , [ name ] : update } ) } resetCompilerState = { resetCompilerResultState } />
126130 </ div >
127131
128132 < article id = "result" className = "px-2 mx-2 border-top mt-3" >
129- {
130- output && Object . keys ( output ) . length > 0 && output . status !== 'failed' ? (
131- < >
132- < VyperResult output = { output } plugin = { remixClient } />
133- </ >
134- ) : null
135- }
133+ { output && Object . keys ( output ) . length > 0 && output . status !== 'failed' ? (
134+ < >
135+ < VyperResult output = { output } plugin = { remixClient } / >
136+ < />
137+ ) : output . status === 'failed' ? (
138+ < CompileErrorCard output = { output } />
139+ ) : null }
136140 </ article >
137141 </ section >
138142 </ main >
0 commit comments