energyProductionPerTick: number;
}
+function renderUnreadBadge(count: number): string {
+ return `<span class="badge danger">${count}</span>`;
-export function topbar(city: City & Usage): string {
+}
+
+function mailLink(unreadCount: number): string {
+ return `
+ <a href="#" hx-target="#main" hx-get="/poll/mailroom" hx-trigger="click" id="mail-link" hx-swap-oob="true">Mail ${unreadCount > 0 ? renderUnreadBadge(unreadCount) : ''}</a>
+ `;
+}
+
+export function topbar(city: City & Usage, unreadMail: number): string {
const foodRateOfChange = city.foodProductionPerTick - city.foodUsagePerTick;
const energyRateOfChange = city.energyProductionPerTick - city.energyUsagePerTick;
const oob = `
+ ${mailLink(unreadMail)}
<div class="col" id="info-bar" hx-swap-oob="true">
<span>
<b data-augmented-ui="all-hex border" title="Credits">₡</b>