import { Link, useParams } from 'react-router-dom'; import { plural } from '@kb/shared'; import { Screen } from '../components/Shell'; import { BackLink, Notice, Plaque, Skeleton, ThemeButton } from '../components/ui'; import { num2 } from '../lib/format'; import { articleHref, useNav } from '../lib/tree'; export function SectionPage() { const { slug } = useParams(); const nav = useNav(); const section = nav.sections.find((s) => s.slug === slug); if (!section) { return ( Главная {nav.isLoading ? : Возможно, его переименовали или удалили.} ); } const photos = section.articles.reduce((n, a) => n + a.imageCount, 0); return ( Главная {section.name} {section.articles.length} {plural(section.articles.length, ['статья', 'статьи', 'статей'])} {photos ? ` · ${photos} фото` : ''} {/* Сюда на этапе 5 встаёт строка «Сохранено для офлайна» */} {section.articles.map((a, i) => ( {num2(i + 1)} {nav.short(a)} {a.summary ? {a.summary} : null} {a.tags.length ? ( {a.tags.slice(0, 4).map((t) => ( {t} ))} ) : null} ))} ); }