fix(chat): просмотр фото вложений в модалке, доступ тьюторов к уведомлениям

- изображения во вложениях чата открываются в общей модалке #imgModal
  (data-img + общий обработчик в admin.js) вместо новой вкладки
- Escape и клик по фону закрывают модалку изображения
- .chat-side[hidden] скрывается — раньше правило display:none его не покрывало
- страница уведомлений открывается любому авторизованному пользователю
  (checkAuth вместо requireAdminPage), пункт меню виден всем
This commit is contained in:
dev
2026-10-05 17:51:37 +03:00
parent 235fd43af4
commit 7e4b1a1324
4 changed files with 15 additions and 4 deletions
+1 -1
View File
@@ -936,7 +936,7 @@ body.report-card-open .report-fields{display:flex}
.chat-empty-title{font-size:.95rem;font-weight:600;color:var(--text)}
.chat-empty-sub{font-size:.82rem}
.chat-main{display:flex;flex-direction:column;min-height:520px}
.chat-empty[hidden],.chat-main[hidden],.chat-attach-list[hidden],.chat-new-btn[hidden]{display:none}
.chat-side[hidden],.chat-empty[hidden],.chat-main[hidden],.chat-attach-list[hidden],.chat-new-btn[hidden]{display:none}
.chat-head{display:flex;align-items:center;gap:11px;padding:12px 16px;border-bottom:1px solid var(--border)}
.chat-head .grow{flex:1}
.chat-avatar{width:36px;height:36px;border-radius:10px;background:rgba(37,99,235,.1);color:var(--accent);display:flex;align-items:center;justify-content:center;font-weight:700;flex-shrink:0}
+4
View File
@@ -76,6 +76,10 @@
</div>
</div>
<div class="modal-overlay" id="imgModal">
<img id="imgModalSrc">
</div>
<div class="toast" id="toast"></div>
<script src="vendor/lucide.min.js"></script>
<script src="js/datetime.js"></script>
+9 -2
View File
@@ -93,7 +93,7 @@ function chatFilesHtml(files) {
if (!files || !files.length) return '';
return `<div class="msg-files">${files.map(f => {
if (CHAT_IMAGE_EXT.test(f.name || '')) {
return `<a class="msg-file msg-file-img" href="${chatFileUrl(f)}" target="_blank" rel="noopener">
return `<a class="msg-file msg-file-img" href="${chatFileUrl(f)}" data-img="${esc(chatFileUrl(f))}" title="Открыть">
<img src="${chatFileThumbUrl(f)}" alt="${esc(f.name)}" loading="lazy">
<span class="msg-file-name">${esc(f.name)}</span>
</a>`;
@@ -428,6 +428,7 @@ function initChatPage() {
const newCancel = document.getElementById('chatNewCancel');
const newOk = document.getElementById('chatNewOk');
const attachBox = document.getElementById('chatAttachList');
const imgModal = document.getElementById('imgModal');
if (list) {
list.addEventListener('click', e => {
@@ -491,9 +492,15 @@ function initChatPage() {
});
document.addEventListener('keydown', e => {
if (e.key === 'Escape' && newModal && newModal.classList.contains('open')) newModal.classList.remove('open');
if (e.key !== 'Escape') return;
if (imgModal && imgModal.classList.contains('open')) { imgModal.classList.remove('open'); return; }
if (newModal && newModal.classList.contains('open')) newModal.classList.remove('open');
});
if (imgModal) {
imgModal.addEventListener('click', e => e.currentTarget.classList.remove('open'));
}
if (newBtn) newBtn.hidden = !isAdmin();
const side = document.getElementById('chatSide');
const layout = document.getElementById('chatLayout');
+1 -1
View File
@@ -88,7 +88,7 @@ document.getElementById('nfMoreBtn').addEventListener('click', () => loadNotifyP
document.getElementById('nfReloadBtn').addEventListener('click', () => loadNotifyPage(true));
(async () => {
if (!(await requireAdminPage())) return;
if (!(await checkAuth())) return;
buildSidebar(document.body.dataset.page);
const clearBtn = document.getElementById('nfClearBtn');
if (clearBtn) clearBtn.hidden = !isAdmin();