fix array length 0 check

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