import { Link } from 'react-router-dom'; import type { Recipe, Tag } from '../types/recipe'; import { colors, radius, recipeAccentPalette, shadows, typography } from '../theme'; interface RecipeCardProps { recipe: Recipe; tags?: Tag[]; } const foodEmojis = ['🥗', '🍲', '🍝', '🍜', '🍛', '🥘', '🍗', '🍤', '🍕', '🥪', '🍳', '🍱']; function formatTime(minutes?: number): string { if (!minutes) return ''; if (minutes < 60) return `${minutes}m`; const hours = Math.floor(minutes / 60); const mins = minutes % 60; return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`; } function formatDate(timestamp?: number): string { if (!timestamp) return ''; const date = new Date(timestamp * 1000); return date.toLocaleDateString(); } function accentForRecipe(recipe: Recipe, tags: Tag[]) { if (tags[0]?.color) return tags[0].color; return recipeAccentPalette[recipe.id % recipeAccentPalette.length]; } function emojiForRecipe(recipe: Recipe) { return foodEmojis[recipe.id % foodEmojis.length]; } function MetaChip({ label, value, emoji }: { label: string; value: string; emoji: string }) { return (
{recipe.description}
) : (No description yet
)}