Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(ui): restore brand favicon unread dot (#1298)

Call White3713aeaf58eb
diff --git a/ui/public/logo-unread.png b/ui/public/logo-unread.png
new file mode 100644
index 000000000..9dfdba6dc
Binary files /dev/null and b/ui/public/logo-unread.png differ
diff --git a/ui/src/lib/faviconBadge.test.ts b/ui/src/lib/faviconBadge.test.ts
index 6484bd267..694113dc2 100644
--- a/ui/src/lib/faviconBadge.test.ts
+++ b/ui/src/lib/faviconBadge.test.ts
@@ -2,15 +2,10 @@
import { describe, expect, it } from 'vitest';
-import { createFaviconBadgeDataUrl, formatFaviconBadgeCount, syncFaviconBadge } from './faviconBadge';
+import { syncFaviconBadge } from './faviconBadge';
describe('favicon unread badge', () => {
- it('formats large counts compactly', () => {
- expect(formatFaviconBadgeCount(4)).toBe('4');
- expect(formatFaviconBadgeCount(100)).toBe('99+');
- });
-
- it('writes a self-contained badge and restores the original icon at zero', () => {
+ it('uses the branded unread icon and restores the original icon at zero', () => {
const targetDocument = document.implementation.createHTMLDocument('favicon');
const link = targetDocument.createElement('link');
link.rel = 'icon';
@@ -18,10 +13,19 @@ describe('favicon unread badge', () => {
targetDocument.head.appendChild(link);
syncFaviconBadge(3, targetDocument);
- expect(link.href).toContain('data:image/svg+xml');
- expect(decodeURIComponent(link.href)).toContain('>3</text>');
+ expect(link.getAttribute('href')).toBe('/logo-unread.png');
syncFaviconBadge(0, targetDocument);
expect(link.getAttribute('href')).toBe('/logo.png');
- expect(createFaviconBadgeDataUrl(12)).toContain('data:image/svg+xml');
+ });
+
+ it('creates a PNG favicon when the document does not declare one', () => {
+ const targetDocument = document.implementation.createHTMLDocument('favicon');
+
+ syncFaviconBadge(1, targetDocument);
+
+ const link = targetDocument.querySelector<HTMLLinkElement>('link[rel="icon"]');
+ expect(link?.type).toBe('image/png');
+ expect(link?.getAttribute('href')).toBe('/logo-unread.png');
+ expect(link?.getAttribute('data-avibe-base-href')).toBe('/logo.png');
});
});
diff --git a/ui/src/lib/faviconBadge.ts b/ui/src/lib/faviconBadge.ts
index 88ebd1c05..4a8c7bf17 100644
--- a/ui/src/lib/faviconBadge.ts
+++ b/ui/src/lib/faviconBadge.ts
@@ -1,32 +1,25 @@
const DEFAULT_FAVICON_PATH = '/logo.png';
+const UNREAD_FAVICON_PATH = '/logo-unread.png';
const FAVICON_SELECTOR = 'link[rel="icon"]';
const BASE_HREF_ATTRIBUTE = 'data-avibe-base-href';
-export function formatFaviconBadgeCount(count: number): string {
- const normalized = Number.isFinite(count) ? Math.max(0, Math.trunc(count)) : 0;
- return normalized > 99 ? '99+' : String(normalized);
-}
-/** Build a small self-contained favicon so the browser can render the badge. */
-export function createFaviconBadgeDataUrl(count: number): string {
- const label = formatFaviconBadgeCount(count);
- const fontSize = label.length > 2 ? 15 : 19;
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#1b0f45"/><path d="M6 34h10c5 0 5-14 10-14s5 25 10 25 5-33 10-33 5 22 10 22h2" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="5"/><circle cx="51" cy="13" r="12" fill="#ff5368" stroke="#080812" stroke-width="3"/><text x="51" y="18" fill="#fff" font-family="Arial,sans-serif" font-size="${fontSize}" font-weight="700" text-anchor="middle">${label}</text></svg>`;
- return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
-}
-
-/** Keep the regular favicon until a badge is needed, then restore it exactly. */
-export function syncFaviconBadge(count: number, targetDocument: Document | null = typeof document === 'undefined' ? null : document): void {
+/** Keep the recognizable brand favicon and add only the unread-state red dot. */
+export function syncFaviconBadge(
+ count: number,
+ targetDocument: Document | null = typeof document === 'undefined' ? null : document,
+): void {
if (!targetDocument) return;
let link = targetDocument.querySelector<HTMLLinkElement>(FAVICON_SELECTOR);
if (!link) {
link = targetDocument.createElement('link');
link.rel = 'icon';
+ link.type = 'image/png';
link.href = DEFAULT_FAVICON_PATH;
targetDocument.head?.appendChild(link);
}
const baseHref = link.getAttribute(BASE_HREF_ATTRIBUTE) || link.getAttribute('href') || DEFAULT_FAVICON_PATH;
link.setAttribute(BASE_HREF_ATTRIBUTE, baseHref);
- link.href = count > 0 ? createFaviconBadgeDataUrl(count) : baseHref;
+ link.href = count > 0 ? UNREAD_FAVICON_PATH : baseHref;
}