fix(админка): свежие файлы без ручной чистки кеша, скелетон вместо «Загрузки»
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import htm from '/static/admin2/vendor/htm.module.js';
|
||||
import { api } from '/static/admin2/api.js';
|
||||
import { Drawer } from '/static/admin2/ui/drawer.js';
|
||||
import { Toast } from '/static/admin2/ui/toast.js';
|
||||
import { Loading } from '/static/admin2/ui/loading.js';
|
||||
|
||||
const html = htm.bind(h);
|
||||
const rub = (v) => v == null ? '—' : Number(v).toLocaleString('ru-RU',
|
||||
@@ -116,7 +117,7 @@ export function CustomerDrawer({ email, onClose, onDeleted, onChanged }) {
|
||||
${error ? html`<p class="error" role="alert">${error}</p>` : null}
|
||||
${notice ? html`<${Toast} message=${notice} onUndo=${undoId ? undo : null}
|
||||
onClose=${() => { setNotice(''); setUndoId(null); }} />` : null}
|
||||
${!card ? html`<p class="note">Загрузка…</p>` : html`
|
||||
${!card ? html`<${Loading} rows={2} />` : html`
|
||||
<nav class="tabs">${TABS.map(([k, label]) => html`
|
||||
<button type="button" key=${k} class=${k === tab ? 'tab active' : 'tab'}
|
||||
onClick=${() => { setRows([]); setTab(k); }}>${label}</button>`)}</nav>
|
||||
@@ -148,7 +149,7 @@ export function CustomerDrawer({ email, onClose, onDeleted, onChanged }) {
|
||||
<div><span>Сообщений</span><b>${card.activity.messages}</b></div>
|
||||
<div><span>Файлов</span><b>${card.activity.files}${card.activity.files_capped ? '+' : ''}</b></div>
|
||||
</div>` : html`<div class="tab-body">${loading
|
||||
? html`<p class="note">Загрузка…</p>`
|
||||
? html`<${Loading} rows={2} />`
|
||||
: rows.length === 0 ? html`<p class="note">Пусто.</p>`
|
||||
: html`<pre class="json">${JSON.stringify(rows.slice(0, 20), null, 2)}</pre>`}</div>`}
|
||||
`}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { api } from '/static/admin2/api.js';
|
||||
import { Table } from '/static/admin2/ui/table.js';
|
||||
import { CustomerDrawer } from '/static/admin2/pages/customer.js';
|
||||
import { Toast } from '/static/admin2/ui/toast.js';
|
||||
import { Loading } from '/static/admin2/ui/loading.js';
|
||||
|
||||
const html = htm.bind(h);
|
||||
const money = (v) => v == null ? '—' : Number(v).toLocaleString('ru-RU',
|
||||
@@ -66,7 +67,7 @@ export function CustomersPage() {
|
||||
${error ? html`<div class="card error" role="alert">${error}
|
||||
<button type="button" onClick=${() => { setError(''); setData(null); setAttempt(a => a + 1); }}>Повторить</button></div>`
|
||||
: data ? html`<${Table} columns=${columns} rows=${data.items.map((r) => ({...r, key: r.raw_email || r.email}))} onRowClick=${(r) => setSelected(r.raw_email || r.email)} />`
|
||||
: html`<div class="card">Загрузка…</div>`}
|
||||
: html`<${Loading} />`}
|
||||
${selected ? html`<${CustomerDrawer} email=${selected} onClose=${() => setSelected('')}
|
||||
onChanged=${() => { setSelected(''); setReload((n) => n + 1); }}
|
||||
onDeleted=${(email) => { setSelected(''); setDeletedEmail(email); setNotice('Клиент удалён'); setReload((n) => n + 1); }} />` : null}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useState, useEffect } from '/static/admin2/vendor/hooks.module.js';
|
||||
import htm from '/static/admin2/vendor/htm.module.js';
|
||||
import { api } from '/static/admin2/api.js';
|
||||
import { Card } from '/static/admin2/ui/card.js';
|
||||
import { Loading } from '/static/admin2/ui/loading.js';
|
||||
import { Task } from '/static/admin2/ui/task.js';
|
||||
|
||||
const html = htm.bind(h);
|
||||
@@ -35,7 +36,7 @@ export function DayPage() {
|
||||
}, []);
|
||||
|
||||
if (error) return html`<div class="card error" role="alert">${error}</div>`;
|
||||
if (!data) return html`<div class="card">Загрузка…</div>`;
|
||||
if (!data) return html`<${Loading} />`;
|
||||
|
||||
const w = data.work_24h, m = data.money, c = data.customers || {};
|
||||
return html`
|
||||
|
||||
@@ -5,6 +5,7 @@ import { api } from '/static/admin2/api.js';
|
||||
import { Card } from '/static/admin2/ui/card.js';
|
||||
import { Bars, Line } from '/static/admin2/ui/chart.js';
|
||||
import { Table } from '/static/admin2/ui/table.js';
|
||||
import { Loading } from '/static/admin2/ui/loading.js';
|
||||
|
||||
const html = htm.bind(h);
|
||||
const rub = (v) => v == null ? '—' : Number(v).toLocaleString('ru-RU',
|
||||
@@ -81,7 +82,7 @@ export function MoneyPage() {
|
||||
class=${d === days ? 'active' : ''} onClick=${() => { setDays(d); setPpage(1); }}>${d} дней</button>`)}
|
||||
</div>
|
||||
${error ? html`<div class="card error" role="alert">${error}</div>`
|
||||
: !data ? html`<div class="card">Загрузка…</div>` : html`
|
||||
: !data ? html`<${Loading} />` : html`
|
||||
<div class="grid">
|
||||
<${Card} title="Поступления" value=${rub(data.revenue_rub)}
|
||||
note=${'возвраты ' + rub(data.refunded_rub)} />
|
||||
@@ -124,7 +125,7 @@ export function MoneyPage() {
|
||||
{key: 'status', label: 'Статус', render: (r) => html`<span class=${'badge s-' + r.status}>${r.status}</span>`},
|
||||
{key: 'yk_payment_id', label: 'ID платежа'},
|
||||
]} rows=${payments.items.map((r) => ({...r, key: r.id}))} empty="Платежей за период нет" />`
|
||||
: html`<p class="note">Загрузка…</p>`}
|
||||
: html`<${Loading} rows={2} />`}
|
||||
</section>
|
||||
<section class="card accounts">
|
||||
<h2>Счета клиентов</h2>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useEffect, useState } from '/static/admin2/vendor/hooks.module.js';
|
||||
import htm from '/static/admin2/vendor/htm.module.js';
|
||||
import { api } from '/static/admin2/api.js';
|
||||
import { Card } from '/static/admin2/ui/card.js';
|
||||
import { Loading } from '/static/admin2/ui/loading.js';
|
||||
import { Table } from '/static/admin2/ui/table.js';
|
||||
|
||||
const html = htm.bind(h);
|
||||
@@ -34,7 +35,7 @@ export function SystemPage() {
|
||||
}, []);
|
||||
|
||||
if (error) return html`<div class="card error" role="alert">${error}</div>`;
|
||||
if (!data) return html`<div class="card">Загрузка…</div>`;
|
||||
if (!data) return html`<${Loading} />`;
|
||||
const bad = (channels || []).filter((c) => !c.ok);
|
||||
return html`
|
||||
<div class="grid">
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useEffect, useState } from '/static/admin2/vendor/hooks.module.js';
|
||||
import htm from '/static/admin2/vendor/htm.module.js';
|
||||
import { api } from '/static/admin2/api.js';
|
||||
import { Table } from '/static/admin2/ui/table.js';
|
||||
import { Loading } from '/static/admin2/ui/loading.js';
|
||||
|
||||
const html = htm.bind(h);
|
||||
const CAT = {wrong_answer: 'неверный ответ', off_topic: 'не по делу', failure: 'сбой',
|
||||
@@ -63,7 +64,7 @@ function FeedbackTab() {
|
||||
</div>
|
||||
${error ? html`<div class="card error" role="alert">${error}</div>` : null}
|
||||
${data ? html`<${Table} columns=${columns} rows=${data.items.map((r) => ({...r, key: r.id}))}
|
||||
empty="Жалоб нет" />` : html`<div class="card">Загрузка…</div>`}`;
|
||||
empty="Жалоб нет" />` : html`<${Loading} rows={2} />`}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +92,7 @@ function Paged({ title, path, columns, search = true, extra = null, params = {}
|
||||
</div>
|
||||
${error ? html`<div class="card error" role="alert">${error}</div>` : null}
|
||||
${data ? html`<${Table} columns=${columns} rows=${data.items.map((r) => ({...r, key: r.id || (r.username + r.tab_id)}))} empty="Пусто" />`
|
||||
: html`<div class="card">Загрузка…</div>`}`;
|
||||
: html`<${Loading} rows={2} />`}`;
|
||||
}
|
||||
|
||||
function DialogsTab() {
|
||||
|
||||
Reference in New Issue
Block a user