From cf07175efc52f822d0d32cb21536e16b339deb91 Mon Sep 17 00:00:00 2001 From: elizielx Date: Sat, 2 Mar 2024 18:15:39 +0800 Subject: [PATCH] fix(app): area charts for trash and report #35 #36 --- apps/app/src/locales/en.json | 6 +- apps/app/src/locales/id.json | 6 +- apps/app/src/pages/operator/dashboard.tsx | 24 +++---- libs/components/src/charts/total-report.tsx | 70 +++++++++++++++++++++ libs/components/src/charts/total-trash.tsx | 70 +++++++++++++++++++++ libs/components/src/index.ts | 3 + 6 files changed, 162 insertions(+), 17 deletions(-) create mode 100644 libs/components/src/charts/total-report.tsx create mode 100644 libs/components/src/charts/total-trash.tsx diff --git a/apps/app/src/locales/en.json b/apps/app/src/locales/en.json index 7b96d1e..946d303 100644 --- a/apps/app/src/locales/en.json +++ b/apps/app/src/locales/en.json @@ -86,7 +86,11 @@ }, "dashboard": { "login": "Back to Login", - "home": "Back to Home" + "home": "Back to Home", + "chart": { + "total_trash": "Total Trash", + "total_report": "Total Report" + } }, "user": { "subtitle": "User", diff --git a/apps/app/src/locales/id.json b/apps/app/src/locales/id.json index 4527b4e..f6fee18 100644 --- a/apps/app/src/locales/id.json +++ b/apps/app/src/locales/id.json @@ -86,7 +86,11 @@ }, "dashboard": { "login": "Kembali ke Login", - "home": "Kembali ke Home" + "home": "Kembali ke Home", + "chart": { + "total_trash": "Total Sampah", + "total_report": "Total Laporan" + } }, "user": { "subtitle": "Pengguna", diff --git a/apps/app/src/pages/operator/dashboard.tsx b/apps/app/src/pages/operator/dashboard.tsx index 51afa0a..d5d288b 100644 --- a/apps/app/src/pages/operator/dashboard.tsx +++ b/apps/app/src/pages/operator/dashboard.tsx @@ -1,14 +1,15 @@ import { IonContent, IonPage } from "@ionic/react"; -import { Card, CardContent, Button, ChartExample } from "@trashtrack/ui"; +import { Card, CardContent, Button, AreaChartTotalTrash, AreaChartTotalReport } from "@trashtrack/ui"; import { OperatorContext } from "@trashtrack/ui"; import { t } from "i18next"; import { useContext } from "react"; +import { useTranslation } from "react-i18next"; import { useHistory } from "react-router-dom"; -import { Chart } from "react-google-charts"; export function OperatorDashboard() { const history = useHistory(); const operator = useContext(OperatorContext); + const { t } = useTranslation(); return ( @@ -20,24 +21,17 @@ export function OperatorDashboard() {
- +

{t("operator.dashboard.chart.total_report")}

+
- - + +

{t("operator.dashboard.chart.total_trash")}

+
+