feat: show VK photos in calculation admin

This commit is contained in:
nyan404 committed 2026-08-16 15:56:17 +03:00
1 parent 6bbd8d4b0b
commit 20b434dbcd
6 files changed
+84 -5

No files matched your search

+12 -2
View File
@@ -14,10 +14,11 @@
button { cursor: pointer; background: #d59b62; color: #211818; border-color: #d59b62; }
.error { color: #ff9f9f; white-space: pre-wrap; }
.table-wrap { overflow-x: auto; border: 1px solid #4a383d; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { text-align: left; vertical-align: top; padding: 10px; border-bottom: 1px solid #4a383d; }
th { color: #d59b62; }
td pre { white-space: pre-wrap; margin: 0; max-width: 560px; }
td img { width: 96px; height: 72px; object-fit: cover; margin: 2px; border-radius: 5px; }
.muted { color: #b9aaad; }
</style>
</head>
@@ -32,7 +33,7 @@
<button id="load">Загрузить</button>
</div>
<p class="error" id="error"></p>
<div class="table-wrap"><table><thead><tr><th>ID записи</th><th>Автор</th><th>Режим</th><th>Котёнок</th><th>Дата</th><th>Сообщение</th></tr></thead><tbody id="rows"></tbody></table></div>
<div class="table-wrap"><table><thead><tr><th>ID записи</th><th>Автор</th><th>Режим</th><th>Котёнок</th><th>Фото</th><th>Дата</th><th>Сообщение</th></tr></thead><tbody id="rows"></tbody></table></div>
</main>
<script>
const password = document.querySelector('#password');
@@ -52,6 +53,15 @@
const row = document.createElement('tr');
row.append(cell(item.id)); row.append(cell(item.actor_id || '—')); row.append(cell(item.mode));
row.append(cell(`${item.input.kitten_name || '—'} [${item.input.kitten_id || '—'}]`));
const photos = document.createElement('td');
(item.input.attachments || []).forEach(photo => {
if (!photo.url) return;
const link = document.createElement('a'); link.href = photo.url; link.target = '_blank'; link.rel = 'noopener';
const image = document.createElement('img'); image.src = photo.url; image.alt = 'Фото'; image.loading = 'lazy';
link.append(image); photos.append(link);
});
if (!photos.childNodes.length) photos.textContent = '—';
row.append(photos);
row.append(cell(item.created_at));
const message = document.createElement('td'); const pre = document.createElement('pre'); pre.textContent = item.message; message.append(pre); row.append(message);
rows.append(row);