Show all council motions (#3510)

* Show all council motions

* Update packages/page-calendar/src/useScheduled.ts
This commit is contained in:
Jaco Greeff 2020-08-25 13:15:03 +02:00 committed by GitHub
parent 82db2b06bb
commit c8b3b44156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,8 +46,8 @@ function createConstDurations (bestNumber: BlockNumber, blockTime: number, items
}
function createCouncilMotions (bestNumber: BlockNumber, blockTime: number, motions: DeriveCollectiveProposal[]): [EntryType, EntryInfo[]][] {
return motions
.map(({ hash, votes }): [EntryType, EntryInfo[]] | null => {
return [['councilMotion', motions
.map(({ hash, votes }): EntryInfo | null => {
if (!votes) {
return null;
}
@ -55,15 +55,16 @@ function createCouncilMotions (bestNumber: BlockNumber, blockTime: number, motio
const hashStr = hash.toHex();
const blocks = votes.end.sub(bestNumber);
return ['councilMotion', [{
return {
...newDate(blocks, blockTime),
blockNumber: votes.end,
blocks,
info: `${hashStr.substr(0, 6)}…${hashStr.substr(-4)}`,
type: 'councilMotion'
}]];
};
})
.filter((item): item is [EntryType, EntryInfo[]] => !!item);
.filter((item): item is EntryInfo => !!item)
]];
}
function createDispatches (bestNumber: BlockNumber, blockTime: number, dispatches: DeriveDispatch[]): [EntryType, EntryInfo[]][] {