index.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import React from "react";
  2. import { ListGroup } from "react-bootstrap";
  3. import Loading from "../Loading";
  4. import axios from "axios";
  5. import bounties from "./bounties";
  6. interface iProps {}
  7. class Bounties extends React.Component<iProps> {
  8. constructor(iProps: {}) {
  9. super(iProps);
  10. this.state = { bounties };
  11. }
  12. componentDidMount() {
  13. //this.fetchBounties();
  14. }
  15. async fetchBounties() {
  16. console.log(`Fetching bounties`);
  17. const { data } = await axios.get(`/static/bounties.json`);
  18. console.debug(`bounties`, data);
  19. if (bounties) this.setState({ bounties: data });
  20. }
  21. render() {
  22. const { bounties } = this.state;
  23. if (!bounties.length) <Loading target={`bounties`} />;
  24. return (
  25. <div className="m-2 p-1 bg-light">
  26. <h4>Bounties</h4>
  27. <ListGroup>
  28. {bounties.map((b) => (
  29. <Bounty key={b} bounty={b} />
  30. ))}
  31. <ListGroup.Item>
  32. <a href="https://github.com/Joystream/community-repo/tree/master/workinggroup-reports/bounty_reports">
  33. Reports
  34. </a>
  35. </ListGroup.Item>
  36. <ListGroup.Item>
  37. <a href="https://github.com/Joystream/community-repo/blob/master/bounties-overview/README.md">
  38. Closed Bounties
  39. </a>
  40. </ListGroup.Item>
  41. </ListGroup>
  42. </div>
  43. );
  44. }
  45. }
  46. export default Bounties;
  47. const Bounty = (props: { bounty: string[] }) => {
  48. const [id, title, reward, thread, manager, status] = props.bounty;
  49. return (
  50. <ListGroup.Item className="d-flex flex-row">
  51. <div className="col-2">{id}</div>
  52. <div className="col-4">
  53. <a href={thread}>{title}</a>
  54. </div>
  55. <div className="col-2">{reward}</div>
  56. <div className="col-2">{manager}</div>
  57. <div className="col-2">{status}</div>
  58. </ListGroup.Item>
  59. );
  60. };