fix(#338): Disable QuickCaptureWidget in production with Coming Soon
- Show Coming Soon placeholder in production for both widget versions - Widget available in development mode only - Added tests verifying environment-based behavior - Use runtime check for testability (isDevelopment function vs constant) Refs #338 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,48 @@
|
||||
/**
|
||||
* 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";
|
||||
|
||||
export function QuickCaptureWidget({ id: _id, config: _config }: WidgetProps): React.JSX.Element {
|
||||
/**
|
||||
* 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 (
|
||||
<div className="flex flex-col h-full items-center justify-center p-4 text-center">
|
||||
{/* Lightbulb Icon */}
|
||||
<Lightbulb className="w-8 h-8 text-gray-300 mb-3" aria-hidden="true" />
|
||||
|
||||
{/* Coming Soon Badge */}
|
||||
<span className="inline-block px-3 py-1 bg-blue-100 text-blue-700 text-xs font-medium rounded-full mb-2">
|
||||
Coming Soon
|
||||
</span>
|
||||
|
||||
{/* Feature Name */}
|
||||
<h3 className="text-sm font-medium text-gray-700 mb-1">Quick Capture</h3>
|
||||
|
||||
{/* Description */}
|
||||
<p className="text-xs text-gray-500">Quickly jot down ideas for later organization.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<string[]>([]);
|
||||
@@ -92,3 +128,19 @@ export function QuickCaptureWidget({ id: _id, config: _config }: WidgetProps): R
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 <WidgetComingSoon />;
|
||||
}
|
||||
|
||||
// In development, show full widget functionality
|
||||
return <QuickCaptureWidgetInternal {...props} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user