fix array length 0 check

This commit is contained in:
Beebles
2025-09-26 14:03:01 -06:00
parent 3b00e4a792
commit a5ce24405b
@@ -68,24 +68,28 @@ export function AnnouncementsDisplay() {
void fetchAnnouncement();
}
if (!currentlyDisplayingAnnouncements) {
if (currentlyDisplayingAnnouncements.length === 0) {
return null;
}
return (
<PanelSection>
{currentlyDisplayingAnnouncements.map((announcement) => (
<Announcement key={announcement.id} announcement={announcement} onHide={() => hideAnnouncement(announcement.id)} />
<Announcement
key={announcement.id}
announcement={announcement}
onHide={() => hideAnnouncement(announcement.id)}
/>
))}
</PanelSection>
);
}
function Announcement({ announcement, onHide }: { announcement: Announcement, onHide: () => void }) {
function Announcement({ announcement, onHide }: { announcement: Announcement; onHide: () => void }) {
// Severity is not implemented in the API currently
const severity = SEVERITIES['Low'];
return (
<Focusable
<Focusable
style={{
// Transparency is 20% of the color
backgroundColor: `${severity.color}33`,