tracking-code-which-will-go-to-the-HEAD FLAMEAL Documentation client/src/components/TopContributors/TopContLoaded.js

Source

client/src/components/TopContributors/TopContLoaded.js

  1. import React from "react";
  2. import ReactSpeedometer from "react-d3-speedometer";
  3. import Leaderboard from "../Leaderboard/Leaderboard";
  4. import TopContLoading from "./TopContLoading";
  5. /**
  6. * The component to display the top contributors in the network by displaying
  7. * the leaderboard and the gauge for top contributors in the last month
  8. * @category Top Contributors
  9. * @component
  10. * @borrows {@link TopContLoading} as a child component to display the loading animation if the data was not fetched
  11. * @borrows {@link Leaderboard} as a child component to display the leaderboard of top contributors
  12. * @param {Number} cont - the number of contributors this month
  13. * @returns {ReactComponent} the component holding the leaderboard and the gauge or the loading component if the data is not fetched yet
  14. */
  15. const TopContLoaded = ({ cont }) => {
  16. //if the data is not fetched yet, display the loading animation
  17. return !cont ? (
  18. <TopContLoading />
  19. ) : (
  20. <>
  21. <div className="tc-container">
  22. <div className="tc-container-lead">
  23. <Leaderboard />
  24. </div>
  25. <div className="tc-container-gauge">
  26. <h1 className={"title-gauge"}>Total contributors this month</h1>
  27. <div className="tc-gauge">
  28. <ReactSpeedometer
  29. fluidWidth={true}
  30. fluidHeight={true}
  31. minValue={0}
  32. maxValue={10}
  33. segments={1}
  34. ringWidth={70}
  35. segmentColors={["#0083F9"]}
  36. currentValueText="${value} contributors"
  37. value={cont}
  38. textColor={"#fff"}
  39. needleTransition="easeElastic"
  40. needleColor="white"
  41. needleHeightRatio={0.8}
  42. needleTransitionDuration={2000}
  43. />
  44. </div>
  45. </div>
  46. </div>
  47. </>
  48. );
  49. };
  50. export default TopContLoaded;