Skip to content

Commit

Permalink
fixed displaying
Browse files Browse the repository at this point in the history
  • Loading branch information
tubackkhoa committed Sep 11, 2023
1 parent c1225f6 commit cb01e88
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 29 deletions.
8 changes: 4 additions & 4 deletions src/components/SmartContract/MoreInfo.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import PropTypes from "prop-types";
import cn from "classnames/bind";
import {NavLink} from "react-router-dom";
import {isNil} from "lodash";
import { NavLink } from "react-router-dom";
import { isNil } from "lodash";
import Grid from "@material-ui/core/Grid";
import Skeleton from "@material-ui/lab/Skeleton";
import InfoRow from "src/components/common/InfoRow";
Expand All @@ -11,7 +11,7 @@ import consts from "src/constants/consts";

const cx = cn.bind(styles);

const MoreInfo = ({data}) => {
const MoreInfo = ({ data }) => {
return (
<Grid item lg={6} xs={12}>
<div className={cx("more-info")}>
Expand Down Expand Up @@ -57,7 +57,7 @@ const MoreInfo = ({data}) => {
<div className={cx("item-title")}>Label</div>
</td>
<td>
<div className={cx("item-text")}>{isNil(data?.label) ? "-" : data?.label}</div>
<div className={cx("item-text")}>{isNil(data?.contract_name) ? "-" : data?.contract_name}</div>
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const HandleItemContract = ({ schema, onHandle, handleText, onClickCopy,
<Collapse in={state[index + 1]}>
<div className={cx("value")}>
{msg.fieldList.map((item, subInd) => (
<div className={cx("input")}>
<div key={subInd} className={cx("input")}>
{item.isRequired ? "*" : ""}
<input
onChange={e => {
Expand All @@ -202,6 +202,7 @@ export const HandleItemContract = ({ schema, onHandle, handleText, onClickCopy,
))}
<div className={cx("btn")}>
<Button
className={cx("execute-button")}
variant='contained'
onClick={async () => {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@
}
.btn {
padding-bottom: 12px;

.execute-button{
color: var(--common-buttonTextColor);
background: var(--common-buttonBackgroundColor);
border: 1px solid var(--common-activeTabColor);
}
}
}
}
Expand Down
53 changes: 31 additions & 22 deletions src/containers/VerifiedContract/ReadContract/ReadContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,41 @@ import HeaderContract from "../HeaderContract";
import copy from "copy-to-clipboard";
import { showAlert } from "src/store/modules/global";
import { useDispatch, useSelector } from "react-redux";
import { HandleItemContract } from '../ComponentContract';
import { onQuery } from '../ContractInteraction';
import { HandleItemContract } from "../ComponentContract";
import { onQuery } from "../ContractInteraction";

const cx = classNames.bind(styles);

const ReadContract = memo(({ data }) => {
const [activeTab, setActiveTab] = useState(false);
const dispatch = useDispatch();
const activeThemeId = useSelector(state => state.activeThemeId);
const onClickCopy = (msg) => {
copy(JSON.stringify(msg))
dispatch(
showAlert({
show: true,
message: "Copied",
autoHideDuration: 1500,
})
);
}
return (
<div className={cx("read-contract")}>
<HeaderContract label={"Read Contract Infomation"} activeTab={activeTab} setActiveTab={setActiveTab} />
<div style={{ height: 16 }} />
<HandleItemContract activeThemeId={activeThemeId} handleText='Query' setActiveTab={setActiveTab} activeTab={activeTab} onClickCopy={onClickCopy} contractAddress={data?.contract_address} schema={data?.schema?.query} onHandle={onQuery} />
</div>
);
const [activeTab, setActiveTab] = useState(false);
const dispatch = useDispatch();
const activeThemeId = useSelector(state => state.activeThemeId);
const onClickCopy = msg => {
copy(JSON.stringify(msg));
dispatch(
showAlert({
show: true,
message: "Copied",
autoHideDuration: 1500,
})
);
};
return (
<div className={cx("read-contract")}>
<HeaderContract icon={<></>} label={"Read Contract Infomation"} activeTab={activeTab} setActiveTab={setActiveTab} />
<div style={{ height: 16 }} />
<HandleItemContract
activeThemeId={activeThemeId}
handleText='Query'
setActiveTab={setActiveTab}
activeTab={activeTab}
onClickCopy={onClickCopy}
contractAddress={data?.contract_address}
schema={data?.schema?.query}
onHandle={onQuery}
/>
</div>
);
});

export default ReadContract;
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const cx = classNames.bind(styles);
const WriteContract = memo(({ data }) => {
const { address } = useSelector(state => state.wallet);
const history = useHistory();
const [activeTab, setActiveTab] = useState(true);
const [activeTab, setActiveTab] = useState(false);
const activeThemeId = useSelector(state => state.activeThemeId);
const dispatch = useDispatch();
const onClickCopy = msg => {
Expand All @@ -33,7 +33,7 @@ const WriteContract = memo(({ data }) => {
<HeaderContract
icon={<></>}
onClickLink={() => address && history.push(`/account/${address}`)}
label={address ? "" : "Connect to wallet"}
label={address ? "Write Contract Infomation" : "Connect to wallet"}
activeTab={activeTab}
setActiveTab={setActiveTab}
/>
Expand Down

0 comments on commit cb01e88

Please sign in to comment.