/** * Quick Capture Widget - idea/brain dump input * * In production, shows a Coming Soon placeholder since the feature * is not yet complete. Full functionality available in development mode. */ import { useState } from "react"; import { Send, Lightbulb } from "lucide-react"; import type { WidgetProps } from "@mosaic/shared"; /** * Check if we're in development mode (runtime check for testability) */ function isDevelopment(): boolean { return process.env.NODE_ENV === "development"; } /** * Compact Coming Soon placeholder for widget contexts */ function WidgetComingSoon(): React.JSX.Element { return (
{/* Lightbulb Icon */}
); } /** * Internal Quick Capture Widget implementation */ function QuickCaptureWidgetInternal({ id: _id, config: _config }: WidgetProps): React.JSX.Element { const [input, setInput] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); const [recentCaptures, setRecentCaptures] = useState([]); const handleSubmit = (e: React.SyntheticEvent): void => { e.preventDefault(); if (!input.trim() || isSubmitting) return; setIsSubmitting(true); const idea = input.trim(); try { // TODO: Replace with actual API call // await api.ideas.create({ content: idea }); // Add to recent captures for visual feedback setRecentCaptures((prev) => [idea, ...prev].slice(0, 3)); setInput(""); } catch (_error) { console.error("Failed to capture idea:", _error); } finally { setIsSubmitting(false); } }; return (
{/* Header */}
Quick Capture
{/* Input form */}
{ setInput(e.target.value); }} placeholder="Capture an idea..." className="flex-1 px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" disabled={isSubmitting} />
{/* Recent captures */} {recentCaptures.length > 0 && (
Recently captured:
{recentCaptures.map((capture, index) => (
{capture}
))}
)} {/* Tips */} {recentCaptures.length === 0 && (
Capture ideas quickly
They'll be organized later
)}
); } /** * Quick Capture Widget * * In production: Shows Coming Soon placeholder * In development: Full widget functionality */ export function QuickCaptureWidget(props: WidgetProps): React.JSX.Element { // In production, show Coming Soon placeholder if (!isDevelopment()) { return ; } // In development, show full widget functionality return ; }