import React, { useState } from 'react'; import { type RecipeSmall } from "../types/Recipe" import Modal from '../components/Modal.tsx' import DemoModal from '../components/DemoModal.tsx' import { Link } from 'react-router-dom'; interface CookbookRecipeTileProps { recipe: RecipeSmall; handleDelete: (id: number | undefined) => void; } function CookbookRecipeTile({ recipe, handleDelete }: CookbookRecipeTileProps) { const [showConfirmModal, setShowConfirmModal] = useState(false); const [showDemoModal, setShowDemoModal] = useState(false); const openModal = () => { setShowConfirmModal(true) }; const closeModal = () => { setShowConfirmModal(false) }; const confirmDelete = () => { if (process.env.NODE_ENV === 'demo') { closeModal(); setShowDemoModal(true); } else { handleDelete(recipe.id); closeModal(); } }; return (