I dont' want to commit this
This commit is contained in:
parent
bbe612ae43
commit
86c88307df
9
apps/web/app/dashboard/analytics/page.tsx
Normal file
9
apps/web/app/dashboard/analytics/page.tsx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import React from "react";
|
||||||
|
import AnalyticsView from "@/components/dashboard/analytics/AnalyticsView";
|
||||||
|
|
||||||
|
export default async function AnalyticsPage() {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AnalyticsView />
|
||||||
|
);
|
||||||
|
}
|
||||||
33
apps/web/components/dashboard/analytics/AnalyticsView.tsx
Normal file
33
apps/web/components/dashboard/analytics/AnalyticsView.tsx
Normal file
@ -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 (
|
||||||
|
<div className="flex gap-4">
|
||||||
|
<h1 className="font-bold text-xl">Drugs</h1>
|
||||||
|
<div>
|
||||||
|
{
|
||||||
|
!drugsList ? <LoadingSpinner /> :
|
||||||
|
<ul>
|
||||||
|
{drugsList.map((drug) => (
|
||||||
|
<li key={drug.id}>
|
||||||
|
{drug.name}:
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -12,7 +12,7 @@ export default async function MobileSidebar() {
|
|||||||
/>
|
/>
|
||||||
<MobileSidebarItem logo={<Tag />} path="/dashboard/categories" />
|
<MobileSidebarItem logo={<Tag />} path="/dashboard/categories" />
|
||||||
<MobileSidebarItem logo={<CheckCheck />} path="/dashboard/metrics" />
|
<MobileSidebarItem logo={<CheckCheck />} path="/dashboard/metrics" />
|
||||||
<MobileSidebarItem logo={<GaugeCircleIcon />} path="/analytics" />
|
<MobileSidebarItem logo={<GaugeCircleIcon />} path="/dashboard/analytics" />
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import SidebarItem from "@/components/shared/sidebar/SidebarItem";
|
|||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { api } from "@/server/api/client";
|
import { api } from "@/server/api/client";
|
||||||
import { getServerAuthSession } from "@/server/auth";
|
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 serverConfig from "@lifetracker/shared/config";
|
||||||
|
|
||||||
import AllLists from "./AllLists";
|
import AllLists from "./AllLists";
|
||||||
@ -43,6 +43,11 @@ export default async function Sidebar() {
|
|||||||
icon: <Calendar size={18} />,
|
icon: <Calendar size={18} />,
|
||||||
path: "/dashboard/timeline",
|
path: "/dashboard/timeline",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Analytics",
|
||||||
|
icon: <GaugeCircleIcon size={18} />,
|
||||||
|
path: "/dashboard/analytics",
|
||||||
|
},
|
||||||
...searchItem,
|
...searchItem,
|
||||||
{
|
{
|
||||||
name: "Metrics",
|
name: "Metrics",
|
||||||
|
|||||||
@ -152,8 +152,7 @@ export const hoursAppRouter = router({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (newProps.comment == "") { newProps.comment = null }
|
if (newProps.comment == "") { newProps.comment = null }
|
||||||
console.log(input.dayId);
|
|
||||||
console.log(input.hourTime);
|
|
||||||
const hourRes = await ctx.db
|
const hourRes = await ctx.db
|
||||||
.update(hours)
|
.update(hours)
|
||||||
.set(newProps)
|
.set(newProps)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user