From 23524cb94314fd50476ccffe654841d980c713d7 Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Fri, 19 Jan 2024 11:28:25 -0500 Subject: Clean project from marketing content (#50) * Clean project from marketing content * Remove some dependencies --- src/components/feedback-button/feedback-button.tsx | 277 --------------------- 1 file changed, 277 deletions(-) delete mode 100644 src/components/feedback-button/feedback-button.tsx (limited to 'src/components/feedback-button/feedback-button.tsx') diff --git a/src/components/feedback-button/feedback-button.tsx b/src/components/feedback-button/feedback-button.tsx deleted file mode 100644 index b1b6ae2..0000000 --- a/src/components/feedback-button/feedback-button.tsx +++ /dev/null @@ -1,277 +0,0 @@ -'use client' -import { sendFeedback } from '@/components/feedback-button/feedback-button-actions' -import { formSchema } from '@/components/feedback-button/feedback-button-common' -import { Button, ButtonProps } from '@/components/ui/button' -import { Dialog, DialogContent, DialogTrigger } from '@/components/ui/dialog' -import { Drawer, DrawerContent, DrawerTrigger } from '@/components/ui/drawer' -import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import { Input } from '@/components/ui/input' -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs' -import { Textarea } from '@/components/ui/textarea' -import { useToast } from '@/components/ui/use-toast' -import { useMediaQuery } from '@/lib/hooks' -import { zodResolver } from '@hookform/resolvers/zod' -import { Heart, HeartIcon, Loader2, MessageCircle } from 'lucide-react' -import { PropsWithChildren, ReactNode, SetStateAction, useState } from 'react' -import { useForm } from 'react-hook-form' -import * as z from 'zod' - -type FormValues = z.infer - -type Props = { - donationUrl: string - defaultTab?: 'feedback' | 'support' -} - -export function FeedbackModal({ - donationUrl, - defaultTab = 'feedback', - children, -}: PropsWithChildren) { - const { toast } = useToast() - const isDesktop = useMediaQuery('(min-width: 640px)') - const [open, setOpen] = useState(false) - - async function onSubmit(values: FormValues) { - await sendFeedback(values) - toast({ - title: 'Thank you for your feedback!', - description: - 'We will have a look at it as soon as possible, and will get back to you if needed.', - }) - } - - const Wrapper = isDesktop ? FeedbackDialog : FeedbackDrawer - - return ( - - { - await onSubmit(values) - setOpen(false) - }} - donationUrl={donationUrl} - defaultTab={defaultTab} - /> - - ) -} - -function FeedbackDrawer({ - children, - open, - setOpen, - button, -}: PropsWithChildren<{ - open: boolean - setOpen: (open: SetStateAction) => void - button: ReactNode -}>) { - return ( - - {button} - -
{children}
-
-
- ) -} - -function FeedbackDialog({ - children, - open, - setOpen, - button, -}: PropsWithChildren<{ - open: boolean - setOpen: (open: SetStateAction) => void - button: ReactNode -}>) { - return ( - - {button} - -
{children}
-
-
- ) -} - -function FeedbackContent({ - onSubmit, - donationUrl, - defaultTab, -}: { - onSubmit: (values: FormValues) => Promise - donationUrl: string - defaultTab: 'feedback' | 'support' -}) { - return ( - -
- - Give feedback - Support us - -
- - - - - - -
- ) -} - -function FeedbackForm({ - onSubmit, -}: { - onSubmit: (values: FormValues) => Promise -}) { - const form = useForm({ - resolver: zodResolver(formSchema), - defaultValues: { email: '', message: '' }, - }) - - const isSubmitting = form.formState.isSubmitting - return ( -
- -
-

- Give us your feedback -

-

- We are always working to improve the user experience, and your - feedback helps us a lot. -

-
-
- ( - - Your email address - - - - - Optional. Provide it if you want us to get back to you. - - - - )} - /> - ( - - Your feedback - -