Skip to content

Commit

Permalink
proposal grace period added
Browse files Browse the repository at this point in the history
  • Loading branch information
vrrayz committed Jul 16, 2023
1 parent 2f4d5ca commit 7388137
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/ui/src/app/pages/Proposals/ProposalPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ export const ProposalPreview = () => {
{/* Proposal-specific dashboard */}
<h3>{camelCaseToText(proposal.type)}</h3>

<ProposalDetails proposalDetails={proposal.details} />
<ProposalDetails
proposalDetails={proposal.details}
gracePeriod={constants?.gracePeriod}
exactExecutionBlock={proposal.exactExecutionBlock}
/>

<RationalePreview rationale={proposal.rationale} />
<ProposalDiscussions thread={proposal.discussionThread} proposalId={id} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {

interface Props {
proposalDetails?: ProposalWithDetails['details']
gracePeriod?: number
exactExecutionBlock?: number
}

export interface ProposalDetailContent {
Expand All @@ -51,7 +53,7 @@ const renderTypeMapper: Partial<Record<RenderType, ProposalDetailContent>> = {
Hash: Hash,
}

export const ProposalDetails = ({ proposalDetails }: Props) => {
export const ProposalDetails = ({ proposalDetails, gracePeriod, exactExecutionBlock }: Props) => {
const { api } = useApi()
const { budget } = useCouncilStatistics()
const { group } = useWorkingGroup({ name: (proposalDetails as UpdateGroupBudgetDetails)?.group?.id })
Expand All @@ -68,6 +70,24 @@ export const ProposalDetails = ({ proposalDetails }: Props) => {
const detailsRenderStructure = useMemo(() => getDetailsRenderStructure(proposalDetails), [proposalDetails])

const additionalDetails = useMemo(() => {
if (gracePeriod) {
return [
{
renderType: 'NumberOfBlocks',
label: 'Gracing Period',
value: gracePeriod,
},
] as RenderNode[]
}
if (exactExecutionBlock) {
return [
{
renderType: 'NumberOfBlocks',
label: 'Exact Execution Block',
value: exactExecutionBlock,
},
] as RenderNode[]
}
if (proposalDetails?.type === 'setReferralCut') {
return [
{
Expand Down

0 comments on commit 7388137

Please sign in to comment.