diff --git a/src/components/ChapterFeedback.tsx b/src/components/ChapterFeedback.tsx index 3757b23..ef5249f 100644 --- a/src/components/ChapterFeedback.tsx +++ b/src/components/ChapterFeedback.tsx @@ -1,4 +1,5 @@ import { useEffect, useState } from "react"; +import { useUser } from "../user-context"; const ratings = [ { value: 0, emoji: "😭" }, @@ -8,7 +9,9 @@ const ratings = [ ] function ChapterFeedback({ chapter }: { chapter: string }) { + const { user } = useUser(); const [rating, setRating] = useState(undefined); + const [anonymous, setAnonymous] = useState(false); const [feedback, setFeedback] = useState(""); const [feedbackStatus, setFeedbackStatus] = useState<"unsent" | "sending" | "sent">("unsent") function handleRatingClick(v: number) { @@ -33,6 +36,7 @@ function ChapterFeedback({ chapter }: { chapter: string }) { chapter, feedback, rating, + anonymous, }; setFeedbackStatus("sending"); fetch("https://account.lingdocs.com/feedback", { @@ -85,23 +89,42 @@ function ChapterFeedback({ chapter }: { chapter: string }) { {rating !== undefined &&
- +