import { Form, router } from '@inertiajs/react'; import { CircleAlert, CircleCheck, Send } from 'lucide-react'; import { useState } from 'react'; import StoreGenerationController from '@/actions/App/Http/Controllers/StoreGenerationController'; import InputError from '@/components/input-error'; import { Button } from '@/components/ui/button'; import { Spinner } from '@/components/ui/spinner'; import type { Store, StoreGeneration, UsageCount } from '@/types'; const fieldClass = 'w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50'; /** * Ask the AI for a small change in plain words, and see the last few requests. */ export default function DesignChat({ store, edits, usage, busy, }: { store: Store; edits: StoreGeneration[]; usage: UsageCount; busy: boolean; }) { const left = Math.max(0, usage.limit - usage.used); const disabled = busy || left === 0; return (

Ask the AI

{left} of {usage.limit} AI edits left

{({ processing, errors }) => ( <>