diff --git a/apps/web/components/dashboard/hours/EditableHour.tsx b/apps/web/components/dashboard/hours/EditableHour.tsx
index 7b4cf7e..14de2bf 100644
--- a/apps/web/components/dashboard/hours/EditableHour.tsx
+++ b/apps/web/components/dashboard/hours/EditableHour.tsx
@@ -10,7 +10,7 @@ import { EditableText } from "@/components/dashboard/EditableText";
import { format } from "date-fns";
import { TZDate } from "@date-fns/tz";
import { ZHour } from "@lifetracker/shared/types/days";
-import { MessageCircle } from "lucide-react";
+import { MessageCircle, Pencil } from "lucide-react";
import { ButtonWithTooltip } from "@/components/ui/button";
import { EditableHourCode } from "./EditableHourCode";
import { EditableHourComment } from "./EditableHourComment";
@@ -27,22 +27,23 @@ export default function EditableHour({
i: number,
className?: string;
}) {
- const router = useRouter();
- const currentPath = usePathname();
const [hour, setHour] = useState(initialHour);
const { mutate: updateHour, isPending } = useUpdateHour({
onSuccess: (res, req, meta) => {
const { categoryCode: oldCode, comment: oldComment } = hour;
const newHour = {
- categoryCode: req.code,
+ categoryCode: parseInt(req.code!),
comment: oldComment,
...res,
};
console.log(res);
setHour(newHour);
- toast({
- description: "Hour updated!",
- });
+ // Only show toast if client screen is larger than mobile
+ if (window.innerWidth > 640) {
+ toast({
+ description: "Hour updated!",
+ });
+ }
},
});
const tzOffset = spacetime().offset() / 60;
@@ -64,28 +65,29 @@ export default function EditableHour({
}
return (
640 ? "50px 100px 1fr 50px" : "50px 100px 1fr", // Known issue: This won't work if the screen is resized, only on reload
}}
>
- {isActiveHour(hour) && "--> "}
+ {/* {isActiveHour(hour) && "--> "} */}
{hour.datetime}
-
+
-
+
+
+ {hour.categoryName}
+
+
+
{
console.log("Pushed edit")
}}
>
-
+
diff --git a/apps/web/components/dashboard/hours/EditableHourCode.tsx b/apps/web/components/dashboard/hours/EditableHourCode.tsx
index 77436b9..1791f2a 100644
--- a/apps/web/components/dashboard/hours/EditableHourCode.tsx
+++ b/apps/web/components/dashboard/hours/EditableHourCode.tsx
@@ -1,8 +1,10 @@
"use client";
-import { or } from "drizzle-orm";
import { useEffect, useRef } from "react";
+import {
+ cn
+} from "@/lib/utils";
function selectHourCode(time: number) {
document.getElementById("hour-" + (time).toString())?.getElementsByClassName("edit-hour-code")[0].focus();
}
@@ -11,6 +13,7 @@ function selectHourComment(time: number) {
}
export function EditableHourCode({
+ className = "",
originalText,
hour,
onSubmit,
@@ -50,6 +53,7 @@ export function EditableHourCode({
dayId: hour.dayId,
code: newCode ?? "",
comment: hour.comment,
+ i: i
})
selectHourCode(i + 1);
};
@@ -62,7 +66,7 @@ export function EditableHourCode({