Этап 5: офлайн (PWA)

- vite-plugin-pwa: манифест, иконки, app shell в precache, автообновление
- статьи и картинки кешируются при открытии (stale-while-revalidate)
- «Скачать раздел для офлайна» с прогрессом, экран «Офлайн-разделы»
- баннер «Нет сети: показана сохранённая версия от …», метка «Офлайн» у статьи
- scripts/check-offline.mjs: проверка в режиме без сети

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
deonisii
2026-10-04 12:44:50 +03:00
co-authored by Claude Opus 5.5
parent f2be0df17a
commit 79d49181a6
18 changed files with 635 additions and 7 deletions
+3 -2
View File
@@ -1,6 +1,8 @@
import { Link, useParams } from 'react-router-dom';
import { plural } from '@kb/shared';
import { SectionOfflineRow } from '../components/Offline';
import { Screen } from '../components/Shell';
import { cacheSupported } from '../lib/offline';
import { BackLink, Notice, Plaque, Skeleton, ThemeButton } from '../components/ui';
import { num2 } from '../lib/format';
import { articleHref, useNav } from '../lib/tree';
@@ -42,8 +44,7 @@ export function SectionPage() {
</div>
</div>
{/* Сюда на этапе 5 встаёт строка «Сохранено для офлайна» */}
<div id="section-offline-slot" data-section={section.id} />
{cacheSupported() ? <SectionOfflineRow section={section} /> : null}
<div className="art-cards">
{section.articles.map((a, i) => (