-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMatrixReport.tsx
More file actions
64 lines (56 loc) · 2.14 KB
/
MatrixReport.tsx
File metadata and controls
64 lines (56 loc) · 2.14 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"use client";
import { myArticleMatrix } from "@/backend/services/dashboard.action";
import { Card, CardContent } from "@/components/ui/card";
import { useTranslation } from "@/i18n/use-translation";
import { useQuery } from "@tanstack/react-query";
import { LoaderIcon } from "lucide-react";
import React, { useEffect } from "react";
const MatrixReport = () => {
const { _t } = useTranslation();
const query = useQuery({
queryKey: ["dashboard-matrix-report"],
queryFn: () => myArticleMatrix(),
});
return (
<div className="my-6">
<h3 className="text-lg font-semibold">{_t("Stats")}</h3>
<div className="mt-4 grid grid-col-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
<Card className="rounded">
<CardContent className="flex flex-col gap-2">
<p className="text-3xl font-semibold h-9">
{query.isFetching && (
<LoaderIcon className="animate-spin size-8 text-muted-foreground" suppressHydrationWarning />
)}
{query.data?.total_articles}
</p>
<div className="text-md text-muted-foreground font-semibold">
{_t("Total articles")}
</div>
</CardContent>
</Card>
<Card className="rounded">
<CardContent className="flex flex-col gap-2">
<p className="text-3xl font-semibold h-9">
{query.isFetching && (
<LoaderIcon className="animate-spin size-8 text-muted-foreground" suppressHydrationWarning />
)}
{query.data?.total_comments}
</p>
<div className="text-md text-muted-foreground font-semibold">
{_t("Total post comments")}
</div>
</CardContent>
</Card>
{/* <Card className="rounded">
<CardContent className="flex flex-col gap-2">
<p className="text-3xl font-semibold">1334</p>
<div className="text-md text-muted-foreground font-semibold">
{_t("Total post reactions")}
</div>
</CardContent>
</Card> */}
</div>
</div>
);
};
export default MatrixReport;