Skip to content

Commit 141031c

Browse files
authored
Added colour to SignalR LIVE/DOWN badges
1 parent 9868e08 commit 141031c

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

frontend/src/App/Navbar.tsx

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,40 @@ const NavbarItem: FunctionComponent<NavbarItemProps> = ({
260260
return true;
261261
}, [badge]);
262262

263+
const isSignalRBadge = useMemo(() => {
264+
return link === "/series" || link === "/movies";
265+
}, [link]);
266+
267+
// Compute explicit background and text style objects safely
268+
const badgeStyle = useMemo(() => {
269+
if (!isSignalRBadge) return {};
270+
271+
if (badge === "LIVE") {
272+
return {
273+
// Subtle background colours that adapt to light/dark mode
274+
backgroundColor:
275+
"light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-6))",
276+
277+
// Softened high-contrast text colors
278+
color:
279+
"light-dark(var(--mantine-color-gray-7), var(--mantine-color-gray-5))",
280+
281+
border: "none",
282+
};
283+
}
284+
285+
if (badge === "DOWN") {
286+
return {
287+
// more noticeable background colors for "DOWN" status, still adapting to theme
288+
backgroundColor:
289+
"light-dark(var(--mantine-color-red-6), var(--mantine-color-red-8))",
290+
color: "var(--mantine-color-white)",
291+
};
292+
}
293+
294+
return {};
295+
}, [badge, isSignalRBadge]);
296+
263297
return (
264298
<NavLink
265299
to={link}
@@ -295,13 +329,17 @@ const NavbarItem: FunctionComponent<NavbarItemProps> = ({
295329
)}
296330
{name}
297331
{!shouldHideBadge && (
298-
<Badge className={styles.badge} radius="xs">
332+
<Badge
333+
className={styles.badge}
334+
radius="xs"
335+
// We apply the explicit styling overrides here
336+
style={badgeStyle}
337+
>
299338
{badge}
300339
</Badge>
301340
)}
302341
</Text>
303342
</NavLink>
304343
);
305344
};
306-
307345
export default AppNavbar;

0 commit comments

Comments
 (0)