zcash-grant-system/frontend/types/proposal.ts

94 lines
2.0 KiB
TypeScript
Raw Normal View History

2018-12-27 09:41:26 -08:00
import { Zat } from 'utils/units';
2018-10-04 21:27:02 -07:00
import { PROPOSAL_CATEGORY } from 'api/constants';
2019-01-09 13:57:15 -08:00
import { CreateMilestone, Update, User, Comment, ContributionWithUser } from 'types';
2018-12-27 09:41:26 -08:00
import { ProposalMilestone } from './milestone';
2018-10-04 21:27:02 -07:00
2018-11-16 08:16:52 -08:00
export interface TeamInvite {
id: number;
dateCreated: number;
address: string;
accepted: boolean | null;
}
2018-10-04 21:27:02 -07:00
export interface Contributor {
address: string;
2018-12-27 09:41:26 -08:00
contributionAmount: Zat;
2018-10-04 21:27:02 -07:00
refundVote: boolean;
refunded: boolean;
proportionalContribution: string;
milestoneNoVotes: boolean[];
}
2018-11-13 08:07:09 -08:00
export interface ProposalDraft {
proposalId: number;
dateCreated: number;
title: string;
brief: string;
category: PROPOSAL_CATEGORY;
content: string;
2018-11-13 08:07:09 -08:00
stage: string;
target: string;
payoutAddress: string;
deadlineDuration: number;
milestones: CreateMilestone[];
team: User[];
2018-11-16 08:16:52 -08:00
invites: TeamInvite[];
status: STATUS;
2018-11-13 08:07:09 -08:00
}
2018-12-27 09:41:26 -08:00
export interface Proposal extends Omit<ProposalDraft, 'target' | 'invites'> {
proposalAddress: string;
proposalUrlId: string;
target: Zat;
funded: Zat;
percentFunded: number;
contributionMatching: number;
2018-10-04 21:27:02 -07:00
milestones: ProposalMilestone[];
datePublished: number;
2018-10-04 21:27:02 -07:00
}
2018-11-16 11:17:09 -08:00
export interface TeamInviteWithProposal extends TeamInvite {
proposal: Proposal;
}
2018-10-04 21:27:02 -07:00
export interface ProposalComments {
proposalId: Proposal['proposalId'];
2018-10-04 21:27:02 -07:00
totalComments: number;
comments: Comment[];
}
export interface ProposalUpdates {
proposalId: Proposal['proposalId'];
2018-10-04 21:27:02 -07:00
updates: Update[];
}
2019-01-09 12:48:41 -08:00
export interface ProposalContributions {
proposalId: Proposal['proposalId'];
top: ContributionWithUser[];
latest: ContributionWithUser[];
}
2018-10-04 21:27:02 -07:00
export interface UserProposal {
proposalId: number;
status: STATUS;
2018-10-04 21:27:02 -07:00
title: string;
brief: string;
funded: Zat;
target: Zat;
dateCreated: number;
dateApproved: number;
datePublished: number;
team: User[];
rejectReason: string;
}
// NOTE: sync with backend/grant/proposal/models.py STATUSES
export enum STATUS {
DRAFT = 'DRAFT',
PENDING = 'PENDING',
APPROVED = 'APPROVED',
REJECTED = 'REJECTED',
LIVE = 'LIVE',
DELETED = 'DELETED',
2018-10-04 21:27:02 -07:00
}