diff --git a/apps/webapp/app/components/Feedback.tsx b/apps/webapp/app/components/Feedback.tsx index c5e918610d..3c9b389750 100644 --- a/apps/webapp/app/components/Feedback.tsx +++ b/apps/webapp/app/components/Feedback.tsx @@ -1,31 +1,23 @@ import { conform, useForm } from "@conform-to/react"; import { parse } from "@conform-to/zod"; -import { BookOpenIcon } from "@heroicons/react/20/solid"; -import { - CalendarDaysIcon, - ChevronRightIcon, - EnvelopeIcon, - LifebuoyIcon, - LightBulbIcon, -} from "@heroicons/react/24/solid"; +import { EnvelopeIcon, LightBulbIcon } from "@heroicons/react/24/solid"; import { Form, useActionData, useLocation, useNavigation } from "@remix-run/react"; -import { DiscordIcon } from "@trigger.dev/companyicons"; -import { ActivityIcon } from "lucide-react"; -import { type ReactNode, useState } from "react"; +import { type ReactNode, useState, useEffect } from "react"; import { type FeedbackType, feedbackTypeLabel, schema } from "~/routes/resources.feedback"; -import { cn } from "~/utils/cn"; -import { docsTroubleshootingPath } from "~/utils/pathBuilder"; -import { Button, LinkButton } from "./primitives/Buttons"; +import { Button } from "./primitives/Buttons"; +import { Dialog, DialogContent, DialogHeader, DialogTrigger } from "./primitives/Dialog"; import { Fieldset } from "./primitives/Fieldset"; import { FormButtons } from "./primitives/FormButtons"; import { FormError } from "./primitives/FormError"; -import { Header1 } from "./primitives/Headers"; +import { Icon } from "./primitives/Icon"; +import { InfoPanel } from "./primitives/InfoPanel"; import { InputGroup } from "./primitives/InputGroup"; import { Label } from "./primitives/Label"; import { Paragraph } from "./primitives/Paragraph"; import { Select, SelectItem } from "./primitives/Select"; -import { Sheet, SheetBody, SheetContent, SheetTrigger } from "./primitives/Sheet"; import { TextArea } from "./primitives/TextArea"; +import { InformationCircleIcon } from "@heroicons/react/20/solid"; +import { TextLink } from "./primitives/TextLink"; type FeedbackProps = { button: ReactNode; @@ -37,161 +29,111 @@ export function Feedback({ button, defaultValue = "bug" }: FeedbackProps) { const location = useLocation(); const lastSubmission = useActionData(); const navigation = useNavigation(); + const [type, setType] = useState(defaultValue); const [form, { path, feedbackType, message }] = useForm({ id: "accept-invite", - // TODO: type this lastSubmission: lastSubmission as any, onValidate({ formData }) { return parse(formData, { schema }); }, + shouldRevalidate: "onInput", }); - if ( - open && - navigation.formAction === "/resources/feedback" && - form.error === undefined && - form.errors.length === 0 - ) { - setOpen(false); - } + useEffect(() => { + if ( + navigation.formAction === "/resources/feedback" && + navigation.state === "loading" && + form.error === undefined && + form.errors.length === 0 + ) { + setOpen(false); + } + }, [navigation, form]); return ( - - {button} - - - } - to="https://trigger.dev/discord" - className="hover:border-text-link" - > - The quickest way to get answers from the Trigger.dev community. - - } - to="https://cal.com/team/triggerdotdev/founders-call" - className="hover:border-green-500" - > - Have a question or want to chat? Book a time to talk with us. - - } - to="https://feedback.trigger.dev/" - className="hover:border-sun-400" - > - Have an idea for a new feature or improvement? Let us know! - - } - > - - If you're having trouble, check out our troubleshooting guide or the Trigger.dev - Status page. + + {button} + + Contact us +
+
+ + + How can we help? We read every message and will respond as quickly as we can. -
- - Troubleshooting Docs - - - Trigger.dev Status - -
- - } - > - We read every message and respond quickly. -
-
- - - + + {type === "feature" && ( + - {Object.entries(feedbackTypeLabel).map(([name, title]) => ( - - {title} - - ))} - - {feedbackType.error} - - - -