style(contacts): change existing contacts badge to show total + device count

Format changed from "X/350 (Y cached)" to "Y (🖥 X/350)" where Y is
total known contacts and X is device count, with bi-cpu icon for device.
Applied consistently to both the manage tile and existing contacts header.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-30 08:35:00 +02:00
parent a983210e10
commit 1d9742a1ee
2 changed files with 24 additions and 10 deletions
+10 -8
View File
@@ -263,15 +263,20 @@ async function loadContactCounts() {
pendingBadge.classList.remove('spinner-border', 'spinner-border-sm');
}
// Fetch existing count
const existingResp = await fetch('/api/contacts/detailed');
// Fetch existing count (device + cached in parallel)
const [existingResp, cachedResp] = await Promise.all([
fetch('/api/contacts/detailed'),
fetch('/api/contacts/cached?format=count')
]);
const existingData = await existingResp.json();
const cachedData = await cachedResp.json();
const existingBadge = document.getElementById('existingBadge');
if (existingBadge && existingData.success) {
const count = existingData.count || 0;
const limit = existingData.limit || 350;
existingBadge.textContent = `${count} / ${limit}`;
const totalKnown = cachedData.success ? (cachedData.count || 0) : count;
existingBadge.innerHTML = `${totalKnown} (<i class="bi bi-cpu"></i> ${count}/${limit})`;
existingBadge.classList.remove('spinner-border', 'spinner-border-sm');
// Apply counter color coding
@@ -1872,11 +1877,8 @@ function updateCounter(count, limit, totalKnown) {
const counterEl = document.getElementById('contactsCounter');
if (!counterEl) return;
let text = `${count} / ${limit}`;
if (totalKnown && totalKnown > count) {
text += ` (${totalKnown} cached)`;
}
counterEl.textContent = text;
const total = totalKnown || count;
counterEl.innerHTML = `${total} (<i class="bi bi-cpu"></i> ${count}/${limit})`;
counterEl.style.display = 'inline-block';
// Remove all counter classes