feat(messages): auto-search content on typing (3+ chars, 600ms debounce), no Enter needed
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-03-27 16:07:11 +01:00
parent 7d5d785ca7
commit 6833a664a3
2 changed files with 16 additions and 16 deletions

View File

@ -1959,28 +1959,28 @@
var searchInput = document.getElementById('searchInput');
if (!searchInput) return;
var timer = null;
var nameTimer = null;
var contentTimer = null;
searchInput.addEventListener('input', function () {
clearTimeout(timer);
clearTimeout(nameTimer);
clearTimeout(contentTimer);
var q = searchInput.value.trim();
// Client-side filter for conversation names
timer = setTimeout(function () {
// Instant: filter conversation names (client-side)
nameTimer = setTimeout(function () {
ConversationList.searchFilter(q);
// Clear server results when typing changes
if (q.length < 3) {
Search.clearResults();
}
}, 300);
});
}, 150);
// Enter = search in message content (server-side)
searchInput.addEventListener('keydown', function (e) {
if (e.key === 'Enter') {
e.preventDefault();
var q = searchInput.value.trim();
if (q.length >= 3) {
// Delayed: search message content (server-side, after 600ms)
if (q.length >= 3) {
contentTimer = setTimeout(function () {
Search.searchContent(q);
}
}, 600);
} else {
Search.clearResults();
}
});
},

View File

@ -28,7 +28,7 @@
<circle cx="11" cy="11" r="8"></circle>
<path d="M21 21l-4.35-4.35"></path>
</svg>
<input type="text" id="searchInput" placeholder="Szukaj... (Enter = w treści)">
<input type="text" id="searchInput" placeholder="Szukaj rozmów i wiadomości...">
</div>
<button class="btn-new-conversation" id="newMessageBtn" title="Nowa wiadomość">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@ -228,7 +228,7 @@ window.__CSRF_TOKEN__ = '{{ csrf_token() }}';
// Load conversations.js after data is set
(function() {
var s = document.createElement('script');
s.src = '{{ url_for("static", filename="js/conversations.js") }}?v=12';
s.src = '{{ url_for("static", filename="js/conversations.js") }}?v=13';
document.body.appendChild(s);
})();
{% endblock %}