diff --git a/apps/web/app/dashboard/analytics/page.tsx b/apps/web/app/dashboard/analytics/page.tsx
new file mode 100644
index 0000000..a9fa7d3
--- /dev/null
+++ b/apps/web/app/dashboard/analytics/page.tsx
@@ -0,0 +1,9 @@
+import React from "react";
+import AnalyticsView from "@/components/dashboard/analytics/AnalyticsView";
+
+export default async function AnalyticsPage() {
+
+ return (
+
+ );
+}
diff --git a/apps/web/components/dashboard/analytics/AnalyticsView.tsx b/apps/web/components/dashboard/analytics/AnalyticsView.tsx
new file mode 100644
index 0000000..95414a7
--- /dev/null
+++ b/apps/web/components/dashboard/analytics/AnalyticsView.tsx
@@ -0,0 +1,33 @@
+"use client";
+import LoadingSpinner from "@/components/ui/spinner";
+import { api } from "@/lib/trpc";
+
+export default function AnalyticsView() {
+
+ const { data: metrics } = api.metrics.list.useQuery();
+
+ const drugsList = metrics?.filter((metric) => metric.type === "drug");
+ const timeSinceDrug = drugsList?.map((drug) => {
+ console.log(api.measurements.timeSinceLastMeasurement.useQuery({ metricId: drug.id! }));
+ return drug.name;
+ });
+ console.log(timeSinceDrug);
+
+ return (
+
+
Drugs
+
+ {
+ !drugsList ?
:
+
+ {drugsList.map((drug) => (
+ -
+ {drug.name}:
+
+ ))}
+
+ }
+
+
+ );
+}
\ No newline at end of file
diff --git a/apps/web/components/dashboard/sidebar/MobileSidebar.tsx b/apps/web/components/dashboard/sidebar/MobileSidebar.tsx
index 5c4e5f3..dfbfddd 100644
--- a/apps/web/components/dashboard/sidebar/MobileSidebar.tsx
+++ b/apps/web/components/dashboard/sidebar/MobileSidebar.tsx
@@ -12,7 +12,7 @@ export default async function MobileSidebar() {
/>
} path="/dashboard/categories" />
} path="/dashboard/metrics" />
- } path="/analytics" />
+ } path="/dashboard/analytics" />
);
diff --git a/apps/web/components/dashboard/sidebar/Sidebar.tsx b/apps/web/components/dashboard/sidebar/Sidebar.tsx
index 8e60630..7ea8c73 100644
--- a/apps/web/components/dashboard/sidebar/Sidebar.tsx
+++ b/apps/web/components/dashboard/sidebar/Sidebar.tsx
@@ -3,7 +3,7 @@ import SidebarItem from "@/components/shared/sidebar/SidebarItem";
import { Separator } from "@/components/ui/separator";
import { api } from "@/server/api/client";
import { getServerAuthSession } from "@/server/auth";
-import { Archive, ArrowRightFromLine, Calendar, CheckCheck, Gauge, Home, LineChart, PanelLeftOpen, Ruler, Search, SunMoon, Tag } from "lucide-react";
+import { Archive, ArrowRightFromLine, Calendar, CheckCheck, Gauge, GaugeCircleIcon, Home, LineChart, PanelLeftOpen, Ruler, Search, SunMoon, Tag } from "lucide-react";
import serverConfig from "@lifetracker/shared/config";
import AllLists from "./AllLists";
@@ -43,6 +43,11 @@ export default async function Sidebar() {
icon: ,
path: "/dashboard/timeline",
},
+ {
+ name: "Analytics",
+ icon: ,
+ path: "/dashboard/analytics",
+ },
...searchItem,
{
name: "Metrics",
diff --git a/packages/trpc/routers/hours.ts b/packages/trpc/routers/hours.ts
index 4819b93..9c9490b 100644
--- a/packages/trpc/routers/hours.ts
+++ b/packages/trpc/routers/hours.ts
@@ -152,8 +152,7 @@ export const hoursAppRouter = router({
};
if (newProps.comment == "") { newProps.comment = null }
- console.log(input.dayId);
- console.log(input.hourTime);
+
const hourRes = await ctx.db
.update(hours)
.set(newProps)