feat(notes): личные заметки с drag-and-drop сортировкой
- Новая страница notes.html и контроллер public/js/notes.js - Таблица user_notes (id, user_id, title, note, tags, color, sort_order) - Сохранение порядка карточек через PUT /api/notes/reorder - Личные заметки администратора видны всем, тьюторы — только своим - Поддержка user_notes в бэкапе и восстановлении (backup-restore.js) - Обновлена документация AGENTS.md
This commit is contained in:
+7
-2
@@ -39,9 +39,13 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;b
|
||||
|
||||
.sidebar nav a[data-nav=dashboard] svg{color:#6366f1}
|
||||
.sidebar nav a[data-nav=journal] svg{color:#0ea5e9}
|
||||
.sidebar nav a[data-nav=lessons] svg{color:#f97316}
|
||||
.sidebar nav a[data-nav=notifications] svg{color:#f59e0b}
|
||||
.sidebar nav a[data-nav=students] svg{color:#14b8a6}
|
||||
.sidebar nav a[data-nav=groups] svg{color:#8b5cf6}
|
||||
.sidebar nav a[data-nav=feedback] svg{color:#f43f5e}
|
||||
.sidebar nav a[data-nav=shorts] svg{color:#eab308}
|
||||
.sidebar nav a[data-nav=chat] svg{color:#22c55e}
|
||||
.sidebar nav a[data-nav=files] svg{color:#f59e0b}
|
||||
.sidebar nav a[data-nav=photos] svg{color:#0891b2}
|
||||
.sidebar nav a[data-nav=links] svg{color:#06b6d4}
|
||||
@@ -102,13 +106,14 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;b
|
||||
.card .info{flex:1;min-width:0}
|
||||
.card .name{font-weight:600;font-size:.95rem}
|
||||
.card .group{color:var(--accent);font-size:.8rem;margin-top:2px}
|
||||
.card .desc{color:var(--muted);font-size:.85rem;margin-top:8px;line-height:1.4;white-space:pre-wrap}
|
||||
.card .desc{color:var(--muted);font-size:.85rem;margin-top:8px;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}
|
||||
.card .time{color:var(--muted);font-size:.75rem;margin-top:8px}
|
||||
.entry-files{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:8px}
|
||||
.entry-files .f-item{display:flex;align-items:center;gap:2px;background:var(--bg);border:1px solid var(--border);border-radius:6px;padding:2px;min-width:0}
|
||||
.entry-files .f-item:hover{border-color:var(--accent)}
|
||||
.entry-files .f-item a{display:inline-flex;align-items:center;gap:4px;color:var(--text);text-decoration:none;padding:2px 6px;font-size:.75rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}
|
||||
.entry-files .f-item a:hover{color:var(--accent)}
|
||||
.entry-files .f-link{display:block;max-width:100%;color:var(--text);text-decoration:none;padding:2px 6px;font-size:.75rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.entry-files .f-item a::before{content:'📎'}
|
||||
.entry-files .f-detach{flex-shrink:0;background:none;border:none;color:var(--muted);cursor:pointer;font-size:.75rem;line-height:1;padding:2px 5px;border-radius:4px}
|
||||
.entry-files .f-detach:hover{color:#ef4444;background:rgba(239,68,68,.1)}
|
||||
@@ -138,7 +143,7 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;b
|
||||
.journal-card .no-photo svg *{fill:currentColor}
|
||||
.journal-card .body{padding:12px 14px;display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}
|
||||
.journal-card .name{font-weight:600;font-size:.95rem}
|
||||
.journal-card .desc{color:var(--muted);font-size:.85rem;line-height:1.4;white-space:pre-wrap;flex:1}
|
||||
.journal-card .desc{color:var(--muted);font-size:.85rem;line-height:1.4;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;flex:1}
|
||||
.journal-card .foot{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:10px 14px;border-top:1px solid var(--border);color:var(--muted);font-size:.75rem}
|
||||
.journal-card .foot .edit,.journal-card .foot .del{background:none;border:none;color:var(--muted);cursor:pointer;font-size:1rem;padding:4px}
|
||||
.journal-card .foot .edit:hover{color:var(--accent)}
|
||||
|
||||
+13
-12
@@ -51,26 +51,27 @@ function buildSidebar(active) {
|
||||
{ page: 'dashboard', label: 'Дашборд', icon: 'layout-dashboard' },
|
||||
{ page: 'journal', label: 'Журнал', icon: 'book-open' },
|
||||
{ page: 'lessons', label: 'Отчёты о занятиях', icon: 'notebook-pen' },
|
||||
{ page: 'feedback', label: 'Обратная связь', icon: 'message-square-heart' },
|
||||
{ page: 'notifications', label: 'Уведомления', icon: 'bell', badge: true },
|
||||
{ page: 'chat', label: 'Чаты', icon: 'messages-square', chatBadge: true },
|
||||
{ page: 'students', label: 'Ученики', icon: 'graduation-cap' },
|
||||
{ page: 'groups', label: 'Группы', icon: 'users' },
|
||||
{ page: 'feedback', label: 'Обратная связь', icon: 'message-square-heart' },
|
||||
{ page: 'shorts', label: 'Короткие сообщения', icon: 'zap' },
|
||||
{ page: 'chat', label: 'Чаты', icon: 'messages-square', chatBadge: true },
|
||||
{ page: 'notifications', label: 'Уведомления', icon: 'bell', badge: true },
|
||||
{ page: 'photos', label: 'Фото', icon: 'Image' },
|
||||
{ page: 'files', label: 'Файлы', icon: 'folder' },
|
||||
{ page: 'links', label: 'Ссылки', icon: 'link' },
|
||||
{ page: 'shorts', label: 'Короткие сообщения', icon: 'zap' },
|
||||
{ page: 'trash', label: 'Корзина', icon: 'trash-2' },
|
||||
{ page: 'notes', label: 'Заметки', icon: 'sticky-note' },
|
||||
];
|
||||
const adminNav = [
|
||||
{ page: 'modules', label: 'Темы модулей', icon: 'layers' },
|
||||
{ page: 'branches', label: 'Филиалы', icon: 'building-2' },
|
||||
{ page: 'users', label: 'Пользователи', icon: 'user-cog' },
|
||||
{ page: 'apikeys', label: 'API-ключи', icon: 'key-round' },
|
||||
{ page: 'worker', label: 'Воркер ИИ', icon: 'bot' },
|
||||
{ page: 'audit', label: 'Аудит', icon: 'scroll-text' },
|
||||
{ page: 'bans', label: 'Блокировки', icon: 'shield-off' },
|
||||
{ page: 'settings', label: 'Настройки', icon: 'settings' },
|
||||
{ page: 'modules', label: 'Темы модулей', icon: 'layers' },
|
||||
{ page: 'users', label: 'Пользователи', icon: 'user-cog' },
|
||||
{ page: 'branches', label: 'Филиалы', icon: 'building-2' },
|
||||
{ page: 'audit', label: 'Аудит', icon: 'scroll-text' },
|
||||
{ page: 'worker', label: 'Воркер ИИ', icon: 'bot' },
|
||||
{ page: 'apikeys', label: 'API-ключи', icon: 'key-round' },
|
||||
{ page: 'bans', label: 'Блокировки', icon: 'shield-off' },
|
||||
];
|
||||
const userName = currentUser?.name || currentUser?.username || '';
|
||||
const roleLabel = isAdmin() ? 'Администратор' : 'Тутор';
|
||||
@@ -1055,4 +1056,4 @@ document.addEventListener('click', e => {
|
||||
if (imgEl) { e.preventDefault(); showImg(imgEl.dataset.img); return; }
|
||||
const out = e.target.closest('[data-action="logout"]');
|
||||
if (out) { e.preventDefault(); doLogout(); }
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
<title>Обратная связь — WhatIDo</title>
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<style>
|
||||
.feedback-list { display:flex; flex-direction:column; gap:10px; }
|
||||
.feedback-list { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px; }
|
||||
.feedback-list > .empty, .feedback-list > .muted { grid-column:1/-1; }
|
||||
@media (max-width:1000px) { .feedback-list { grid-template-columns:1fr; } }
|
||||
.feedback-item .ai-badge { margin-left:0; }
|
||||
.feedback-item .btn-link.sent-on { background:var(--accent); color:#fff; border-color:var(--accent); }
|
||||
.shorts-list { display:flex; flex-direction:column; gap:6px; width:100%; max-height:220px; overflow:auto; padding:2px 0; }
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
(async function() {
|
||||
'use strict';
|
||||
const API = location.origin;
|
||||
let notes = [];
|
||||
let editingId = null;
|
||||
let dragId = null;
|
||||
|
||||
function hdr() {
|
||||
const t = sessionStorage.getItem('authToken');
|
||||
return t ? { 'X-Auth-Token': t } : {};
|
||||
}
|
||||
|
||||
function esc(s) {
|
||||
return String(s || '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function fmtTs(v) {
|
||||
try { if (window.datetime && datetime.fmtDateTime) return datetime.fmtDateTime(v) || String(v); } catch (e) {}
|
||||
return String(v);
|
||||
}
|
||||
|
||||
function noteCardHtml(n) {
|
||||
const color = /^#[0-9a-fA-F]{6}$/.test(n.color || '') ? n.color : '#2563eb';
|
||||
const tags = n.tags ? n.tags.split(',').map(t => t.trim()).filter(Boolean) : [];
|
||||
const tagsHtml = tags.length
|
||||
? '<div class="note-tags">' + tags.map(t => '<span class="note-tag">' + esc(t) + '</span>').join('') + '</div>'
|
||||
: '';
|
||||
const body = n.note
|
||||
? esc(n.note)
|
||||
: '<span class="note-empty-note">Без текста</span>';
|
||||
return '<div class="note-card" data-id="' + n.id + '" style="--ncolor:' + color + '">' +
|
||||
'<div class="note-card-head">' +
|
||||
'<span class="note-drag" draggable="true" title="Перетащите, чтобы изменить порядок">⠿</span>' +
|
||||
'<div class="note-color-row" data-action="color" data-id="' + n.id + '">' +
|
||||
'<input type="color" id="noteColorPicker-' + n.id + '" value="' + color + '" style="display:none">' +
|
||||
'<span class="note-color-swatch" style="background:' + color + '" title="Изменить цвет"></span>' +
|
||||
'</div>' +
|
||||
'<div class="note-card-title">' + esc(n.title || 'Без заголовка') + '</div>' +
|
||||
tagsHtml +
|
||||
'</div>' +
|
||||
'<div class="note-card-note">' + body + '</div>' +
|
||||
'<div class="note-card-foot">' +
|
||||
'<span class="note-card-time">' + esc(fmtTs(n.updated_at)) + '</span>' +
|
||||
'<div class="note-card-actions">' +
|
||||
'<button type="button" class="btn-link" data-action="edit" data-id="' + n.id + '">Изменить</button>' +
|
||||
'<button type="button" class="btn-link danger" data-action="delete" data-id="' + n.id + '">Удалить</button>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
}
|
||||
|
||||
function renderNotes() {
|
||||
const el = document.getElementById('notesList');
|
||||
if (!el) return;
|
||||
if (!notes.length) {
|
||||
el.innerHTML = '<div class="note-empty">Заметок пока нет. Нажмите «Новая заметка», чтобы создать первую заметку.</div>';
|
||||
return;
|
||||
}
|
||||
el.innerHTML = notes.map(noteCardHtml).join('');
|
||||
}
|
||||
|
||||
async function persistNoteOrder() {
|
||||
const els = Array.prototype.slice.call(document.querySelectorAll('#notesList .note-card'));
|
||||
const order = els.map(function (el) { return parseInt(el.dataset.id, 10); });
|
||||
if (JSON.stringify(order) === JSON.stringify(notes.map(function (n) { return n.id; }))) return;
|
||||
let res;
|
||||
try {
|
||||
res = await fetch(API + '/api/notes/reorder', {
|
||||
method: 'PUT',
|
||||
headers: Object.assign({ 'Content-Type': 'application/json' }, hdr()),
|
||||
body: JSON.stringify({ ids: order })
|
||||
});
|
||||
} catch (e) {
|
||||
showToast('Ошибка сети', true);
|
||||
renderNotes();
|
||||
return;
|
||||
}
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(function () { return {}; });
|
||||
showToast(data.error || 'Не удалось сохранить порядок заметок', true);
|
||||
renderNotes();
|
||||
return;
|
||||
}
|
||||
notes = order.map(function (id) {
|
||||
return notes.find(function (n) { return n.id === id; });
|
||||
}).filter(Boolean);
|
||||
showToast('Порядок заметок сохранён');
|
||||
}
|
||||
|
||||
function bindDrag() {
|
||||
const list = document.getElementById('notesList');
|
||||
if (!list) return;
|
||||
list.addEventListener('dragstart', function (e) {
|
||||
const handle = e.target.closest('.note-drag');
|
||||
if (!handle) { e.preventDefault(); return; }
|
||||
const card = handle.closest('.note-card');
|
||||
if (!card) return;
|
||||
dragId = parseInt(card.dataset.id, 10);
|
||||
card.classList.add('dragging');
|
||||
e.dataTransfer.effectAllowed = 'move';
|
||||
e.dataTransfer.setData('text/plain', String(dragId));
|
||||
try { e.dataTransfer.setDragImage(card, 24, 24); } catch (err) {}
|
||||
});
|
||||
list.addEventListener('dragover', function (e) {
|
||||
if (dragId == null) return;
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = 'move';
|
||||
const target = e.target.closest('.note-card');
|
||||
const dragged = list.querySelector('.note-card[data-id="' + dragId + '"]');
|
||||
if (!target || !dragged || target === dragged || target.contains(dragged)) return;
|
||||
const rect = target.getBoundingClientRect();
|
||||
list.insertBefore(dragged, e.clientX > rect.left + rect.width / 2 ? target.nextSibling : target);
|
||||
});
|
||||
list.addEventListener('dragend', function (e) {
|
||||
const card = e.target.closest('.note-card');
|
||||
if (card) card.classList.remove('dragging');
|
||||
if (dragId != null) persistNoteOrder();
|
||||
dragId = null;
|
||||
});
|
||||
list.addEventListener('drop', function (e) { e.preventDefault(); });
|
||||
}
|
||||
|
||||
function openModal(note) {
|
||||
editingId = note ? note.id : null;
|
||||
document.getElementById('notesModalTitle').textContent = note ? 'Редактировать заметку' : 'Новая заметка';
|
||||
document.getElementById('notesTitle').value = note ? note.title : '';
|
||||
document.getElementById('notesNote').value = note ? note.note : '';
|
||||
document.getElementById('notesTags').value = note ? note.tags : '';
|
||||
const color = note && /^#[0-9a-fA-F]{6}$/.test(note.color || '') ? note.color : '#2563eb';
|
||||
document.getElementById('notesColor').value = color;
|
||||
document.getElementById('notesColorPreview').style.background = color;
|
||||
const row = document.getElementById('notesColorRow');
|
||||
if (row) row.style.setProperty('--ncolor', color);
|
||||
document.getElementById('notesModal').classList.add('open');
|
||||
renderIcons();
|
||||
setTimeout(() => document.getElementById('notesTitle').focus(), 50);
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
const m = document.getElementById('notesModal');
|
||||
if (m) m.classList.remove('open');
|
||||
editingId = null;
|
||||
}
|
||||
|
||||
async function saveNote() {
|
||||
const title = document.getElementById('notesTitle').value.trim();
|
||||
const noteText = document.getElementById('notesNote').value.trim();
|
||||
const rawTags = document.getElementById('notesTags').value.trim();
|
||||
const tags = rawTags ? rawTags.split(',').map(t => t.trim()).filter(Boolean).slice(0, 10).join(', ') : '';
|
||||
const color = document.getElementById('notesColor').value;
|
||||
if (!title) { showToast('Укажите заголовок заметки', true); return; }
|
||||
const payload = { title: title, note: noteText, tags: tags, color: color };
|
||||
let res;
|
||||
try {
|
||||
if (editingId) {
|
||||
res = await fetch(API + '/api/notes/' + editingId, { method: 'PUT', headers: Object.assign({ 'Content-Type': 'application/json' }, hdr()), body: JSON.stringify(payload) });
|
||||
} else {
|
||||
res = await fetch(API + '/api/notes', { method: 'POST', headers: Object.assign({ 'Content-Type': 'application/json' }, hdr()), body: JSON.stringify(payload) });
|
||||
}
|
||||
} catch (e) {
|
||||
showToast('Ошибка сети', true);
|
||||
return;
|
||||
}
|
||||
const data = await res.json().catch(function () { return {}; });
|
||||
if (!res.ok) {
|
||||
showToast(data.error || 'Ошибка при сохранении', true);
|
||||
return;
|
||||
}
|
||||
const item = data.item || payload;
|
||||
if (editingId) {
|
||||
const idx = notes.findIndex(function (n) { return n.id === editingId; });
|
||||
if (idx >= 0) notes[idx] = item;
|
||||
showToast('Заметка обновлена');
|
||||
} else {
|
||||
notes.unshift(item);
|
||||
showToast('Заметка сохранена');
|
||||
}
|
||||
renderNotes();
|
||||
closeModal();
|
||||
}
|
||||
|
||||
async function removeNote(id) {
|
||||
if (!confirm('Удалить эту заметку?')) return;
|
||||
let res;
|
||||
try {
|
||||
res = await fetch(API + '/api/notes/' + id, { method: 'DELETE', headers: hdr() });
|
||||
} catch (e) {
|
||||
showToast('Ошибка сети', true);
|
||||
return;
|
||||
}
|
||||
const data = await res.json().catch(function () { return {}; });
|
||||
if (!res.ok) {
|
||||
showToast(data.error || 'Ошибка при удалении', true);
|
||||
return;
|
||||
}
|
||||
notes = notes.filter(function (n) { return n.id !== id; });
|
||||
renderNotes();
|
||||
showToast('Заметка удалена');
|
||||
}
|
||||
|
||||
function bindModal() {
|
||||
document.getElementById('notesModalClose').addEventListener('click', closeModal);
|
||||
document.getElementById('notesCancel').addEventListener('click', closeModal);
|
||||
document.getElementById('notesSave').addEventListener('click', saveNote);
|
||||
const colorInput = document.getElementById('notesColor');
|
||||
if (colorInput) {
|
||||
colorInput.addEventListener('input', function (e) {
|
||||
document.getElementById('notesColorPreview').style.background = e.target.value;
|
||||
const row = document.getElementById('notesColorRow');
|
||||
if (row) row.style.setProperty('--ncolor', e.target.value);
|
||||
});
|
||||
}
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key !== 'Escape') return;
|
||||
const m = document.getElementById('notesModal');
|
||||
if (m && m.classList.contains('open')) closeModal();
|
||||
});
|
||||
}
|
||||
|
||||
function bindPage() {
|
||||
bindDrag();
|
||||
document.addEventListener('click', async function (e) {
|
||||
const editBtn = e.target.closest('[data-action="edit"]');
|
||||
if (editBtn) {
|
||||
const id = parseInt(editBtn.dataset.id, 10);
|
||||
const note = notes.find(function (n) { return n.id === id; });
|
||||
if (note) openModal(note);
|
||||
return;
|
||||
}
|
||||
const delBtn = e.target.closest('[data-action="delete"]');
|
||||
if (delBtn) {
|
||||
await removeNote(parseInt(delBtn.dataset.id, 10));
|
||||
return;
|
||||
}
|
||||
const colorRow = e.target.closest('[data-action="color"]');
|
||||
if (colorRow) {
|
||||
const picker = document.getElementById('noteColorPicker-' + parseInt(colorRow.dataset.id, 10));
|
||||
if (picker) {
|
||||
picker.click();
|
||||
picker.onchange = async function () {
|
||||
const id = parseInt(colorRow.dataset.id, 10);
|
||||
const note = notes.find(function (n) { return n.id === id; });
|
||||
if (!note) return;
|
||||
let res;
|
||||
try {
|
||||
res = await fetch(API + '/api/notes/' + id, {
|
||||
method: 'PUT',
|
||||
headers: Object.assign({ 'Content-Type': 'application/json' }, hdr()),
|
||||
body: JSON.stringify({ title: note.title, note: note.note, tags: note.tags, color: picker.value })
|
||||
});
|
||||
} catch (err) {
|
||||
showToast('Ошибка сети', true);
|
||||
return;
|
||||
}
|
||||
const data = await res.json().catch(function () { return {}; });
|
||||
if (!res.ok) { showToast(data.error || 'Ошибка при сохранении', true); return; }
|
||||
const idx = notes.findIndex(function (n) { return n.id === id; });
|
||||
if (idx >= 0) notes[idx] = data.item;
|
||||
renderNotes();
|
||||
showToast('Цвет обновлён');
|
||||
};
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (e.target.closest('#notesNewBtn')) openModal(null);
|
||||
});
|
||||
}
|
||||
|
||||
async function loadNotes() {
|
||||
let res;
|
||||
try {
|
||||
res = await fetch(API + '/api/notes', { headers: hdr() });
|
||||
} catch (e) {
|
||||
showToast('Ошибка сети при загрузке заметок', true);
|
||||
return;
|
||||
}
|
||||
if (res.ok) {
|
||||
const data = await res.json().catch(function () { return {}; });
|
||||
notes = data.items || [];
|
||||
renderNotes();
|
||||
}
|
||||
}
|
||||
|
||||
async function init() {
|
||||
if (!(await checkAuth())) return;
|
||||
buildSidebar(document.body.dataset.page);
|
||||
bindModal();
|
||||
bindPage();
|
||||
renderIcons();
|
||||
await loadNotes();
|
||||
}
|
||||
|
||||
init();
|
||||
})();
|
||||
@@ -0,0 +1,116 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Заметки — Админ-панель</title>
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<style>
|
||||
.notes-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 8px; align-items: stretch; }
|
||||
@media (max-width: 1200px) { .notes-list { grid-template-columns: repeat(3, 1fr); } }
|
||||
@media (max-width: 900px) { .notes-list { grid-template-columns: repeat(2, 1fr); } }
|
||||
@media (max-width: 640px) { .notes-list { grid-template-columns: 1fr; } }
|
||||
.note-card {
|
||||
position: relative;
|
||||
background: var(--card);
|
||||
border: 1px solid var(--border);
|
||||
border-left: 4px solid;
|
||||
border-radius: 12px;
|
||||
padding: 14px 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
transition: box-shadow .15s, transform .15s, opacity .15s;
|
||||
}
|
||||
.note-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.08); }
|
||||
.note-card.dragging { opacity: .4; border-style: dashed; }
|
||||
.note-drag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
flex: none;
|
||||
color: var(--muted);
|
||||
font-size: .85rem;
|
||||
cursor: grab;
|
||||
border-radius: 6px;
|
||||
transition: color .15s, background .15s;
|
||||
}
|
||||
.note-drag:hover { color: var(--text); background: rgba(127,127,127,.15); }
|
||||
.note-drag:active { cursor: grabbing; }
|
||||
.note-card-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
||||
.note-color-row { display: flex; align-items: center; gap: 10px; }
|
||||
.note-color-swatch { width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--border); flex: none; cursor: pointer; transition: transform .15s; }
|
||||
.note-color-swatch:hover { transform: scale(1.15); }
|
||||
.note-card-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
|
||||
.note-card-title { font-weight: 600; font-size: .95rem; color: var(--ncolor); word-break: break-word; }
|
||||
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.note-tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(37,99,235,.1); color: #1d4ed8; border: 1px solid rgba(37,99,235,.2); }
|
||||
.note-card-note { font-size: .88rem; color: var(--text); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.note-empty-note { color: var(--muted); font-style: italic; font-size: .85rem; }
|
||||
.note-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
|
||||
.note-card-time { font-size: .72rem; color: var(--muted); }
|
||||
.note-card-actions { display: flex; gap: 6px; }
|
||||
.note-card-actions button { font-size: .78rem; }
|
||||
.note-empty { text-align: center; color: var(--muted); padding: 32px 16px; font-size: .9rem; border: 1px dashed var(--border); border-radius: 12px; }
|
||||
.note-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
||||
.note-modal-head h3 { margin: 0; font-size: 1.05rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body data-page="notes">
|
||||
<div class="layout">
|
||||
<div class="sidebar" id="sidebar"></div>
|
||||
<div class="main">
|
||||
<div class="page-head">
|
||||
<h2>Заметки</h2>
|
||||
<p class="page-sub">Личные заметки для каждого пользователя</p>
|
||||
<button type="button" class="btn-primary" id="notesNewBtn"><i data-lucide="plus"></i> Новая заметка</button>
|
||||
</div>
|
||||
<div id="notesList" class="notes-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-overlay" id="notesModal">
|
||||
<div class="edit-modal" style="max-width:560px">
|
||||
<div class="note-modal-head">
|
||||
<h3 id="notesModalTitle">Новая заметка</h3>
|
||||
<button type="button" class="icon-btn" id="notesModalClose"><i data-lucide="x"></i></button>
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Заголовок</label>
|
||||
<input id="notesTitle" class="settings-input" maxlength="200" placeholder="Краткое название заметки">
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Заметка</label>
|
||||
<textarea id="notesNote" class="settings-input" rows="6" placeholder="Текст заметки"></textarea>
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Теги</label>
|
||||
<input id="notesTags" class="settings-input" placeholder="через запятую: важно, учеба, запланировать">
|
||||
<div class="hint">Теги разделяются запятой</div>
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Цвет</label>
|
||||
<div class="note-color-row" id="notesColorRow">
|
||||
<input id="notesColor" type="color" class="settings-input" value="#2563eb" style="width:56px;height:42px;padding:5px;border-radius:8px;cursor:pointer">
|
||||
<span id="notesColorPreview" style="width:16px;height:16px;border-radius:6px;border:1px solid var(--border);flex:none;background:#2563eb"></span>
|
||||
<div class="hint">Цвет заметки</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-foot">
|
||||
<button type="button" class="btn-primary ghost" id="notesCancel">Отмена</button>
|
||||
<button type="button" class="btn-primary" id="notesSave">Сохранить</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script src="vendor/lucide.min.js"></script>
|
||||
<script src="js/datetime.js"></script>
|
||||
<script src="admin.js"></script>
|
||||
<script src="js/notes.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user