1. обновил инструкцию
2. добавил в админку Добавление обновлений, чтобы не через код
This commit is contained in:
@@ -150,7 +150,8 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.account-modal {
|
||||
.account-modal,
|
||||
.update-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: none;
|
||||
@@ -161,11 +162,13 @@
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.account-modal.active {
|
||||
.account-modal.active,
|
||||
.update-modal.active {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.account-modal-card {
|
||||
.account-modal-card,
|
||||
.update-modal-card {
|
||||
width: min(100%, 460px);
|
||||
background: rgba(12, 17, 26, 0.98);
|
||||
border: 1px solid rgba(0, 255, 136, 0.28);
|
||||
@@ -174,13 +177,21 @@
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.account-modal-title {
|
||||
.update-modal-card {
|
||||
width: min(100%, 760px);
|
||||
max-height: 92vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.account-modal-title,
|
||||
.update-modal-title {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.account-modal-subtitle {
|
||||
.account-modal-subtitle,
|
||||
.update-modal-subtitle {
|
||||
color: var(--muted);
|
||||
margin-bottom: 18px;
|
||||
line-height: 1.5;
|
||||
@@ -200,7 +211,8 @@
|
||||
}
|
||||
|
||||
.field-input,
|
||||
.field-select {
|
||||
.field-select,
|
||||
.field-textarea {
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
border-radius: 12px;
|
||||
@@ -212,12 +224,75 @@
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.field-textarea {
|
||||
min-height: 96px;
|
||||
padding: 12px 14px;
|
||||
resize: vertical;
|
||||
line-height: 1.45;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
.field-input:focus,
|
||||
.field-select:focus {
|
||||
.field-select:focus,
|
||||
.field-textarea:focus {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.12);
|
||||
}
|
||||
|
||||
.update-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 180px;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.update-items-editor {
|
||||
display: grid;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.update-item-form {
|
||||
display: grid;
|
||||
grid-template-columns: 160px minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 14px;
|
||||
background: rgba(255, 255, 255, 0.025);
|
||||
}
|
||||
|
||||
.update-item-text,
|
||||
.update-item-image {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.helper-text {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.add-row-btn {
|
||||
min-height: 38px;
|
||||
padding: 0 14px;
|
||||
border-radius: 999px;
|
||||
border: 1px dashed rgba(0, 255, 136, 0.45);
|
||||
background: rgba(0, 255, 136, 0.06);
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.add-row-btn:hover {
|
||||
background: rgba(0, 255, 136, 0.12);
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.update-form-grid,
|
||||
.update-item-form {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
@@ -308,6 +383,7 @@
|
||||
|
||||
<div class="account-actions">
|
||||
<button type="button" class="account-toggle-btn" id="openCreateAccountBtn">➕ Создать аккаунт</button>
|
||||
<button type="button" class="account-toggle-btn" id="openAddUpdateBtn">📝 Добавить обновление</button>
|
||||
</div>
|
||||
|
||||
{% if account_output %}
|
||||
@@ -339,6 +415,21 @@
|
||||
<pre class="log-output">{{ parser_output }}</pre>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if update_output %}
|
||||
<div class="log-block {% if update_success %}success{% else %}error{% endif %}">
|
||||
<div class="log-title">Добавление обновления</div>
|
||||
<div class="log-status">
|
||||
Статус:
|
||||
{% if update_success %}
|
||||
успешно
|
||||
{% else %}
|
||||
ошибка
|
||||
{% endif %}
|
||||
</div>
|
||||
<pre class="log-output">{{ update_output }}</pre>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -376,6 +467,78 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="updateModal" class="update-modal" aria-hidden="true">
|
||||
<div class="update-modal-card">
|
||||
<div class="update-modal-title">Добавить обновление</div>
|
||||
<div class="update-modal-subtitle">
|
||||
Заполните версию, дату, действия для оператора и пункты изменений. При необходимости добавьте путь к картинке. После сохранения новая версия появится сверху на странице /info.
|
||||
</div>
|
||||
|
||||
<form method="post" action="/admin/db/add-update" id="addUpdateForm">
|
||||
<div class="form-grid">
|
||||
<div class="update-form-grid">
|
||||
<div>
|
||||
<label class="field-label" for="updateVersion">Версия</label>
|
||||
<input class="field-input" id="updateVersion" type="text" name="version" placeholder="1.4" required>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="field-label" for="updateDate">Дата</label>
|
||||
<input class="field-input" id="updateDate" type="date" name="date" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="field-label" for="operatorActions">Что сделать оператору</label>
|
||||
<textarea class="field-textarea" id="operatorActions" name="operator_actions" placeholder="Каждое действие с новой строки">Скачать новый проект vMix перед работой с матчем.
|
||||
Полностью заменить все файлы проекта.</textarea>
|
||||
<div class="helper-text">Каждая строка станет отдельным пунктом списка.</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="field-label">Пункты обновления</label>
|
||||
<div class="update-items-editor" id="updateItemsEditor">
|
||||
<div class="update-item-form">
|
||||
<div>
|
||||
<label class="field-label">Тип</label>
|
||||
<select class="field-select" name="item_badge">
|
||||
<option value="new">Новое</option>
|
||||
<option value="fix">Исправлено</option>
|
||||
<option value="improve">Улучшено</option>
|
||||
<option value="important">Важно</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="field-label">Заголовок</label>
|
||||
<input class="field-input" type="text" name="item_title" placeholder="Например: Верхний счёт" required>
|
||||
</div>
|
||||
|
||||
<div class="update-item-text">
|
||||
<label class="field-label">Описание</label>
|
||||
<textarea class="field-textarea" name="item_text" placeholder="Опишите изменение. Каждая строка станет отдельным абзацем." required></textarea>
|
||||
</div>
|
||||
|
||||
<div class="update-item-image">
|
||||
<label class="field-label">Картинка / скриншот</label>
|
||||
<input class="field-input" type="text" name="item_image" placeholder="Например: /static/docs/no photo.png или просто no photo.png">
|
||||
<div class="helper-text">Картинку нужно положить в static/docs. Если указать только имя файла, система сама подставит /static/docs/.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="add-row-btn" id="addUpdateItemBtn">➕ Добавить ещё пункт</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-actions">
|
||||
<button type="button" class="cancel-btn" id="closeAddUpdateBtn">Отмена</button>
|
||||
<button type="submit" class="submit-btn">Сохранить обновление</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="matrixLoader" class="matrix-loader" aria-hidden="true">
|
||||
<canvas id="matrixCanvas" class="matrix-canvas"></canvas>
|
||||
<div class="matrix-content">
|
||||
@@ -394,6 +557,12 @@
|
||||
const openCreateAccountBtn = document.getElementById("openCreateAccountBtn");
|
||||
const closeCreateAccountBtn = document.getElementById("closeCreateAccountBtn");
|
||||
const accountModal = document.getElementById("accountModal");
|
||||
const openAddUpdateBtn = document.getElementById("openAddUpdateBtn");
|
||||
const closeAddUpdateBtn = document.getElementById("closeAddUpdateBtn");
|
||||
const updateModal = document.getElementById("updateModal");
|
||||
const updateDate = document.getElementById("updateDate");
|
||||
const addUpdateItemBtn = document.getElementById("addUpdateItemBtn");
|
||||
const updateItemsEditor = document.getElementById("updateItemsEditor");
|
||||
let drops = [];
|
||||
let fontSize = 18;
|
||||
let columns = 0;
|
||||
@@ -463,6 +632,37 @@
|
||||
accountModal.setAttribute("aria-hidden", "true");
|
||||
}
|
||||
|
||||
function openUpdateModal() {
|
||||
if (!updateModal) return;
|
||||
if (updateDate && !updateDate.value) {
|
||||
updateDate.value = new Date().toISOString().slice(0, 10);
|
||||
}
|
||||
updateModal.classList.add("active");
|
||||
updateModal.setAttribute("aria-hidden", "false");
|
||||
}
|
||||
|
||||
function closeUpdateModal() {
|
||||
if (!updateModal) return;
|
||||
updateModal.classList.remove("active");
|
||||
updateModal.setAttribute("aria-hidden", "true");
|
||||
}
|
||||
|
||||
function addUpdateItem() {
|
||||
if (!updateItemsEditor) return;
|
||||
const firstItem = updateItemsEditor.querySelector(".update-item-form");
|
||||
if (!firstItem) return;
|
||||
const clone = firstItem.cloneNode(true);
|
||||
|
||||
clone.querySelectorAll("input, textarea").forEach((field) => {
|
||||
field.value = "";
|
||||
});
|
||||
clone.querySelectorAll("select").forEach((field) => {
|
||||
field.selectedIndex = 0;
|
||||
});
|
||||
|
||||
updateItemsEditor.appendChild(clone);
|
||||
}
|
||||
|
||||
parserForms.forEach((form) => {
|
||||
form.addEventListener("submit", () => {
|
||||
const parserTitle = form.dataset.parserTitle || "Запуск парсера";
|
||||
@@ -492,12 +692,38 @@
|
||||
});
|
||||
}
|
||||
|
||||
if (openAddUpdateBtn) {
|
||||
openAddUpdateBtn.addEventListener("click", openUpdateModal);
|
||||
}
|
||||
|
||||
if (closeAddUpdateBtn) {
|
||||
closeAddUpdateBtn.addEventListener("click", closeUpdateModal);
|
||||
}
|
||||
|
||||
if (updateModal) {
|
||||
updateModal.addEventListener("click", (event) => {
|
||||
if (event.target === updateModal) {
|
||||
closeUpdateModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (addUpdateItemBtn) {
|
||||
addUpdateItemBtn.addEventListener("click", addUpdateItem);
|
||||
}
|
||||
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "Escape") {
|
||||
closeAccountModal();
|
||||
closeUpdateModal();
|
||||
}
|
||||
});
|
||||
|
||||
const queryParams = new URLSearchParams(window.location.search);
|
||||
if (queryParams.get("open_update") === "1") {
|
||||
openUpdateModal();
|
||||
}
|
||||
|
||||
resizeCanvas();
|
||||
window.addEventListener("resize", resizeCanvas);
|
||||
</script>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user