diff --git a/src/components/Label.tsx b/src/components/Label.tsx index 5c1117cf4..d64a4d17b 100644 --- a/src/components/Label.tsx +++ b/src/components/Label.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { cva, type VariantProps } from 'class-variance-authority'; import { cn } from '@/lib/Tailwind'; -const labelVariants = cva('text-form leading-4 font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'); +const labelVariants = cva('text-form font-medium leading-2 peer-disabled:cursor-not-allowed peer-disabled:opacity-70'); export interface LabelProps extends React.LabelHTMLAttributes, VariantProps {} diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index c5ee363f6..1e1b59e91 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -32,10 +32,16 @@ const ModalContent = React.forwardRef { + const { originalEvent } = e.detail; + if (originalEvent.target instanceof Element && originalEvent.target.closest('.group.toast')) { + e.preventDefault(); + } + }} > {children} diff --git a/src/components/SideBarMenu.tsx b/src/components/SideBarMenu.tsx index a3cb09ece..db98c3906 100644 --- a/src/components/SideBarMenu.tsx +++ b/src/components/SideBarMenu.tsx @@ -84,7 +84,7 @@ const SideBarMenu: React.FC = ({ navItems, unreadMessagesCount }) => { {t('appFeedback.giveFeedbackButton')} - setIsOpen(false)} /> + ); }; diff --git a/src/components/SwitchLanguageButton.tsx b/src/components/SwitchLanguageButton.tsx index da7076224..1ead5f244 100644 --- a/src/components/SwitchLanguageButton.tsx +++ b/src/components/SwitchLanguageButton.tsx @@ -15,7 +15,7 @@ const SwitchLanguageButton: React.FC = () => { - setShowSwitchLanguage(false)} /> + ); }; diff --git a/src/components/Toaster.tsx b/src/components/Toaster.tsx index 2f1b56784..a74517970 100644 --- a/src/components/Toaster.tsx +++ b/src/components/Toaster.tsx @@ -1,19 +1,20 @@ +import { createPortal } from 'react-dom'; import { Toaster as Sonner } from 'sonner'; type ToasterProps = React.ComponentProps; const Toaster = ({ ...props }: ToasterProps) => { - return ( + return createPortal( { }, }} {...props} - /> + />, + document.body ); }; diff --git a/src/modals/AppFeedbackModal.tsx b/src/modals/AppFeedbackModal.tsx index d44f4249a..52cbc3828 100644 --- a/src/modals/AppFeedbackModal.tsx +++ b/src/modals/AppFeedbackModal.tsx @@ -1,18 +1,23 @@ +import { Button } from '@/components/Button'; +import { Modal, ModalFooter, ModalHeader, ModalTitle } from '@/components/Modal'; import { useMutation } from '@apollo/client'; -import { useTheme, Row, Button, Modal, Text, FormControl, TextArea, Heading, Radio, Box, useToast } from 'native-base'; import { ChangeEventHandler, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { gql } from '../gql'; +import { toast } from 'sonner'; +import { Label } from '@/components/Label'; +import { TextArea } from '@/components/TextArea'; +import { Input } from '@/components/Input'; +import { RadioGroup, RadioGroupItem } from '@/components/RadioGroup'; +import { Typography } from '@/components/Typography'; interface AddFeedbackModalProps { - isOpen?: boolean; - onClose: () => any; + isOpen: boolean; + onIsOpenChange: (value: boolean) => any; } -const AppFeedbackModal = ({ isOpen, onClose }: AddFeedbackModalProps) => { - const { space } = useTheme(); +const AppFeedbackModal = ({ isOpen, onIsOpenChange }: AddFeedbackModalProps) => { const { t } = useTranslation(); - const toast = useToast(); const [notes, setNotes] = useState(''); const [isSending, setIsSending] = useState(false); @@ -53,7 +58,7 @@ const AppFeedbackModal = ({ isOpen, onClose }: AddFeedbackModalProps) => { const handleOnSubmit = async () => { const MAX_FILE_SIZE = 2 * 1024 * 1024; if (file?.size && file.size > MAX_FILE_SIZE) { - toast.show({ description: t('appFeedback.screenshotShouldNotBeBiggerThan', { size: '2' }) }); + toast.error(t('appFeedback.screenshotShouldNotBeBiggerThan', { size: '2' })); return; } @@ -73,68 +78,61 @@ const AppFeedbackModal = ({ isOpen, onClose }: AddFeedbackModalProps) => { : undefined, }, }); - toast.show({ description: t('appFeedback.feedbackSuccessfullySent') }); - onClose(); + + toast.success(t('appFeedback.feedbackSuccessfullySent')); + onIsOpenChange(false); setIsSending(false); }; return ( - - - - - {`💬 ${t('appFeedback.modal.title')}`} - - - {t('appFeedback.modal.description')} - - - {t('appFeedback.modal.notesLabel')}* -