feat(desktop): unread-chat count badge on the taskbar icon
Mirrors the rail's unread-chat count onto the Windows taskbar icon (overlay) and the macOS/Linux dock badge. updateRailUnread() draws a small red count badge on a canvas and hands it to the shell via bizConnectNative.setUnread(count, dataUrl); main sets it with win.setOverlayIcon + app.setBadgeCount. Clears at 0, shows 99+ past 99. No-op in a browser/mobile. (home.html build batch17) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+19
-1
@@ -721,7 +721,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="/icons.js?v=4"></script>
|
||||
<script>window.__BUILD='2026-06-30-batch16';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);</script>
|
||||
<script>window.__BUILD='2026-06-30-batch17';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);</script>
|
||||
<div class="loading" id="loading">Loading…</div>
|
||||
|
||||
<header>
|
||||
@@ -1097,6 +1097,24 @@ function updateRailUnread(){
|
||||
let chats=0; ROWS.forEach(it=>{ if((it.unread||0)>0) chats++; }); // number of chats with unread, not total messages
|
||||
const d=document.getElementById('railUnread');
|
||||
if(chats>0){ d.textContent=chats>99?'99+':chats; d.style.display='grid'; } else d.style.display='none';
|
||||
setDesktopBadge(chats); // mirror the count onto the desktop taskbar icon
|
||||
}
|
||||
// Desktop taskbar icon badge: draw a small red count badge and hand it to the Electron shell
|
||||
// (which sets it as a taskbar overlay). No-op in a browser or on mobile.
|
||||
function setDesktopBadge(count){
|
||||
try{
|
||||
if(!(window.bizConnectNative && window.bizConnectNative.setUnread)) return;
|
||||
let dataUrl=null;
|
||||
if(count>0){
|
||||
const s=32, c=document.createElement('canvas'); c.width=s; c.height=s; const g=c.getContext('2d');
|
||||
g.fillStyle='#ef4444'; g.beginPath(); g.arc(s/2,s/2,s/2,0,2*Math.PI); g.fill();
|
||||
g.fillStyle='#fff'; g.textAlign='center'; g.textBaseline='middle';
|
||||
const label=count>99?'99+':String(count); g.font='bold '+(label.length>2?15:20)+'px system-ui,Segoe UI,sans-serif';
|
||||
g.fillText(label, s/2, s/2+1);
|
||||
dataUrl=c.toDataURL('image/png');
|
||||
}
|
||||
window.bizConnectNative.setUnread(count, dataUrl);
|
||||
}catch(_){}
|
||||
}
|
||||
async function loadSidebar(){
|
||||
let convos=[], contacts=[];
|
||||
|
||||
Reference in New Issue
Block a user