import React, { useState, useEffect } from 'react'; import { Card, CardHeader, CardTitle, CardContent } from './ui/card'; import { Button } from './ui/button'; import { Switch } from './ui/switch'; import { Badge } from './ui/badge'; import { Shield, Activity, Eye, BarChart } from 'lucide-react'; const TelemetrySettings = () => { const [consent, setConsent] = useState(false); const [globalEnabled, setGlobalEnabled] = useState(false); const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); // Load current consent status useEffect(() => { fetchConsentStatus(); }, []); const fetchConsentStatus = async () => { try { const response = await fetch('/api/v1/telemetry/consent', { headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` } }); if (response.ok) { const data = await response.json(); setConsent(data.consent); setGlobalEnabled(data.enabled_globally); } } catch (error) { console.error('Failed to fetch telemetry consent:', error); } finally { setLoading(false); } }; const updateConsent = async (newConsent) => { setSaving(true); try { const response = await fetch('/api/v1/telemetry/consent', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${localStorage.getItem('token')}` }, body: JSON.stringify({ consent: newConsent }) }); if (response.ok) { setConsent(newConsent); } } catch (error) { console.error('Failed to update telemetry consent:', error); } finally { setSaving(false); } }; if (loading) { return (
Loading telemetry settings...
); } return ( Privacy & Telemetry

Help improve LifeRPG by sharing anonymous usage patterns

{!globalEnabled && (

Telemetry is disabled globally by the administrator.

)} {consent && globalEnabled && (

Anonymous telemetry is enabled. Thank you for helping improve LifeRPG!

)}

What we collect:

Feature usage patterns
Performance metrics
Anonymous No personal information
Optional Can be disabled anytime

All telemetry data is anonymous and used solely to improve the application. No personal information, habit names, or content is ever collected.

); }; export default TelemetrySettings;