add types in contract-selection component. unfold 2 important sections by default

pull/4167/head
Joseph Izang 1 year ago
parent f51cd80849
commit a218c61552
  1. 1
      libs/remix-ui/solidity-compile-details/src/lib/solidity-compile-details.tsx
  2. 6
      libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx
  3. 4
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts

@ -1,6 +1,7 @@
import { CopyToClipboard } from '@remix-ui/clipboard'
import { CustomTooltip } from '@remix-ui/helper'
import { TreeView, TreeViewItem } from '@remix-ui/tree-view'
import React from 'react'
import { useIntl } from 'react-intl'

@ -1,6 +1,6 @@
import React, {useState, useEffect} from 'react' // eslint-disable-line
import {FormattedMessage, useIntl} from 'react-intl'
import {ContractSelectionProps} from './types'
import {ContractPropertyName, ContractSelectionProps} from './types'
import {PublishToStorage} from '@remix-ui/publish-to-storage' // eslint-disable-line
import {TreeView, TreeViewItem} from '@remix-ui/tree-view' // eslint-disable-line
import {CopyToClipboard} from '@remix-ui/clipboard' // eslint-disable-line
@ -122,7 +122,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
return ret
}
const insertValue = (details, propertyName) => {
const insertValue = (details, propertyName: ContractPropertyName) => {
let node
if (propertyName === 'web3Deploy' || propertyName === 'name' || propertyName === 'Assembly') {
node = <pre>{details[propertyName]}</pre>
@ -197,7 +197,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
const log = (
<div className="remixui_detailsJSON">
<TreeView>
{Object.keys(contractProperties).map((propertyName, index) => {
{Object.keys(contractProperties).map((propertyName: ContractPropertyName, index) => {
const copyDetails = (
<span className="remixui_copyDetails">
<CopyToClipboard tip={intl.formatMessage({id: 'solidity.copy'})} content={contractProperties[propertyName]} direction="top" />

@ -53,3 +53,7 @@ export interface CompilationDetails {
export interface ContractsFile {
[currentFile: string]: CompilationDetails
}
export type ContractPropertyName = 'compilerInput' | 'name' | 'metadata' | 'bytecode' | 'abi' | 'storageLayout'
| 'web3Deploy' | 'metadataHash' | 'functionHashes' | 'gasEstimates' | 'devdoc' | 'userdoc' | 'Runtime Bytecode'
| 'Assembly'

Loading…
Cancel
Save