fix(chat): просмотр фото вложений в модалке, доступ тьюторов к уведомлениям
- изображения во вложениях чата открываются в общей модалке #imgModal (data-img + общий обработчик в admin.js) вместо новой вкладки - Escape и клик по фону закрывают модалку изображения - .chat-side[hidden] скрывается — раньше правило display:none его не покрывало - страница уведомлений открывается любому авторизованному пользователю (checkAuth вместо requireAdminPage), пункт меню виден всем
This commit is contained in:
+1
-1
@@ -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-title{font-size:.95rem;font-weight:600;color:var(--text)}
|
||||||
.chat-empty-sub{font-size:.82rem}
|
.chat-empty-sub{font-size:.82rem}
|
||||||
.chat-main{display:flex;flex-direction:column;min-height:520px}
|
.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{display:flex;align-items:center;gap:11px;padding:12px 16px;border-bottom:1px solid var(--border)}
|
||||||
.chat-head .grow{flex:1}
|
.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}
|
.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}
|
||||||
|
|||||||
@@ -76,6 +76,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-overlay" id="imgModal">
|
||||||
|
<img id="imgModalSrc">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="toast" id="toast"></div>
|
<div class="toast" id="toast"></div>
|
||||||
<script src="vendor/lucide.min.js"></script>
|
<script src="vendor/lucide.min.js"></script>
|
||||||
<script src="js/datetime.js"></script>
|
<script src="js/datetime.js"></script>
|
||||||
|
|||||||
+9
-2
@@ -93,7 +93,7 @@ function chatFilesHtml(files) {
|
|||||||
if (!files || !files.length) return '';
|
if (!files || !files.length) return '';
|
||||||
return `<div class="msg-files">${files.map(f => {
|
return `<div class="msg-files">${files.map(f => {
|
||||||
if (CHAT_IMAGE_EXT.test(f.name || '')) {
|
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">
|
<img src="${chatFileThumbUrl(f)}" alt="${esc(f.name)}" loading="lazy">
|
||||||
<span class="msg-file-name">${esc(f.name)}</span>
|
<span class="msg-file-name">${esc(f.name)}</span>
|
||||||
</a>`;
|
</a>`;
|
||||||
@@ -428,6 +428,7 @@ function initChatPage() {
|
|||||||
const newCancel = document.getElementById('chatNewCancel');
|
const newCancel = document.getElementById('chatNewCancel');
|
||||||
const newOk = document.getElementById('chatNewOk');
|
const newOk = document.getElementById('chatNewOk');
|
||||||
const attachBox = document.getElementById('chatAttachList');
|
const attachBox = document.getElementById('chatAttachList');
|
||||||
|
const imgModal = document.getElementById('imgModal');
|
||||||
|
|
||||||
if (list) {
|
if (list) {
|
||||||
list.addEventListener('click', e => {
|
list.addEventListener('click', e => {
|
||||||
@@ -491,9 +492,15 @@ function initChatPage() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('keydown', e => {
|
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();
|
if (newBtn) newBtn.hidden = !isAdmin();
|
||||||
const side = document.getElementById('chatSide');
|
const side = document.getElementById('chatSide');
|
||||||
const layout = document.getElementById('chatLayout');
|
const layout = document.getElementById('chatLayout');
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ document.getElementById('nfMoreBtn').addEventListener('click', () => loadNotifyP
|
|||||||
document.getElementById('nfReloadBtn').addEventListener('click', () => loadNotifyPage(true));
|
document.getElementById('nfReloadBtn').addEventListener('click', () => loadNotifyPage(true));
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
if (!(await requireAdminPage())) return;
|
if (!(await checkAuth())) return;
|
||||||
buildSidebar(document.body.dataset.page);
|
buildSidebar(document.body.dataset.page);
|
||||||
const clearBtn = document.getElementById('nfClearBtn');
|
const clearBtn = document.getElementById('nfClearBtn');
|
||||||
if (clearBtn) clearBtn.hidden = !isAdmin();
|
if (clearBtn) clearBtn.hidden = !isAdmin();
|
||||||
|
|||||||
Reference in New Issue
Block a user