"use client"; import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@/components/ui/command"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; // import { trpc } from "@/lib/trpc/client"; import { zodResolver } from "@hookform/resolvers/zod"; import { BookOpen, LucideIcon, MessagesSquare } from "lucide-react"; import { useRouter } from "next/navigation"; import React, { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { Button } from "../ui/button"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "../ui/form"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select"; import { Textarea } from "../ui/textarea"; import { toast } from "../ui/toaster"; import { Loading } from "./loading"; export function CommandMenu() { const [open, setOpen] = React.useState(false); React.useEffect(() => { const down = (e: KeyboardEvent) => { if (e.key === "k" && (e.metaKey || e.ctrlKey)) { e.preventDefault(); setOpen((open) => !open); } }; document.addEventListener("keydown", down); return () => document.removeEventListener("keydown", down); }, []); return ( No results found. setOpen(false)} href="/docs" label="Documentation" icon={BookOpen} /> ); } const DiscordCommand: React.FC = () => { const router = useRouter(); return ( router.push("/discord")}> Go to Discord ); }; const GenericLinkCommand: React.FC<{ href: string; label: string; icon: LucideIcon; close: () => void; }> = (props) => { const router = useRouter(); return ( { router.push(props.href); props.close(); }} > {props.label} ); }; const Feedback: React.FC = () => { const [open, setOpen] = useState(false); /** * This was necessary cause otherwise the dialog would not close when you're clicking outside of it */ const [selected, setSelected] = useState(false); useEffect(() => { if (selected) { setOpen(true); } }, [selected]); const schema = z.object({ severity: z.enum(["p0", "p1", "p2", "p3"]), issueType: z.enum(["bug", "feature", "security", "payment", "question"]), message: z.string(), }); const form = useForm>({ resolver: zodResolver(schema), defaultValues: { severity: "p2", issueType: "bug", message: "", }, }); // const create = trpc.plain.createIssue.useMutation({ // onSuccess: () => { // setOpen(false); // toast("Your issue has been created, we'll get back to you as soon as possible"); // }, // onError: (err) => { // toast.error("Issue creation failed", { // description: err.message, // }); // }, // }); return ( { setSelected(true); }} > Feedback
Report an issue What went wrong or how can we improve?
( Area )} /> ( Severity )} />
( What can we do for you?