{featured.title}
{featured.excerpt}
}> Читать материалimport { ArrowRight, CalendarDays, ChevronRight } from "lucide-react"; import { useQuery } from "@tanstack/react-query"; import { Link } from "react-router-dom"; import { contentApi, directoriesApi } from "../shared/api/endpoints"; import { normalizeContentList, toList } from "../shared/api/normalize"; import { queryKeys } from "../shared/api/queryKeys"; import { Badge } from "../shared/ui/Badge"; import { Button } from "../shared/ui/Button"; import { MaterialCard } from "../shared/ui/MaterialCard"; import { ResponsiveImage } from "../shared/ui/ResponsiveImage"; import { EmptyState, ErrorState, Skeleton } from "../shared/ui/States"; function eventDateParts(value = "") { const date = new Date(value); if (!Number.isNaN(date.getTime())) { return [ date.toLocaleDateString("ru-RU", { day: "numeric" }), date.toLocaleDateString("ru-RU", { month: "short" }), ]; } const [day = "", month = ""] = String(value).split(" "); return [day, month]; } export function HomePage() { const { data: contentPayload, isLoading, isError, refetch } = useQuery({ queryKey: queryKeys.content({ page: "home" }), queryFn: () => contentApi.list({ limit: 6 }), }); const { data: eventsPayload } = useQuery({ queryKey: queryKeys.events({ page: "home" }), queryFn: () => directoriesApi.events({ limit: 3 }), }); const { data: categoriesPayload } = useQuery({ queryKey: queryKeys.categories, queryFn: directoriesApi.categories, }); const pageMaterials = normalizeContentList(contentPayload); const pageEvents = toList(eventsPayload); const pageCategories = toList(categoriesPayload); const featured = pageMaterials.find((item) => item.featured) ?? pageMaterials[0]; if (isLoading) { return (
{featured.excerpt}
}> Читать материалНовая лента
Календарь
Лекции, выставки, защиты проектов и встречи университетского сообщества.
{event.time ?? event.startsAt} · {event.place ?? event.location}
Навигация по темам
{description}
); })}