feedback!
This commit is contained in:
33
src/App.jsx
33
src/App.jsx
@@ -1525,15 +1525,40 @@ export default function App() {
|
||||
<Card className="p-8" darkMode={darkMode}>
|
||||
<h3 className="text-xl font-black mb-6 flex items-center gap-3 text-inherit"><Bell className="text-primary-600" /> {t('feedbackTitle') || 'Suporte e Feedback'}</h3>
|
||||
<p className="opacity-60 text-sm font-medium mb-6">{t('feedbackDesc') || 'Tem alguma ideia, sugestão ou encontrou algum problema? Envie uma mensagem diretamente para nós!'}</p>
|
||||
<form onSubmit={(e) => {
|
||||
<form onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
const fd = new FormData(e.target);
|
||||
const type = fd.get('type');
|
||||
const msg = fd.get('message');
|
||||
// Substitua pelo seu email real
|
||||
const email = "faiker027@gmail.com";
|
||||
window.location.href = `mailto:${email}?subject=${encodeURIComponent(`MyCloset Feedback: ${type}`)}&body=${encodeURIComponent(msg)}`;
|
||||
e.target.reset();
|
||||
|
||||
try {
|
||||
const response = await fetch(`https://formsubmit.co/ajax/${email}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
Tipo: type,
|
||||
Mensagem: msg,
|
||||
Utilizador: user?.email || 'Desconhecido',
|
||||
_subject: `MyCloset Feedback: ${type}`
|
||||
})
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
setToastMessage('Mensagem enviada com sucesso!');
|
||||
setTimeout(() => setToastMessage(null), 4000);
|
||||
e.target.reset();
|
||||
} else {
|
||||
throw new Error('Falha no envio');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Erro ao enviar feedback:", error);
|
||||
setToastMessage('Erro ao enviar mensagem. Verifica a tua ligação.');
|
||||
setTimeout(() => setToastMessage(null), 4000);
|
||||
}
|
||||
}} className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<label className="flex items-center gap-3 p-4 rounded-xl border border-gray-100 dark:border-gray-800 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors">
|
||||
|
||||
Reference in New Issue
Block a user