Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move external call to business tab, #3781 #4066

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading