From 8b0a0bb2196328e2b91562416fd03a8b244efb57 Mon Sep 17 00:00:00 2001 From: Niklas Metje <22395665+niklasmtj@users.noreply.github.com> Date: Sun, 15 Oct 2023 00:21:33 +0200 Subject: [PATCH] refactor: use fresh's partial for `/dashboard` closes #630 Signed-off-by: Niklas Metje <22395665+niklasmtj@users.noreply.github.com> --- routes/dashboard/stats.tsx | 61 ++++++++++++++++++++------------------ routes/dashboard/users.tsx | 7 +++-- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/routes/dashboard/stats.tsx b/routes/dashboard/stats.tsx index e61a40fe6..4c9bce6f1 100644 --- a/routes/dashboard/stats.tsx +++ b/routes/dashboard/stats.tsx @@ -4,6 +4,7 @@ import Head from "@/components/Head.tsx"; import TabsBar from "@/components/TabsBar.tsx"; import { HEADING_WITH_MARGIN_STYLES } from "@/utils/constants.ts"; import { defineRoute } from "$fresh/server.ts"; +import { Partial } from "$fresh/runtime.ts"; function randomNumbers(length: number) { return Array.from({ length }, () => Math.floor(Math.random() * 1000)); @@ -45,7 +46,7 @@ export default defineRoute((_req, ctx) => { return ( <> -
+

Dashboard

{ }]} currentPath={ctx.url.pathname} /> -
- +
+ ({ - ...dataset, - pointRadius: 0, - cubicInterpolationMode: "monotone", - })), - }} - /> -
+ }} + data={{ + labels, + datasets: datasets.map((dataset) => ({ + ...dataset, + pointRadius: 0, + cubicInterpolationMode: "monotone", + })), + }} + /> +
+
); diff --git a/routes/dashboard/users.tsx b/routes/dashboard/users.tsx index 6d4e6f617..9e321514b 100644 --- a/routes/dashboard/users.tsx +++ b/routes/dashboard/users.tsx @@ -4,6 +4,7 @@ import TabsBar from "@/components/TabsBar.tsx"; import { HEADING_WITH_MARGIN_STYLES } from "@/utils/constants.ts"; import UsersTable from "@/islands/UsersTable.tsx"; import { defineRoute } from "$fresh/server.ts"; +import { Partial } from "$fresh/runtime.ts"; export default defineRoute((_req, ctx) => { const endpoint = "/api/users"; @@ -18,7 +19,7 @@ export default defineRoute((_req, ctx) => { rel="preload" /> -
+

Dashboard

{ }]} currentPath={ctx.url.pathname} /> - + + +
);