fix(админка): свежие файлы без ручной чистки кеша, скелетон вместо «Загрузки»

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-10 01:26:08 +10:00
co-authored by Claude Code
parent 40dcb44a7c
commit 55aca56b3f
12 changed files with 92 additions and 10 deletions
+20
View File
@@ -0,0 +1,20 @@
import { h } from '/static/admin2/vendor/preact.module.js';
import { useEffect, useState } from '/static/admin2/vendor/hooks.module.js';
import htm from '/static/admin2/vendor/htm.module.js';
const html = htm.bind(h);
// Скелетон вместо слова «Загрузка»: быстрые ответы (0,2–0,4 с) не должны мигать
// надписью на каждом переключении. Показываем только если данных нет 150 мс;
// для чтения с экрана остаётся скрытое описание.
export const Loading = ({ rows = 3 }) => {
const [show, setShow] = useState(false);
useEffect(() => {
const t = setTimeout(() => setShow(true), 150);
return () => clearTimeout(t);
}, []);
if (!show) return null;
return html`<div class="card skeleton" role="status" aria-label="Загружаем раздел">
${Array.from({length: Math.max(1, rows)}, (_, i) => html`<div class="sk-line" key=${i}></div>`)}
</div>`;
};