Let streamers set how long messages stay on screen
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 29s
All checks were successful
CI/CD Pipeline / build-and-deploy (push) Successful in 29s
Adds display_duration_seconds to the streamers table (default 10s, with an idempotent migration for existing rows), a dashboard control to change it, and wires the value through to the overlay via the display_message payload instead of a hardcoded 10s. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
fab55cde1d
commit
f4d023c695
4 changed files with 87 additions and 4 deletions
|
|
@ -49,6 +49,28 @@
|
|||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
.settings-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.settings-row input {
|
||||
width: 80px;
|
||||
padding: 8px 10px;
|
||||
font-size: 14px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.settings-row button {
|
||||
padding: 8px 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#settings-status {
|
||||
font-size: 13px;
|
||||
color: #888;
|
||||
margin-top: 8px;
|
||||
min-height: 16px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -73,6 +95,17 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Длительность показа сообщения</h2>
|
||||
<p>Сколько секунд сообщение зрителя остаётся на экране.</p>
|
||||
<div class="settings-row">
|
||||
<input id="display-duration" type="number" min="1" max="120" />
|
||||
<span>сек.</span>
|
||||
<button id="save-duration">Сохранить</button>
|
||||
</div>
|
||||
<div id="settings-status"></div>
|
||||
</div>
|
||||
|
||||
<p id="logout">выйти</p>
|
||||
|
||||
<script>
|
||||
|
|
@ -92,8 +125,26 @@
|
|||
const data = await res.json();
|
||||
document.getElementById('overlay-url').value = data.overlayUrl;
|
||||
document.getElementById('sender-url').value = data.senderUrl;
|
||||
document.getElementById('display-duration').value = data.displayDurationSeconds;
|
||||
}
|
||||
|
||||
document.getElementById('save-duration').addEventListener('click', async () => {
|
||||
const statusEl = document.getElementById('settings-status');
|
||||
const seconds = Number(document.getElementById('display-duration').value);
|
||||
const res = await fetch('/api/settings', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ displayDurationSeconds: seconds }),
|
||||
});
|
||||
if (res.ok) {
|
||||
statusEl.textContent = 'Сохранено';
|
||||
} else {
|
||||
const { error } = await res.json();
|
||||
statusEl.textContent = 'Ошибка: ' + error;
|
||||
}
|
||||
setTimeout(() => { statusEl.textContent = ''; }, 2000);
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-copy]').forEach((btn) => {
|
||||
btn.addEventListener('click', () => {
|
||||
const input = document.getElementById(btn.dataset.copy);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue