Field First Social

Field First Social

Capture | Share | Grow 🌱

const reportButton = document.getElementById('report-button'); const statusMessage = document.getElementById('status-message'); // Disable button during submission reportButton.disabled = true; reportButton.style.opacity = '0.5'; reportButton.style.cursor = 'not-allowed'; reportButton.textContent = 'Sending...'; try { const errorDetails = { subject: 'App Failed to Load', message: `The app failed to load on this device. Browser: ${navigator.userAgent} URL: ${window.location.href} Time: ${new Date().toISOString()} Screen Size: ${window.screen.width}x${window.screen.height} Console Errors: Please check browser console for details.`, email: 'user@unknown.com' }; const response = await fetch('https://mlrgetnajjwbyyuwfsvt.supabase.co/functions/v1/send-help-request', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(errorDetails) }); if (response.ok) { statusMessage.textContent = '✓ Problem report sent successfully!'; statusMessage.style.display = 'block'; reportButton.textContent = 'Sent'; } else { throw new Error('Failed to send report'); } } catch (error) { console.error('Failed to send problem report:', error); statusMessage.textContent = '✗ Failed to send report. Please email keith@fieldfirstsocial.com directly.'; statusMessage.style.color = '#DC2626'; statusMessage.style.display = 'block'; reportButton.textContent = 'Report Problem'; reportButton.disabled = false; reportButton.style.opacity = '1'; reportButton.style.cursor = 'pointer'; } }