index.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React from "react";
  2. import { Table} from "react-bootstrap";
  3. import axios from "axios";
  4. import { alternativeBackendApis } from "../../config"
  5. import { Burner } from "../../types";
  6. interface IProps {
  7. }
  8. interface IState {
  9. burners: Burner[]
  10. }
  11. class Burners extends React.Component<IProps, IState> {
  12. constructor(props: IProps) {
  13. super(props);
  14. this.state = {
  15. burners: [] as Burner[]
  16. };
  17. }
  18. componentDidMount() {
  19. const backend = `${alternativeBackendApis}/burners`;
  20. axios.get(backend).then((response) => {this.setState({burners: response.data})});
  21. }
  22. render() {
  23. const { burners } = this.state;
  24. return (
  25. <div className="box">
  26. <h3>Top Token Burners</h3>
  27. <>
  28. { (!burners || burners.length === 0) ? <h4>No records found</h4> :
  29. <Table striped bordered hover size="sm">
  30. <thead>
  31. <tr>
  32. <th>Wallet</th>
  33. <th>Amount Burned</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. {burners.map(brn => (
  38. <tr key={brn.wallet}>
  39. <td>{brn.wallet}</td>
  40. <td>{brn.totalburned}</td>
  41. </tr>
  42. ))}
  43. </tbody>
  44. </Table>
  45. } </>
  46. </div>
  47. );
  48. }
  49. }
  50. export default Burners;