All files / pages AdminDashboardPage.jsx

100% Statements 31/31
100% Branches 1/1
100% Functions 1/1
100% Lines 31/31

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 421x 1x 1x 1x 1x   1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x   1x       1x  
import React from "react";
import { useParams } from "react-router";
import BasicLayout from "main/layouts/BasicLayout/BasicLayout";
import { useBackend } from "main/utils/useBackend";
import CommonStatsCharts from "main/components/Commons/CommonStatsCharts";
 
export default function AdminDashboardPage() {
  const { id } = useParams();
 
  const { data: commonStats } = useBackend(
    [`/api/commonstats/commons?commonsId=${id}`],
    {
      method: "GET",
      url: "/api/commonstats/commons",
      params: {
        commonsId: id,
      },
    },
    [],
  );
 
  const { data: histogramData } = useBackend(
    [`/api/dashboard/histogram/${id}`],
    {
      method: "GET",
      url: `/api/dashboard/histogram/${id}`,
    },
    [],
  );
 
  return (
    <BasicLayout>
      <div className="pt-2">
        <h1>Dashboard</h1>
        <p data-testid="AdminDashboardPage-commonsId">Commons ID: {id}</p>
 
        <CommonStatsCharts data={commonStats} histogramData={histogramData} />
      </div>
    </BasicLayout>
  );
}