Skip to content

Commit

Permalink
Move external call to business tab, #3781 (#4066)
Browse files Browse the repository at this point in the history
* Move external call to business tab, #3781

* Update
  • Loading branch information
hyifeng authored Mar 29, 2024
1 parent 58610b5 commit 104bc86
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
16 changes: 1 addition & 15 deletions packages/next-common/components/collective/call.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useChain } from "next-common/context/chain";
import { useDetailType } from "next-common/context/page";
import Copyable from "../copyable";

export default function CollectiveCall({ call, externalProposals }) {
export default function CollectiveCall({ call }) {
const motion = usePostOnChainData();
const chain = useChain();
const detailType = useDetailType();
Expand All @@ -19,20 +19,6 @@ export default function CollectiveCall({ call, externalProposals }) {
[<Proposal key={"call"} call={call} />],
];

(externalProposals || []).forEach((item) => {
if (!item?.preImage) {
return;
}
data.push([
<Proposal
key={"external-call"}
title="External Call"
call={item.preImage.call}
preImageHash={item.preImage.hash}
/>,
]);
});

if (
Chains.zeitgeist === chain &&
detailPageCategory.ADVISORY_MOTION === detailType
Expand Down
13 changes: 13 additions & 0 deletions packages/next-common/hooks/useCouncilMotionBusinessData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Flex from "next-common/components/styled/flex";
import SymbolBalance from "next-common/components/values/symbolBalance";
import Copyable from "next-common/components/copyable";
import AddressUser from "next-common/components/user/addressUser";
import Proposal from "next-common/components/proposal";

export function useCouncilMotionBusinessData() {
const motion = usePostOnChainData();
Expand Down Expand Up @@ -100,6 +101,18 @@ export function useCouncilMotionBusinessData() {
["Hash", <Copyable key="hash">{external.proposalHash}</Copyable>],
["Threshold", external.voteThreshold],
]);

if (external.preImage) {
business.push([
[
<Proposal
key="call"
call={external.preImage.call}
preImageHash={external.preImage.hash}
/>,
],
]);
}
});
}

Expand Down
5 changes: 1 addition & 4 deletions packages/next/components/motion/motionDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,7 @@ export default function MotionDetail() {
<DetailMultiTabs
call={
post?.onchainData?.proposal && (
<CollectiveCall
call={post.onchainData.proposal}
externalProposals={post.onchainData?.externalProposals}
/>
<CollectiveCall call={post.onchainData.proposal} />
)
}
business={
Expand Down

0 comments on commit 104bc86

Please sign in to comment.