diff --git a/task_yell/src/app/home/page.tsx b/task_yell/src/app/home/page.tsx index 9b766bd..c3317d7 100644 --- a/task_yell/src/app/home/page.tsx +++ b/task_yell/src/app/home/page.tsx @@ -30,6 +30,8 @@ import { Textarea } from "@/components/ui/textarea"; import { signOut } from "@/firebase/auth"; import { auth, db } from "@/firebase/client-app"; import { createEvent, readEvents } from "@/lib/events"; +import { createNotification } from "@/lib/notifications"; +import { subscribeNotification } from "@/lib/push-notification"; import { Category, Priority } from "@/lib/types"; import { createWantTodo, @@ -78,6 +80,7 @@ import { Users, Download, LogOut, + PhoneCall, } from "lucide-react"; import { useRouter } from "next/navigation"; import { useEffect, useMemo, useRef, useState } from "react"; @@ -123,7 +126,7 @@ function EventCreator({ targetDate, events, }: { - onSave: (event: Event) => void; + onSave: (event: Event, notification: { date: Date | null, type: "call" | "push" }) => void; onCancel: () => void; initialTitle?: string; targetDate: Date; @@ -139,6 +142,8 @@ function EventCreator({ const [priority, setPriority] = useState("medium"); const [isTask, setIsTask] = useState(false); const [isLocked, setIsLocked] = useState(false); + const [notificationDate, setNotificationDate] = useState(null); + const [notificationType, setNotificationType] = useState<"call" | "push">("call"); const handleSave = () => { if (targetDate) { @@ -155,7 +160,7 @@ function EventCreator({ isTask, isLocked, }; - onSave(newEvent); + onSave(newEvent, { date: notificationDate, type: notificationType }); } }; @@ -344,6 +349,41 @@ function EventCreator({ /> + {notificationDate && ( + <> +
+ setNotificationDate(date)} + /> +
+
+ { + setNotificationType(checked ? "call" : "push"); + }} + /> + +
+ + )} +
+ { + if (checked) { + setNotificationDate(startTime); + } else { + setNotificationDate(null); + } + }} + /> + +