Tangled notifications browser extension
1const action = browser.action ?? browser.browserAction;
2
3export const renderCount = (count: number): void => {
4 action.setBadgeText({
5 text: count === 0 ? "" : count > 99 ? "99+" : String(count),
6 });
7 action.setBadgeBackgroundColor({ color: "#22c55e" });
8 action.setTitle({
9 title: count
10 ? `${count} unread notification${count > 1 ? "s" : ""}`
11 : "Tug",
12 });
13};
14
15export const renderError = (): void => {
16 action.setBadgeText({ text: "!" });
17 action.setBadgeBackgroundColor({ color: "#ef4444" });
18 action.setTitle({ title: "Error fetching notifications" });
19};