Active.tsx 647 B

12345678910111213141516171819202122232425
  1. import React from "react";
  2. import Proposal from "./ProposalOverlay";
  3. import { ProposalDetail } from "../../types";
  4. import Loading from "../Loading";
  5. const ActiveProposals = (props: {
  6. block: number;
  7. proposals: ProposalDetail[];
  8. }) => {
  9. const { block, proposals } = props;
  10. const active = proposals.filter((p) => p && p.stage === "Active");
  11. if (!proposals.length) return <Loading />;
  12. if (!active.length) return <div className="box">No active proposals.</div>;
  13. return (
  14. <div>
  15. {active.map((p, key: number) => (
  16. <Proposal key={key} block={block} {...p} />
  17. ))}
  18. </div>
  19. );
  20. };
  21. export default ActiveProposals;