Improve MVP UX: Add CTA links, update header buttons, replace alerts with toasts

This commit is contained in:
Timo Knuth
2025-10-14 16:45:52 +02:00
parent a9ba9fb111
commit 157e53af83
4 changed files with 28 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ import { Button } from '@/components/ui/Button';
import { Badge } from '@/components/ui/Badge';
import { calculateContrast } from '@/lib/utils';
import { useTranslation } from '@/hooks/useTranslation';
import { showToast } from '@/components/ui/Toast';
export default function CreatePage() {
const router = useRouter();
@@ -159,18 +160,20 @@ export default function CreatePage() {
console.log('RESPONSE DATA:', responseData);
if (response.ok) {
// Show what was saved
alert(`QR Code saved!\n\nType: ${responseData.type}\nContent: ${JSON.stringify(responseData.content, null, 2)}`);
router.push('/dashboard');
router.refresh(); // Force refresh to get new data
showToast(`QR Code "${title}" created successfully!`, 'success');
// Wait a moment so user sees the toast, then redirect
setTimeout(() => {
router.push('/dashboard');
router.refresh();
}, 1000);
} else {
console.error('Error creating QR code:', responseData);
alert('Error creating QR code: ' + (responseData.error || 'Unknown error'));
showToast(responseData.error || 'Error creating QR code', 'error');
}
} catch (error) {
console.error('Error creating QR code:', error);
alert('Error creating QR code');
showToast('Error creating QR code. Please try again.', 'error');
} finally {
setLoading(false);
}