diff --git a/apps/vyper/src/app/app.css b/apps/vyper/src/app/app.css index db9ee76b63..67e0fb59b1 100644 --- a/apps/vyper/src/app/app.css +++ b/apps/vyper/src/app/app.css @@ -45,11 +45,11 @@ html, body, #root, main { } #local-url { - width: 90%; + } #compile-btn { - width: 100%; + } #compile-btn * { @@ -120,4 +120,4 @@ html, body, #root, main { border: none; height: 100%; width: 100%; -} \ No newline at end of file +} diff --git a/apps/vyper/src/app/app.tsx b/apps/vyper/src/app/app.tsx index c4e738b98b..5705e1010a 100644 --- a/apps/vyper/src/app/app.tsx +++ b/apps/vyper/src/app/app.tsx @@ -81,8 +81,8 @@ const App: React.FC = () => {
-
-
@@ -96,7 +96,7 @@ const App: React.FC = () => { -
+
+ diff --git a/apps/vyper/src/app/components/LocalUrl.tsx b/apps/vyper/src/app/components/LocalUrl.tsx index 58f4b3d3c7..88a01c79e0 100644 --- a/apps/vyper/src/app/components/LocalUrl.tsx +++ b/apps/vyper/src/app/components/LocalUrl.tsx @@ -18,7 +18,7 @@ function LocalUrlInput({url, setUrl, environment}: Props) { return (
- + {'Currently we support vyper version > 0.2.16'} Local Compiler Url diff --git a/apps/vyper/src/app/components/VyperResult.tsx b/apps/vyper/src/app/components/VyperResult.tsx index 10e2a30a87..c4ef8959a9 100644 --- a/apps/vyper/src/app/components/VyperResult.tsx +++ b/apps/vyper/src/app/components/VyperResult.tsx @@ -18,6 +18,13 @@ export type ExampleContract = { address: string } +type TabContentMembers = { + tabText: string + tabPayload: any + tabMemberType: 'abi' | 'bytecode' | 'bytecode_runtime' | 'ir' + className: string +} + function VyperResult({ output, themeColor }: VyperResultProps) { const [active, setActive] = useState('abi') @@ -47,40 +54,53 @@ function VyperResult({ output, themeColor }: VyperResultProps) { ) } + const tabContent = [ + { + tabHeadingText: 'ABI', + tabPayload: Object.values(output)[0]['abi'], + tabMemberType: 'abi', + tabButtonText: () => 'Copy ABI', + eventKey: 'abi' + }, + { + tabHeadingText: 'Bytecode', + tabPayload: Object.values(output)[0]['bytecode'].object.toString(), + tabMemberType: 'bytecode', + tabButtonText: () => 'Copy Bytecode', + eventKey: 'bytecode' + }, + { + tabHeadingText: 'Runtime Bytecode', + tabPayload: Object.values(output)[0]['runtimeBytecode'].object.toString(), + tabMemberType: 'bytecode_runtime', + tabButtonText: () => 'Copy Runtime Bytecode', + eventKey: 'bytecode_runtime' + } + // { + // tabHeadingText: 'LLL', + // tabPayload: Object.values(output)[0]['ir'] ? '' : '', + // tabMemberType: 'ir', + // tabButtonText: () => Object.values(output)[0]['ir'] ? 'Copy LLL Code' : 'Nothing to copy yet', + // eventKey: 'ir' + // } + ] + return ( setActive(key)} justify> - - JSON.stringify(Object.values(output)[0]['abi'])}> - - - - - - JSON.stringify(Object.values(output)[0]['bytecode'].object.toString())}> - - - - - - JSON.stringify(Object.values(output)[0]['runtimeBytecode'].object.toString())}> - - - - - - JSON.stringify(Object.values(output)[0]['ir'])}> - - - - + {tabContent.map((content, index) => ( + + content.eventKey !== 'abi' ? content.tabPayload : JSON.stringify(Object.values(output)[0]['abi'])}> + + + { + content.eventKey === 'abi' ? : ( + + ) + } + )) + } ) }