"use client";

import { useState } from "react";
import { Button } from "@mosaic/ui";
import { useRouter } from "next/navigation";

export function QuickCaptureWidget() {
  const [idea, setIdea] = useState("");
  const router = useRouter();

  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    if (!idea.trim()) return;

    // TODO: Implement quick capture API call
    // For now, just show a success indicator
    console.log("Quick capture:", idea);
    setIdea("");
  };

  const goToTasks = () => {
    router.push("/tasks");
  };

  return (
    <div className="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
      <h2 className="text-lg font-semibold text-gray-900 mb-4">Quick Capture</h2>
      <p className="text-sm text-gray-600 mb-4">
        Quickly jot down ideas or brain dumps
      </p>
      <form onSubmit={handleSubmit} className="space-y-3">
        <textarea
          value={idea}
          onChange={(e) => setIdea(e.target.value)}
          placeholder="What's on your mind?"
          className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"
          rows={3}
        />
        <div className="flex gap-2">
          <Button type="submit" variant="primary" size="sm">
            Save Note
          </Button>
          <Button
            type="button"
            variant="secondary"
            size="sm"
            onClick={goToTasks}
          >
            Create Task
          </Button>
        </div>
      </form>
    </div>
  );
}
