import { ArrowLeft } from "lucide-react"; import { useNavigate, useParams } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { useRecipe } from "@/hooks/useRecipes"; import { RecipeDetail } from "@/components/recipes/RecipeDetail"; import { Skeleton } from "@/components/ui/Skeleton"; import { ErrorState } from "@/components/ui/ErrorState"; import { extractApiError } from "@/api/axiosInstance"; export function RecipeDetailPage() { const { t } = useTranslation(); const { id } = useParams<{ id: string }>(); const navigate = useNavigate(); const recipeId = Number(id); const { data: recipe, isLoading, isError, error, refetch } = useRecipe(recipeId); return (
{isLoading && (
{Array.from({ length: 4 }).map((_, i) => ( ))}
)} {isError && ( void refetch()} /> )} {!isLoading && !isError && recipe && }
); }