import { Star, User, Calendar, TrendingUp, Eye, Plus, HelpCircle, Zap, CheckCircle } from 'lucide-react'
import { cn } from '@/lib/utils'
import type { StepListItem } from '@/types/step'
interface StepCardProps {
step: StepListItem
onPreview: (step: StepListItem) => void
onInsert: (step: StepListItem) => void
}
const stepTypeIcons = {
decision: HelpCircle,
action: Zap,
solution: CheckCircle
}
const stepTypeColors = {
decision: 'bg-blue-400/10 text-blue-400 border-blue-400/20',
action: 'bg-yellow-400/10 text-yellow-400 border-yellow-400/20',
solution: 'bg-emerald-400/10 text-emerald-400 border-emerald-400/20'
}
export function StepCard({ step, onPreview, onInsert }: StepCardProps) {
const Icon = stepTypeIcons[step.step_type as keyof typeof stepTypeIcons] || HelpCircle
const hasRating = step.rating_count > 0
const visibleTags = step.tags.slice(0, 3)
const remainingTags = step.tags.length - 3
return (
{/* Header */}
{/* Step Type Badge */}
{step.step_type}
{/* Featured Badge */}
{step.is_featured && (
Featured
)}
{/* Title */}
{step.title}
{/* Metadata */}
{/* Category */}
{step.category_name && (
📁
{step.category_name}
)}
{/* Rating */}
{hasRating ? (
{step.rating_average.toFixed(1)} ({step.rating_count} {step.rating_count === 1 ? 'rating' : 'ratings'})
) : (
Not rated
)}
{/* Usage Count */}
Used {step.usage_count} {step.usage_count === 1 ? 'time' : 'times'}
{/* Author & Date */}
{step.author_name || 'Unknown'}
{new Date(step.created_at).toLocaleDateString()}
{/* Tags */}
{step.tags.length > 0 && (
{visibleTags.map(tag => (
{tag}
))}
{remainingTags > 0 && (
+{remainingTags} more
)}
)}
{/* Actions */}
)
}