diff --git a/admin/src/app/sugerencias/page.tsx b/admin/src/app/sugerencias/page.tsx new file mode 100644 index 0000000..7ea71ea --- /dev/null +++ b/admin/src/app/sugerencias/page.tsx @@ -0,0 +1,96 @@ +'use client'; + +import { useState } from 'react'; +import { api } from '@/lib/api'; +import { Button } from '@/components/ui/button'; +import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; +import { Textarea } from '@/components/ui/textarea'; +import { MessageSquarePlus, CheckCircle2 } from 'lucide-react'; + +export default function SugerenciasPage() { + const [name, setName] = useState(''); + const [message, setMessage] = useState(''); + const [loading, setLoading] = useState(false); + const [sent, setSent] = useState(false); + const [error, setError] = useState(''); + + async function handleSubmit(e: React.FormEvent) { + e.preventDefault(); + if (!message.trim()) return; + setLoading(true); + setError(''); + try { + await api.post('/suggestions', { name: name.trim() || undefined, message: message.trim() }); + setSent(true); + } catch { + setError('No se pudo enviar la sugerencia. Por favor intenta de nuevo.'); + } finally { + setLoading(false); + } + } + + return ( +
+ + +
+
+ +
+
+ Sugerencias + + Ayúdanos a mejorar ProsApp con tus comentarios y sugerencias + +
+ + {sent ? ( +
+ +

¡Gracias por tu sugerencia!

+

+ Tu mensaje fue recibido. Lo tendremos en cuenta para mejorar la app. +

+ +
+ ) : ( +
+
+ + setName(e.target.value)} + /> +
+
+ +