From 5acbcd32516ad2a4d637f36d1ad0a78fd2ab470e Mon Sep 17 00:00:00 2001 From: Niklas <22395665+niklasmtj@users.noreply.github.com> Date: Mon, 16 Oct 2023 22:16:21 +0200 Subject: [PATCH] refactor: use Fresh's partial for `/dashboard` (#633) I put the `` element only around the actual content and not the ``. closes #630. Signed-off-by: Niklas Metje <22395665+niklasmtj@users.noreply.github.com> Co-authored-by: Asher Gomez --- 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} /> - + + +
);