parent
46e20c5ae8
commit
0d0ab68961
@ -1,14 +1,67 @@ |
|||||||
|
import { CopyToClipboard } from '@remix-ui/clipboard' |
||||||
|
import { TreeView, TreeViewItem } from '@remix-ui/tree-view' |
||||||
import React from 'react' |
import React from 'react' |
||||||
|
|
||||||
export interface RemixUiCompileDetailsProps { |
export interface RemixUiCompileDetailsProps { |
||||||
plugin: any |
plugin: any |
||||||
|
contractProperties: any |
||||||
|
intl: any |
||||||
|
selectedContract: string |
||||||
|
help: any |
||||||
|
insertValue: any |
||||||
|
saveAs: any |
||||||
} |
} |
||||||
|
|
||||||
export function RemixUiCompileDetails({ plugin }: RemixUiCompileDetailsProps) { |
const _paq = (window._paq = window._paq || []) |
||||||
|
|
||||||
|
export function RemixUiCompileDetails({ plugin, contractProperties, intl, selectedContract, saveAs, help, insertValue }: RemixUiCompileDetailsProps) { |
||||||
|
|
||||||
|
const downloadFn = () => { |
||||||
|
_paq.push(['trackEvent', 'compiler', 'compilerDetails', 'download']) |
||||||
|
saveAs(new Blob([JSON.stringify(contractProperties, null, '\t')]), `${selectedContract}_compData.json`) |
||||||
|
} |
||||||
return ( |
return ( |
||||||
<> |
<> |
||||||
<h1>Compile Details!!!</h1> |
<div> |
||||||
<h3>Every thing works fine.</h3> |
<span>{selectedContract}</span><span>Download Compile details</span> |
||||||
|
</div> |
||||||
|
<div className="remixui_detailsJSON"> |
||||||
|
<TreeView> |
||||||
|
{Object.keys(contractProperties).map((propertyName, index) => { |
||||||
|
const copyDetails = ( |
||||||
|
<span className="remixui_copyDetails"> |
||||||
|
<CopyToClipboard tip={intl.formatMessage({id: 'solidity.copy'})} content={contractProperties[propertyName]} direction="top" /> |
||||||
|
</span> |
||||||
|
) |
||||||
|
const questionMark = ( |
||||||
|
<span className="remixui_questionMark"> |
||||||
|
<i |
||||||
|
title={intl.formatMessage({ |
||||||
|
id: `solidity.${propertyName}`, |
||||||
|
defaultMessage: help[propertyName] |
||||||
|
})} |
||||||
|
className="fas fa-question-circle" |
||||||
|
aria-hidden="true" |
||||||
|
></i> |
||||||
|
</span> |
||||||
|
) |
||||||
|
|
||||||
|
return ( |
||||||
|
<div className="remixui_log" key={index}> |
||||||
|
<TreeViewItem |
||||||
|
label={ |
||||||
|
<div data-id={`remixui_treeviewitem_${propertyName}`} className="remixui_key"> |
||||||
|
{propertyName} {copyDetails} {questionMark} |
||||||
|
</div> |
||||||
|
} |
||||||
|
> |
||||||
|
{insertValue(contractProperties, propertyName)} |
||||||
|
</TreeViewItem> |
||||||
|
</div> |
||||||
|
) |
||||||
|
})} |
||||||
|
</TreeView> |
||||||
|
</div> |
||||||
</> |
</> |
||||||
) |
) |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue