Files
WhatIDo/public/bookmarks.html

149 lines
8.6 KiB
HTML

<!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">
<link rel="stylesheet" href="/admin-dark.css" disabled id="themeCss">
<script src="js/theme.js"></script>
<style>
.bookmarks-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 8px; align-items: stretch; }
@media (max-width: 1200px) { .bookmarks-list { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) { .bookmarks-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .bookmarks-list { grid-template-columns: 1fr; } }
.bookmark-card {
position: relative;
background: var(--card);
border: 1px solid var(--border);
border-radius: 12px;
padding: 14px 16px;
display: flex;
flex-direction: column;
gap: 10px;
min-width: 0;
cursor: pointer;
transition: box-shadow .15s, transform .15s, opacity .15s;
}
.bookmark-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.bookmark-card.dragging { opacity: .4; border-style: dashed; }
.bookmark-card.bookmark-hidden { opacity: .55; }
.bookmark-main { display: flex; gap: 12px; align-items: stretch; flex: 1; min-width: 0; }
.bookmark-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.bookmark-cover { width: 100%; height: 130px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; background: var(--bg); }
.bookmark-logo { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--border); background: var(--bg); }
.bookmark-logo-ph { width: 48px; height: 48px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); background: rgba(127,127,127,.12); }
.bookmark-logo-ph svg { width: 20px; height: 20px; }
.bookmark-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.bookmark-title { font-weight: 600; font-size: .95rem; word-break: break-word; min-width: 0; }
.bookmark-badge { padding: 1px 8px; border-radius: 999px; font-size: .68rem; font-weight: 600; background: rgba(239,68,68,.12); color: #ef4444; }
.bookmark-desc { font-size: .85rem; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.bookmark-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;
}
.bookmark-drag:hover { color: var(--text); background: rgba(127,127,127,.15); }
.bookmark-drag:active { cursor: grabbing; }
.bookmark-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; margin-top: auto; }
.bookmark-host { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.bookmark-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bookmark-actions .btn-link { padding: 5px 10px; font-size: .75rem; }
.bookmark-actions .btn-link.danger { color: #ef4444; border-color: rgba(239,68,68,.35); }
.bookmark-actions .btn-link.danger:hover { border-color: #ef4444; }
.bookmark-link { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--accent); text-decoration: none; transition: border-color .15s; }
.bookmark-link:hover { border-color: var(--accent); }
.bookmark-link svg { width: 14px; height: 14px; }
.bookmark-empty { text-align: center; color: var(--muted); padding: 32px 16px; font-size: .9rem; border: 1px dashed var(--border); border-radius: 12px; }
.bookmark-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bookmark-modal-head h3 { margin: 0; font-size: 1.05rem; }
.bookmark-check { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 400; color: var(--text); cursor: pointer; }
.bookmark-photo-controls { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; width: 100%; }
.bookmark-photo-preview { width: 100%; max-height: 180px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.bookmark-photo-actions { display: flex; align-items: center; gap: 8px; }
.bookmark-photo-pick { text-align: center; cursor: pointer; margin: 0; }
.bookmark-photo-actions .btn-link.danger { color: #ef4444; border-color: rgba(239,68,68,.35); }
.bookmark-photo-actions .btn-link.danger:hover { border-color: #ef4444; }
#bookmarkModal .hint { font-size: .78rem; color: var(--muted); line-height: 1.5; display: block; }
</style>
</head>
<body data-page="bookmarks">
<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="bookmarksNewBtn"><i data-lucide="plus"></i> Новая закладка</button>
</div>
<div class="actions-row" style="margin-bottom:16px">
<input type="text" id="bookmarkSearch" class="search-input" placeholder="Поиск по названию..." style="flex:1;min-width:200px;max-width:340px;padding:10px 14px;font-size:.9rem">
</div>
<div id="bookmarksList" class="bookmarks-list"></div>
</div>
</div>
<div class="modal-overlay" id="bookmarkModal">
<div class="edit-modal" style="max-width:560px">
<div class="bookmark-modal-head">
<h3 id="bookmarkModalTitle">Новая закладка</h3>
<button type="button" class="icon-btn" id="bookmarkModalClose"><i data-lucide="x"></i></button>
</div>
<div class="settings-field">
<label>Заголовок <span style="color:#ef4444">*</span></label>
<input id="bookmarkTitle" class="settings-input" maxlength="200" placeholder="Название закладки">
</div>
<div class="settings-field">
<label>Ссылка (URL) <span style="color:#ef4444">*</span></label>
<input id="bookmarkUrl" class="settings-input" maxlength="500" placeholder="https://example.com" autocomplete="off">
</div>
<div class="settings-field">
<label>Краткое описание</label>
<textarea id="bookmarkDescription" class="settings-input" rows="3" maxlength="500" placeholder="Необязательно"></textarea>
</div>
<div class="settings-field">
<label>Картинка</label>
<div class="bookmark-photo-controls">
<img id="bookmarkPhotoPreview" class="bookmark-photo-preview" alt="" style="display:none">
<div class="bookmark-photo-actions">
<label class="btn-primary ghost bookmark-photo-pick" for="bookmarkPhotoFile">Выбрать файл</label>
<input type="file" id="bookmarkPhotoFile" accept="image/*" style="display:none">
<button type="button" id="bookmarkPhotoDeleteBtn" class="btn-link danger" style="display:none">Удалить</button>
</div>
<span id="bookmarkPhotoNote" class="hint"></span>
</div>
</div>
<div class="settings-field">
<label>Режим картинки</label>
<select id="bookmarkImageMode" class="settings-input">
<option value="logo">Логотип (иконка)</option>
<option value="cover">Обложка</option>
</select>
</div>
<div class="settings-field">
<label class="bookmark-check"><input type="checkbox" id="bookmarkOpenNewTab" checked> Открывать в новой вкладке</label>
</div>
<div class="card-foot">
<button type="button" class="btn-primary ghost" id="bookmarkCancel">Отмена</button>
<button type="button" class="btn-primary" id="bookmarkSave">Сохранить</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/bookmarks.js"></script>
</body>
</html>