diff --git a/apps/web/app/dashboard/timeline/[view]/page.tsx b/apps/web/app/dashboard/timeline/[view]/page.tsx
new file mode 100644
index 0000000..872942e
--- /dev/null
+++ b/apps/web/app/dashboard/timeline/[view]/page.tsx
@@ -0,0 +1,76 @@
+import { ZHour } from "@lifetracker/shared/types/days";
+import React from "react";
+import spacetime from "spacetime";
+import { api } from "@/server/api/client";
+import { EditableHourCode } from "@/components/dashboard/hours/EditableHourCode";
+import { useUpdateHour } from "@lifetracker/shared-react/hooks/days";
+import { useToast } from "@/components/ui/use-toast";
+import { getHourFromTime } from "@lifetracker/shared/utils/hours";
+
+async function fetchDays(view: string, dateQuery: string) {
+ const timezone = await api.users.getTimezone();
+
+ const today = spacetime(dateQuery ?? "today");
+ const firstDay = today.subtract(3, "day").last("week").startOf("week");
+
+ const days = [];
+ for (let i = 0; i < 20; i++) {
+ const dayDate = firstDay.add(i, "day").format("iso-short");
+ console.log(dayDate);
+ const dayRes = await api.days.get({
+ dateQuery: dayDate,
+ timezone: timezone,
+ });
+ days.push(dayRes);
+ }
+
+ return days;
+}
+
+export default async function TimelinePage({ params }: { params: { view: string, dateQuery: string }; }) {
+ const { view = "month", dateQuery } = await params;
+ const days = await fetchDays(view, dateQuery);
+
+ return (
+ <>
+
+
Date
+ {Array.from({ length: 24 }, (_, i) => (
+
+ {getHourFromTime(i, "twelves")}
+
+ ))}
+
+ {days.map((day, index) => (
+
+
+ {spacetime(day.date).format("{iso-month}/{date-pad}")}
+
+ {day.hours.map((hour, i) => (
+
+ //
+ // {hour.categoryCode ?? "_"}
+ //
+ ))}
+
+
+ ))}
+ >
+ );
+}
\ No newline at end of file
diff --git a/apps/web/components/dashboard/sidebar/Sidebar.tsx b/apps/web/components/dashboard/sidebar/Sidebar.tsx
index 093d119..786b020 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, Home, Search, Tag } from "lucide-react";
+import { Archive, Calendar, Home, Search, Tag } from "lucide-react";
import serverConfig from "@lifetracker/shared/config";
import AllLists from "./AllLists";
@@ -33,10 +33,15 @@ export default async function Sidebar() {
path: string;
}[] = [
{
- name: "Home",
+ name: "Day View",
icon: ,
path: "/dashboard/day/today",
},
+ {
+ name: "Month View",
+ icon: ,
+ path: "/dashboard/timeline/month",
+ },
...searchItem,
{
name: "Categories",
diff --git a/apps/web/components/dashboard/timelines/MonthView.tsx b/apps/web/components/dashboard/timelines/MonthView.tsx
new file mode 100644
index 0000000..f0c6acf
--- /dev/null
+++ b/apps/web/components/dashboard/timelines/MonthView.tsx
@@ -0,0 +1,57 @@
+import { redirect } from "next/navigation";
+import { Separator } from "@/components/ui/separator";
+import { getServerAuthSession } from "@/server/auth";
+import { ZDay } from "@lifetracker/shared/types/days";
+import EditableDayComment from "./EditableDayComment";
+import { MoodStars } from "./MoodStars";
+import Link from "next/link";
+import { cn } from "@/lib/utils";
+import { ArrowLeftSquare, ArrowRightSquare } from "lucide-react";
+import spacetime from "spacetime";
+import EditableHour from "@/components/dashboard/hours/EditableHour";
+
+export default async function MonthView({
+ dateRange,
+}: {
+ dateRange: string[];
+}) {
+ const session = await getServerAuthSession();
+ if (!session) {
+ redirect("/");
+ }
+
+
+ return (
+
+
+
+
+
+
+
+ {spacetime().format("{day}, {month} {date}, {year}")}
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/apps/web/components/shared/sidebar/SidebarItem.tsx b/apps/web/components/shared/sidebar/SidebarItem.tsx
index 83ce776..81c4cdf 100644
--- a/apps/web/components/shared/sidebar/SidebarItem.tsx
+++ b/apps/web/components/shared/sidebar/SidebarItem.tsx
@@ -24,12 +24,13 @@ export default function SidebarItem({
right?: React.ReactNode;
collapseButton?: React.ReactNode;
}) {
- const currentPath = usePathname();
+ const currentPath = usePathname().split("/").slice(0, 3).join("/");
+ // console.log(currentPath);
return (