fix(админка): свежие файлы без ручной чистки кеша, скелетон вместо «Загрузки»
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -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>`;
|
||||
};
|
||||
Reference in New Issue
Block a user