import { usePostById } from "@/modules"; import { WpPost } from "@/widgets/WpPost"; import { useParams } from "react-router-dom"; import { ProjectsList } from "@/widgets/CardList/CardList"; import { SkeletonPost } from "@/shared/Components/SkeletonPost/SkeletonPost"; import { Helmet } from "react-helmet"; import { useEffect } from "react"; function WpPostPage() { const params = useParams(); const postId = params.id ? parseInt(params.id, 10) : null; const { data: post, isLoading, isError } = usePostById(postId || -1); useEffect(() => { if (post) { window.scrollTo({ top: 0, behavior: "auto" }); } }, [post]); if (!postId) { return ( <> Пост не найден | СКБ "Компьютерное инновационное творчество"
Не указан ID поста
); } if (isLoading) { return (
{[...Array(1)].map((_, index) => ( ))}
); } if (isError) { return ( <> Ошибка загрузки | СКБ "Компьютерное инновационное творчество"
Ошибка при загрузке данных
); } return ( <> {post && ( <> {post.title || "Пост"} | СКБ "Компьютерное инновационное творчество" {post?.categories?.includes("labs") && ( )} )} ); } export default WpPostPage;