import { useState } from 'react'; import { useMutation } from '@tanstack/react-query'; import toast from 'react-hot-toast'; import { Send, Eye } from 'lucide-react'; import { api } from '../../lib/api-client'; import { AppShell, PageHeader, PageBody } from '../../layout/AppShell'; import { Button, Card, CardContent, Input, Label, Select, Textarea } from '../../components/ui/primitives'; export function PushComposer() { const [form, setForm] = useState({ title: '', body: '', url: 'https://sneakerpicks.nl', image_url: '', segment: 'all', }); const sendMut = useMutation({ mutationFn: () => api.post<{ jobId: number }>('/push/send', { title: form.title, body: form.body, url: form.url, image_url: form.image_url || undefined, segment: form.segment, }), onSuccess: (res) => { toast.success(`Push in wachtrij (job #${res.jobId})`); setForm({ ...form, title: '', body: '' }); }, onError: (e: Error) => toast.error(e.message), }); return (
setForm({ ...form, title: e.target.value })} placeholder="€50 korting op Nike Air Max" />

{form.title.length}/60