-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from CashScript/rework
Rework layout with navigation tabs
- Loading branch information
Showing
22 changed files
with
389 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react' | ||
import { Artifact } from 'cashscript' | ||
|
||
interface Props { | ||
artifact?: Artifact | ||
} | ||
|
||
const ContractInfo: React.FC<Props> = ({ artifact }) => { | ||
|
||
const downloadArtifact = () => { | ||
if(!artifact) return | ||
const element = document.createElement('a'); | ||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(artifact, null, 2))); | ||
element.setAttribute('download', `${artifact.contractName}.json`); | ||
element.style.display = 'none'; | ||
document.body.appendChild(element); | ||
element.click(); | ||
document.body.removeChild(element); | ||
} | ||
|
||
return ( | ||
<div style={{ | ||
flex: 2, | ||
margin: '16px', | ||
border: '2px solid black', | ||
borderTop: '1px solid black', | ||
fontSize: '100%', | ||
lineHeight: 'inherit', | ||
overflow: 'auto', | ||
background: '#fffffe', | ||
padding: '8px 16px', | ||
color: '#000' | ||
}}>{ artifact? | ||
(<div> | ||
<h2>Artifact {artifact.contractName}</h2> | ||
<strong>Last Updated</strong> | ||
<p>{artifact.updatedAt}</p> | ||
<strong>Artifact Bytecode</strong> | ||
<details> | ||
<summary> | ||
show full Bytecode | ||
</summary> | ||
{artifact.bytecode} | ||
</details> | ||
<strong>Compiler Version</strong> | ||
<p>{artifact.compiler.version}</p> | ||
<strong>Download Artifact</strong> | ||
<p onClick={downloadArtifact}> | ||
download JSON file | ||
<img src='./downloadIcon.svg' style={{marginLeft:"5px", verticalAlign: "text-bottom", cursor:"pointer"}}/> | ||
</p> | ||
</div>) : | ||
<div>Compile a CashScript contract to get started!</div> } | ||
</div> | ||
) | ||
} | ||
|
||
export default ContractInfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.