"use client"; import type { ChangeEvent, ComponentType } from "react"; import Image from "next/image"; import { Bug, Check, CheckCircle2, CreditCard, ImagePlus, Lightbulb, MessageCircleMore, Send, Trash2, } from "lucide-react"; import { BackButton } from "@/app/_components"; import { MobileShell } from "@/app/_components/core"; import type { FeedbackCategory } from "@/data/schemas/feedback"; import { resolveGlobalRouteContext, type GlobalReturnToValue, } from "@/router/global-route-context"; import { useGlobalAppNavigator } from "@/router/use-global-app-navigator"; import { FEEDBACK_IMAGE_ACCEPT, FEEDBACK_IMAGE_LIMIT, } from "./feedback-image"; import { FEEDBACK_CONTENT_MIN_LENGTH, FEEDBACK_CONTENT_MAX_LENGTH, useFeedbackSubmission, } from "./use-feedback-submission"; import styles from "./feedback-screen.module.css"; interface CategoryOption { value: FeedbackCategory; label: string; icon: ComponentType<{ size?: number; strokeWidth?: number }>; } const CATEGORY_OPTIONS: readonly CategoryOption[] = [ { value: "problem", label: "Problem", icon: Bug }, { value: "suggestion", label: "Suggestion", icon: Lightbulb }, { value: "payment", label: "Payment", icon: CreditCard }, { value: "other", label: "Other", icon: MessageCircleMore }, ]; export interface FeedbackScreenProps { returnTo?: GlobalReturnToValue; } export function FeedbackScreen({ returnTo }: FeedbackScreenProps) { const navigator = useGlobalAppNavigator(); const navigation = resolveGlobalRouteContext(returnTo); const form = useFeedbackSubmission(); if (form.feedbackId) { return (
); } const handleImageChange = (event: ChangeEvent) => { if (event.target.files) void form.addImages(event.target.files); event.target.value = ""; }; return (