feat(feedback): notify on feedback AI ready/error

This commit is contained in:
dev
2026-11-04 23:48:28 +03:00
parent e3f80ff7ec
commit 0c8cbb56e1
6 changed files with 244 additions and 94 deletions
+50 -22
View File
@@ -6,45 +6,64 @@
<title>Дайджест — Админ-панель</title>
<link rel="stylesheet" href="admin.css">
<style>
.digest-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.digest-toolbar .search-input { flex: 1; min-width: 240px; max-width: 420px; }
.digest-count { font-size: .82rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.digest-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.digest-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.digest-card.pinned { border-left: 4px solid #f59e0b; background: rgba(245,158,11,.04); }
.digest-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.digest-title { font-weight: 600; font-size: 1.05rem; word-break: break-word; margin: 0; }
.digest-meta { font-size: .82rem; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.digest-badge { padding: 1px 8px; border-radius: 999px; font-size: .68rem; font-weight: 600; background: rgba(245,158,11,.12); color: #b45309; }
.digest-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.digest-meta-item svg { width: 13px; height: 13px; opacity: .7; }
.digest-badge { padding: 2px 9px; border-radius: 999px; font-size: .68rem; font-weight: 600; background: rgba(245,158,11,.12); color: #b45309; white-space: nowrap; }
.digest-badge.scheduled { background: rgba(37,99,235,.12); color: var(--accent); }
.digest-badge.dim { background: var(--bg); color: var(--muted); }
.digest-body { font-size: .95rem; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.digest-body.clamp { max-height: 150px; overflow: hidden; position: relative; }
.digest-body.clamp::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 38px; background: linear-gradient(transparent, var(--card)); pointer-events: none; }
.digest-body-toggle { align-self: flex-start; background: none; border: none; color: var(--accent); font-size: .8rem; font-weight: 600; cursor: pointer; padding: 0; }
.digest-body-toggle:hover { text-decoration: underline; }
.digest-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto; }
.digest-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.digest-empty { color: var(--muted); font-size: .95rem; padding: 16px; }
.digest-empty { border: 1px dashed var(--border); border-radius: 12px; padding: 44px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); }
.digest-empty svg { width: 28px; height: 28px; opacity: .55; }
.digest-empty.error svg { color: #ef4444; opacity: .8; }
.digest-empty p { margin: 0; font-size: .95rem; }
.digest-empty .sub { font-size: .82rem; opacity: .8; max-width: 420px; }
.digest-empty .btn-primary { margin-top: 10px; }
.digest-none { color: var(--muted); font-size: .85rem; font-style: italic; }
.digest-hidden { opacity: 0.72; }
.digest-highlight { outline: 2px solid #f59e0b; outline-offset: 2px; border-radius: 8px; }
.digest-new-btn { margin-left: auto; }
.digest-preview-img { max-width: 240px; max-height: 150px; border: 1px solid var(--border); border-radius: 8px; margin: 8px 0 4px 0; display: block; }
.digest-images { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.digest-image { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; width: 130px; height: 95px; flex-shrink: 0; }
.digest-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.digest-image img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.digest-image-remove { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.7); color: #fff; border: none; border-radius: 6px; padding: 2px 7px; font-size: .75rem; cursor: pointer; }
.digest-image-remove:hover { background: #ef4444; }
.digest-date-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.digest-date-row .settings-field { flex: 1; min-width: 200px; margin: 0; }
.field-hint { font-size: .78rem; color: var(--muted); margin-top: 4px; display: block; }
.digest-none { color: var(--muted); font-size: .85rem; font-style: italic; }
.digest-head-img { margin: 8px 0 10px 0; }
.digest-images-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.digest-card-thumb { width: 70px; height: 55px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; flex-shrink: 0; display: block; }
.digest-shot { position: relative; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; padding: 0; cursor: pointer; border-radius: 6px; overflow: hidden; }
.digest-shot-zoom { position: absolute; bottom: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff; border-radius: 4px; padding: 2px 5px; font-size: .65rem; opacity: 0; transition: opacity .15s; }
.digest-shot:hover .digest-shot-zoom { opacity: 1; }
.digest-hidden { opacity: 0.72; }
.digest-highlight { outline: 2px solid #f59e0b; outline-offset: 2px; border-radius: 8px; }
.field-hint { font-size: .78rem; color: var(--muted); margin-top: 4px; display: block; }
.digest-file-hidden { display: none; }
.digest-file-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.digest-pick { cursor: pointer; }
#digestModal .edit-modal { width: 1000px; max-width: none; }
#digestModal .bookmark-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.digest-modal-body { max-height: 62vh; overflow-y: auto; padding: 12px 0 8px 0; }
#digestModal .digest-modal-body { flex: 0 0 auto; max-height: 62vh; overflow-y: auto; padding: 12px 0 8px 0; }
.digest-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 720px) { .digest-modal-grid { grid-template-columns: 1fr; } }
.digest-modal-col { display: flex; flex-direction: column; gap: 12px; }
.digest-modal-col .settings-field { margin: 0; }
.digest-counter { font-size: .75rem; font-weight: 400; color: var(--muted); margin-left: auto; }
.digest-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400 !important; }
.digest-check input { width: auto; }
#digestModal .edit-modal { display: flex; flex-direction: column; max-height: 85vh; }
#digestModal .digest-modal-body { flex: 0 0 auto; }
#digestModal .card-foot { flex: 0 0 auto; margin-top: 10px; }
</style>
</head>
@@ -57,6 +76,10 @@
<p class="page-sub">Важные сообщения для команды</p>
<button type="button" class="btn-primary digest-new-btn" id="digestNewBtn"><i data-lucide="plus"></i> Новое сообщение</button>
</div>
<div class="digest-toolbar">
<input type="search" id="digestSearch" class="search-input" placeholder="Поиск по заголовку, тексту или автору" autocomplete="off">
<span id="digestCount" class="digest-count"></span>
</div>
<div id="digestList" class="digest-list"></div>
</div>
</div>
@@ -71,20 +94,22 @@
<div class="digest-modal-grid">
<div class="digest-modal-col">
<div class="settings-field">
<label>Заголовок <span style="color:#ef4444">*</span></label>
<label>Заголовок <span style="color:#ef4444">*</span><span class="digest-counter" id="digestTitleCount">0 / 200</span></label>
<input id="digestTitle" class="settings-input" maxlength="200" placeholder="Например: Мероприятия на этой неделе">
</div>
<div class="settings-field">
<label>Текст сообщения <span style="color:#ef4444">*</span></label>
<textarea id="digestBody" class="settings-input" rows="8" placeholder="Что нужно сообщить ученикам и тьюторам..."></textarea>
<label>Текст сообщения <span style="color:#ef4444">*</span><span class="digest-counter" id="digestBodyCount">0 / 5000</span></label>
<textarea id="digestBody" class="settings-input" rows="10" maxlength="5000" placeholder="Что нужно сообщить ученикам и тьюторам..."></textarea>
<span class="field-hint">Курсор в поле текста + Ctrl+V — вставит картинку из буфера обмена.</span>
</div>
<div class="settings-field">
<label class="digest-check"><input type="checkbox" id="digestPinned"> Закрепить в начале списка (только администратор)</label>
<label class="digest-check"><input type="checkbox" id="digestPinned"> Закрепить в начале списка</label>
<span class="field-hint">Доступно администраторам. Закреплённые сообщения всегда сверху.</span>
</div>
<div class="settings-field">
<label>Дата публикации</label>
<input type="datetime-local" id="digestPostAt">
<span class="field-hint">Пусто — опубликовано сразу. Будущая дата — появится автоматически и придет уведомление всем.</span>
<span class="field-hint">Пусто — опубликовано сразу. Будущая дата — появится автоматически для всех и придёт уведомление.</span>
</div>
<div class="settings-field">
<label>Скрыть после</label>
@@ -98,18 +123,21 @@
<div id="digestPreviewWrap" style="position:relative;display:inline-block;margin-top:6px">
<img id="digestPreviewImg" class="digest-preview-img" src="" alt="превью">
</div>
<input type="file" id="digestPreviewFile" accept="image/*" style="margin-top:6px;display:block">
<button type="button" class="btn-link ghost danger" id="digestPreviewRemove" style="margin-top:4px;display:none">Убрать превью</button>
<div class="digest-file-row">
<label class="btn-primary ghost digest-pick" for="digestPreviewFile"><i data-lucide="image-plus"></i> Выбрать файл</label>
<button type="button" class="btn-primary danger-ghost" id="digestPreviewRemove" style="display:none"><i data-lucide="trash-2"></i> Убрать превью</button>
</div>
<input type="file" id="digestPreviewFile" accept="image/*" class="digest-file-hidden">
<span class="field-hint">Обложка сообщения. Загружается при сохранении.</span>
</div>
<div class="settings-field">
<label>Картинки в сообщение</label>
<div id="digestImagesWrap" class="digest-images"></div>
<div style="margin-top:6px">
<input type="file" id="digestImageFile" accept="image/*" multiple>
<button type="button" class="btn-link ghost" id="digestImageAdd" style="margin-left:8px">Добавить картинки</button>
<div class="digest-file-row">
<label class="btn-primary ghost digest-pick" id="digestImageAdd" for="digestImageFile"><i data-lucide="images"></i> Добавить картинки</label>
<input type="file" id="digestImageFile" accept="image/*" multiple class="digest-file-hidden">
</div>
<span class="field-hint">До 20 картинок. Удаление картинки стирает файл с диска. Вставка из буфера — Ctrl+V в поле текста.</span>
<span class="field-hint">До 20 картинок. Удаление картинки стирает файл с диска.</span>
</div>
</div>
</div>