Deep-audit + build-out across all products to fully-usable state; all typecheck clean. - gitgram-web (99): wire Store feature to real endpoints, close 9 gaps - gitgram-backend (100): close 8 flow gaps, document infra-provisioning items - gitgram-mobile (90): fix API base-URL/path mismatch (404s) + copy proximity components into components/proximity wired to real screens; 15 gaps, +react-native-svg - aitm-core (95): wire natural-language CLI flow end-to-end; 11 gaps - aitm-api (97): fix teams metadata runtime bug; copy a2a-js server/client/grpc into src/a2a and wire A2A route; crates.io package search; 8 gaps - aitm-mcp (100): fix A2A client/server card mismatch; 9 gaps - aitm-website (95): build missing docs routes; 9 gaps Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
86 lines
2.5 KiB
TypeScript
86 lines
2.5 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { useParams, useRouter } from 'next/navigation'
|
|
import api from '@/services/api'
|
|
|
|
export default function ReportAdPage() {
|
|
const params = useParams()
|
|
const router = useRouter()
|
|
const adId = params.id as string
|
|
const [reason, setReason] = useState('')
|
|
const [submitting, setSubmitting] = useState(false)
|
|
|
|
const reasons = [
|
|
'Misleading',
|
|
'Inappropriate content',
|
|
'Spam',
|
|
'Scam',
|
|
'Other',
|
|
]
|
|
|
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
e.preventDefault()
|
|
if (!reason) return
|
|
|
|
setSubmitting(true)
|
|
try {
|
|
await api.post(`/v1/advertisements/${adId}/report`, { reason })
|
|
router.back()
|
|
} catch (error) {
|
|
console.error('Report ad error:', error)
|
|
} finally {
|
|
setSubmitting(false)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-background">
|
|
<div className="max-w-2xl mx-auto py-8 px-4">
|
|
<h1 className="text-2xl font-bold text-foreground mb-6">Report Ad</h1>
|
|
|
|
<form onSubmit={handleSubmit} className="space-y-6">
|
|
<div>
|
|
<label className="block text-sm font-medium text-foreground mb-2">
|
|
Reason for reporting
|
|
</label>
|
|
<div className="space-y-2">
|
|
{reasons.map((r) => (
|
|
<label key={r} className="flex items-center gap-3 p-3 bg-surface rounded-lg cursor-pointer hover:bg-surface/80">
|
|
<input
|
|
type="radio"
|
|
name="reason"
|
|
value={r}
|
|
checked={reason === r}
|
|
onChange={(e) => setReason(e.target.value)}
|
|
className="text-accent"
|
|
/>
|
|
<span className="text-foreground">{r}</span>
|
|
</label>
|
|
))}
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex gap-4">
|
|
<button
|
|
type="submit"
|
|
disabled={submitting || !reason}
|
|
className="px-6 py-2 bg-red-500 text-white rounded-lg font-semibold hover:opacity-90 disabled:opacity-50"
|
|
>
|
|
{submitting ? 'Submitting...' : 'Submit Report'}
|
|
</button>
|
|
<button
|
|
type="button"
|
|
onClick={() => router.back()}
|
|
className="px-6 py-2 bg-surface border border-border rounded-lg text-foreground hover:bg-surface/80"
|
|
>
|
|
Cancel
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|