v1.8.4: единая стилистика — замена confirm/alert/prompt на кастомные модалки, SERVICE_STYLE_GUIDE.md, обновлен AGENTS.md
Tests / test (push) Has been cancelled
Tests / test-max-bot (push) Has been cancelled

This commit is contained in:
2026-06-02 20:40:24 +03:00
parent df34048e2a
commit e184e5fe79
23 changed files with 777 additions and 70 deletions
+36 -17
View File
@@ -10,16 +10,6 @@
.badge.auto_added { background:#cce5ff; color:#004085; }
.badge.reviewed { background:#d4edda; color:#155724; }
.badge.ignored { background:#f8f9fa; color:#6c757d; }
.modal-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.4); z-index:1000; align-items:center; justify-content:center; }
.modal-overlay.open { display:flex; }
.modal-box { background:var(--bg-card); border-radius:12px; padding:30px; width:650px; max-width:90vw; max-height:85vh; overflow-y:auto; }
.modal-box h3 { margin-bottom:20px; }
.form-group { margin-bottom:14px; }
.form-group label { display:block; font-weight:600; margin-bottom:4px; font-size:13px; color:var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:6px; font-size:14px; }
.form-group textarea { min-height:80px; resize:vertical; }
.modal-actions { display:flex; gap:12px; margin-top:16px; }
.filter-bar { display:flex; gap:12px; margin-bottom:16px; align-items:center; }
.filter-bar select { padding:8px 12px; border:1px solid var(--border); border-radius:6px; font-size:13px; }
</style>
@@ -55,8 +45,9 @@
</div>
<div class="modal-overlay" id="uq-modal">
<div class="modal-box">
<h3 id="uq-modal-title">Проверить вопрос</h3>
<div class="modal" style="max-width:650px;">
<button type="button" class="modal-close" onclick="closeModal()"></button>
<h2 id="uq-modal-title">Проверить вопрос</h2>
<form id="uq-form">
<input type="hidden" id="uq-edit-id">
<div class="form-group">
@@ -88,7 +79,7 @@
<option value="8">Отрасли и кейсы</option>
</select>
</div>
<div class="modal-actions">
<div class="modal-actions" style="justify-content:flex-end;">
<button type="submit" class="btn btn-primary">Опубликовать в базу знаний</button>
<button type="button" class="btn" onclick="closeModal()">Отмена</button>
</div>
@@ -96,6 +87,19 @@
</div>
</div>
<div class="modal-overlay" id="confirm-ignore-uq">
<div class="modal" style="max-width:420px;">
<h2 style="font-size:16px;margin-bottom:8px;">Игнорировать вопрос?</h2>
<p style="color:var(--text-secondary);font-size:14px;margin-bottom:20px;">
Вопрос <strong id="ignore-uq-text"></strong> будет отмечен как игнорированный.
</p>
<div class="modal-actions" style="justify-content:flex-end;">
<button type="button" class="btn btn-danger" onclick="confirmIgnoreUQ()">Игнорировать</button>
<button type="button" class="btn" onclick="closeConfirmIgnoreUQ()">Отмена</button>
</div>
</div>
</div>
<script>
var allUQ = [];
@@ -132,8 +136,8 @@ function renderUQ(items){
'<td style="font-size:12px;">' + (q.created_at ? q.created_at.substring(0,10) : '—') + '</td>' +
'<td>';
if(q.status === 'new' || q.status === 'auto_added'){
html += '<button class="btn btn-sm" onclick="openReview(' + q.id + ')" title="Проверить">✏️</button> ';
html += '<button class="btn btn-sm" onclick="ignoreUQ(' + q.id + ')" style="color:#dc3545;" title="Игнорировать">🗑</button>';
html += '<button class="btn btn-secondary btn-sm" onclick="openReview(' + q.id + ')" title="Проверить"></button> ';
html += '<button class="btn btn-danger btn-sm" onclick="openConfirmIgnoreUQ(' + q.id + ', \'' + esc(q.question_text).replace(/'/g, "\\'") + '\')" title="Игнорировать"></button>';
}
html += '</td></tr>';
});
@@ -175,8 +179,23 @@ document.getElementById('uq-form').addEventListener('submit', function(e){
});
});
function ignoreUQ(id){
if(!confirm('Игнорировать вопрос?')) return;
var ignoreUQId = null;
function openConfirmIgnoreUQ(id, text){
ignoreUQId = id;
document.getElementById('ignore-uq-text').textContent = text || '#' + id;
document.getElementById('confirm-ignore-uq').classList.add('open');
}
function closeConfirmIgnoreUQ(){
document.getElementById('confirm-ignore-uq').classList.remove('open');
ignoreUQId = null;
}
function confirmIgnoreUQ(){
if(!ignoreUQId) return;
var id = ignoreUQId;
closeConfirmIgnoreUQ();
fetch('/api/bot/unknown-questions/' + id + '/ignore', { method: 'PUT' })
.then(function(r){ return r.json() }).then(function(d){
if(d.ok){ loadUQ(); showNotification('Игнорировано', 'success'); }