'use client';
import { useState } from 'react';
import { Star } from 'lucide-react';
import { clientApi } from '../../lib/clientApi.js';
function cx(...args) {
return args.filter(Boolean).join(' ');
}
function StarRating({ value, onChange }) {
return (
{[1, 2, 3, 4, 5].map((n) => (
))}
);
}
export default function ReviewForm() {
const [form, setForm] = useState({ name: '', role: '', rating: 5, text: '', website: '' });
const [status, setStatus] = useState('idle'); // idle | sending | sent | error
async function handleSubmit(e) {
e.preventDefault();
if (!form.name.trim() || !form.text.trim()) return;
setStatus('sending');
try {
await clientApi.submitReview(form);
setForm({ name: '', role: '', rating: 5, text: '', website: '' });
setStatus('sent');
} catch (err) {
setStatus('error');
}
}
return (
);
}