Proposals.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import React from "react";
  2. import { Link } from "react-router-dom";
  3. import { RefreshCw } from "react-feather";
  4. import { ProposalTable } from "..";
  5. import {
  6. AppBar,
  7. createStyles,
  8. Grid,
  9. makeStyles,
  10. Paper,
  11. Theme,
  12. Toolbar,
  13. Typography,
  14. } from "@material-ui/core";
  15. import { Council, Member, ProposalDetail, Post } from "../../types";
  16. const useStyles = makeStyles((theme: Theme) =>
  17. createStyles({
  18. root: {
  19. flexGrow: 1,
  20. backgroundColor: "#4038FF",
  21. },
  22. title: {
  23. textAlign: "left",
  24. flexGrow: 1,
  25. },
  26. })
  27. );
  28. const Proposals = (props: {
  29. proposals: ProposalDetail[];
  30. validators: string[];
  31. councils: Council[];
  32. members: Member[];
  33. posts: Post[];
  34. startTime: number;
  35. block: number;
  36. status: { council: Council };
  37. }) => {
  38. const {
  39. proposals,
  40. validators,
  41. councils,
  42. members,
  43. posts,
  44. block,
  45. status,
  46. } = props;
  47. const classes = useStyles();
  48. const pending = proposals.filter((p) => p && p.result === "Pending");
  49. return (
  50. <Grid
  51. style={{
  52. textAlign: "center",
  53. backgroundColor: "#000",
  54. color: "#fff",
  55. }}
  56. item
  57. lg={6}
  58. >
  59. <Paper
  60. style={{
  61. textAlign: "center",
  62. backgroundColor: "#4038FF",
  63. color: "#fff",
  64. minHeight: 500,
  65. maxHeight: 500,
  66. overflow: "auto",
  67. }}
  68. >
  69. <AppBar className={classes.root} position="static">
  70. <Toolbar>
  71. <Typography variant="h6" className={classes.title}>
  72. Active Proposals: {pending.length}
  73. <RefreshCw className="ml-2" onClick={props.fetchProposals} />
  74. </Typography>
  75. <Link className="m-3 text-light" to={"/proposals"}>
  76. All
  77. </Link>
  78. <Link className="m-3 text-light" to={"/spending"}>
  79. Spending
  80. </Link>
  81. <Link className="m-3 text-light" to={"/councils"}>
  82. Votes
  83. </Link>
  84. </Toolbar>
  85. </AppBar>
  86. <ProposalTable
  87. block={block}
  88. hideNav={true}
  89. proposals={pending}
  90. members={members}
  91. council={status.council}
  92. councils={councils}
  93. posts={posts}
  94. status={status}
  95. validators={validators}
  96. />
  97. </Paper>
  98. </Grid>
  99. );
  100. };
  101. export default Proposals;