import React from "react"; import { Button } from "react-bootstrap"; import { Vote } from "../types"; export const voteKeys: { [key: string]: string } = { abstensions: "Abstain", approvals: "Approve", rejections: "Reject", slashes: "Slash", }; export const voteStyles: { [key: string]: string } = { Abstain: "secondary", Approve: "success", Reject: "danger", Slash: "warning", "": "body", }; export const VoteButton = (props: { handle: string; vote: string }) => { const { handle, vote } = props; return ( ); }; // Vote! export const VoteNowButton = (props: { show: boolean; url: string }) => { const { show, url } = props; if (!show) return
; return ( ); }; // Bubbles const VoteBubble = (props: { detailed?: boolean; vote: Vote; count: number; }) => { const { detailed, vote } = props; if (!vote.member) return
; const handle = vote.member.handle; return ( ); }; export const VotesBubbles = (props: { detailed?: boolean; votes: Vote[] }) => { const votes = props.votes.reduce( (uniq, vote) => uniq.find((v) => v.member.handle === vote.member.handle) ? uniq : uniq.concat(vote), [] ); return ( <> {votes.map((vote: Vote) => ( ))} ); }; // Tooltip //interface IProps { // votes: VotingResults; // votesByAccount?: Vote[]; //} // TODO Property 'votes' does not exist on type 'IntrinsicAttributes & IProps' // https://stackoverflow.com/questions/59969756/not-assignable-to-type-intrinsicattributes-intrinsicclassattributes-react-js export const VotesTooltip = (props: any) => { const { votes } = props; if (!votes) return (
); if (!votes.length) return
No votes were cast.
; return (
{votes.map((vote: Vote) => ( ))}
); };