Browse Source

Build errors etc

Leszek Wiesner 4 years ago
parent
commit
9f2269d5ec

+ 1 - 1
packages/joy-proposals/src/Proposal/VotingSection.tsx

@@ -87,7 +87,7 @@ export default function VotingSection({
     <>
       <Header as="h3">Sumbit your vote</Header>
       <Divider />
-      { voteKinds.map((voteKind) =>
+      { VoteKinds.map((voteKind) =>
         <VoteButton
           voteKind={voteKind}
           memberId={memberId}

+ 36 - 0
packages/joy-proposals/src/stories/data/ProposalTypesInfo.mock.ts

@@ -14,6 +14,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 0,
     gracePeriod: 0,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
   {
     type: "Spending",
@@ -27,6 +31,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 5,
     gracePeriod: 3,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
   {
     type: "RuntimeUpgrade",
@@ -40,6 +48,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 10,
     gracePeriod: 14,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
   {
     type: "EvictStorageProvider",
@@ -53,6 +65,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 10,
     gracePeriod: 1,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
   {
     type: "SetStorageRoleParameters",
@@ -66,6 +82,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 60,
     gracePeriod: 14,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
   {
     type: "SetValidatorCount",
@@ -79,6 +99,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 10,
     gracePeriod: 5,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
   {
     type: "SetContentWorkingGroupMintCapacity",
@@ -92,6 +116,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 8,
     gracePeriod: 5,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
   {
     type: "SetLead",
@@ -105,6 +133,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 50,
     gracePeriod: 7,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
   {
     type: "SetElectionParameters",
@@ -118,6 +150,10 @@ const MockProposalTypesInfo: ProposalTypeInfo[] = [
     cancellationFee: 100,
     gracePeriod: 30,
     votingPeriod: 10000,
+    approvalQuorum: 80,
+    approvalThreshold: 80,
+    slashingQuorum: 80,
+    slashingThreshold: 80,
   },
 ];
 

+ 11 - 1
packages/joy-proposals/src/utils.ts

@@ -4,6 +4,16 @@ import { Category } from "./Proposal/ChooseProposalType";
 import { useTransport, ParsedProposal, ProposalVote } from "./runtime";
 import { ProposalId } from "@joystream/types/proposals";
 
+type ProposalMeta = {
+  description: string;
+  category: Category;
+  image: string;
+  approvalQuorum: number;
+  approvalThreshold: number;
+  slashingQuorum: number;
+  slashingThreshold: number;
+}
+
 export function includeKeys<T extends { [k: string]: any }>(obj: T, ...allowedKeys: string[]) {
   return Object.keys(obj).filter(objKey => {
     return allowedKeys.reduce(
@@ -154,7 +164,7 @@ export function calculateStake(type: ProposalType, issuance: number) {
   return stake;
 }
 
-export function calculateMetaFromType(type: ProposalType) {
+export function calculateMetaFromType(type: ProposalType): ProposalMeta {
   const image = "";
   switch (type) {
     case "EvictStorageProvider": {