/**
* UpgradePrompt Component
*
* Shows a locked state with upgrade prompt for features not available in current plan
*/
import React from 'react';
import { Lock, Crown, ArrowUpRight } from 'lucide-react';
import { FeatureKey, FEATURE_NAMES, FEATURE_DESCRIPTIONS } from '../hooks/usePlanFeatures';
import { Link } from 'react-router-dom';
interface UpgradePromptProps {
feature: FeatureKey;
children?: React.ReactNode;
variant?: 'inline' | 'overlay' | 'banner';
size?: 'sm' | 'md' | 'lg';
showDescription?: boolean;
}
/**
* Inline variant - Small badge for locked features
*/
const InlinePrompt: React.FC<{ feature: FeatureKey }> = ({ feature }) => (
Upgrade Required
);
/**
* Banner variant - Full-width banner for locked sections
*/
const BannerPrompt: React.FC<{ feature: FeatureKey; showDescription: boolean }> = ({
feature,
showDescription
}) => (
{FEATURE_NAMES[feature]} - Upgrade Required
{showDescription && (
{FEATURE_DESCRIPTIONS[feature]}
)}
Upgrade Your Plan
);
/**
* Overlay variant - Overlay on top of disabled content
*/
const OverlayPrompt: React.FC<{
feature: FeatureKey;
children?: React.ReactNode;
size: 'sm' | 'md' | 'lg';
}> = ({ feature, children, size }) => {
const sizeClasses = {
sm: 'p-4',
md: 'p-6',
lg: 'p-8',
};
return (
{/* Disabled content */}
{children}
{/* Overlay */}
{FEATURE_NAMES[feature]}
{FEATURE_DESCRIPTIONS[feature]}
Upgrade Your Plan
);
};
/**
* Main UpgradePrompt Component
*/
export const UpgradePrompt: React.FC = ({
feature,
children,
variant = 'banner',
size = 'md',
showDescription = true,
}) => {
if (variant === 'inline') {
return ;
}
if (variant === 'overlay') {
return {children};
}
// Default to banner
return ;
};
/**
* Locked Section Wrapper
*
* Wraps a section and shows upgrade prompt if feature is not available
*/
interface LockedSectionProps {
feature: FeatureKey;
isLocked: boolean;
children: React.ReactNode;
variant?: 'overlay' | 'banner';
fallback?: React.ReactNode;
}
export const LockedSection: React.FC = ({
feature,
isLocked,
children,
variant = 'banner',
fallback,
}) => {
if (!isLocked) {
return <>{children}>;
}
if (fallback) {
return <>{fallback}>;
}
if (variant === 'overlay') {
return (
{children}
);
}
return ;
};
/**
* Locked Button
*
* Shows a disabled button with lock icon for locked features
*/
interface LockedButtonProps {
feature: FeatureKey;
isLocked: boolean;
children: React.ReactNode;
className?: string;
onClick?: () => void;
}
export const LockedButton: React.FC = ({
feature,
isLocked,
children,
className = '',
onClick,
}) => {
if (isLocked) {
return (
{FEATURE_NAMES[feature]} - Upgrade Required
);
}
return (
);
};