feat: complete M0 — legal pages, consent, tip_views metrics, account deletion UI
- /legal/terms and /legal/privacy pages (linked from sign-in) - Consent (consentGiven=true) recorded on first Google sign-in - tip_views table: one row per tip served — enables activation + reaction rate queries - tip_views purged on account deletion - Delete account button on /connect (confirm → revoke tokens → purge data → sign out) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
import { getIntegrations, disconnectIntegration } from '@/lib/api';
|
||||
import { getIntegrations, disconnectIntegration, deleteAccount, logout } from '@/lib/api';
|
||||
import type { Integration } from '@oo/shared-types';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
@@ -11,6 +11,7 @@ function ConnectPageInner() {
|
||||
const [integrations, setIntegrations] = useState<Integration[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [disconnecting, setDisconnecting] = useState<string | null>(null);
|
||||
const [deleting, setDeleting] = useState(false);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
const { integrations: list } = await getIntegrations();
|
||||
@@ -26,6 +27,14 @@ function ConnectPageInner() {
|
||||
const isConnected = (provider: string) =>
|
||||
integrations.some((i) => i.provider === provider && i.status === 'connected');
|
||||
|
||||
const handleDeleteAccount = async () => {
|
||||
if (!confirm('Delete your account? This cannot be undone.')) return;
|
||||
setDeleting(true);
|
||||
await deleteAccount();
|
||||
await logout();
|
||||
window.location.href = '/sign-in';
|
||||
};
|
||||
|
||||
const handleDisconnect = async (provider: string) => {
|
||||
setDisconnecting(provider);
|
||||
await disconnectIntegration(provider);
|
||||
@@ -140,6 +149,23 @@ function ConnectPageInner() {
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div style={{ marginTop: '4rem', borderTop: '1px solid rgba(255,255,255,0.06)', paddingTop: '2rem' }}>
|
||||
<button
|
||||
onClick={handleDeleteAccount}
|
||||
disabled={deleting}
|
||||
style={{
|
||||
background: 'transparent',
|
||||
border: 'none',
|
||||
color: 'rgba(255,255,255,0.2)',
|
||||
fontSize: '0.8rem',
|
||||
cursor: 'pointer',
|
||||
padding: 0,
|
||||
}}
|
||||
>
|
||||
{deleting ? 'Deleting…' : 'Delete account'}
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user