From a5ce24405b986f2dc9926b4b87ee80b1953456ee Mon Sep 17 00:00:00 2001
From: Beebles <102569435+beebls@users.noreply.github.com>
Date: Fri, 26 Sep 2025 14:03:01 -0600
Subject: fix array length 0 check

---
 frontend/src/components/AnnouncementsDisplay.tsx | 94 ++++++++++++------------
 1 file changed, 49 insertions(+), 45 deletions(-)

(limited to 'frontend/src/components/AnnouncementsDisplay.tsx')

diff --git a/frontend/src/components/AnnouncementsDisplay.tsx b/frontend/src/components/AnnouncementsDisplay.tsx
index 10ede13b..71b435ed 100644
--- a/frontend/src/components/AnnouncementsDisplay.tsx
+++ b/frontend/src/components/AnnouncementsDisplay.tsx
@@ -68,62 +68,66 @@ 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)} />
-     ))}
+      {currentlyDisplayingAnnouncements.map((announcement) => (
+        <Announcement
+          key={announcement.id}
+          announcement={announcement}
+          onHide={() => hideAnnouncement(announcement.id)}
+        />
+      ))}
     </PanelSection>
   );
 }
 
-function Announcement({ announcement, onHide }: { announcement: Announcement, onHide: () => void }) {
-    // Severity is not implemented in the API currently
+function Announcement({ announcement, onHide }: { announcement: Announcement; onHide: () => void }) {
+  // Severity is not implemented in the API currently
   const severity = SEVERITIES['Low'];
   return (
-<Focusable
-        style={{
-          // Transparency is 20% of the color
-          backgroundColor: `${severity.color}33`,
-          color: severity.text,
-          borderColor: severity.color,
-          borderWidth: '2px',
-          borderStyle: 'solid',
-          padding: '0.7rem',
-          display: 'flex',
-          flexDirection: 'column',
-          position: 'relative',
-        }}
-      >
-        <div style={{ display: 'flex', justifyContent: 'space-between' }}>
-          <span style={{ fontWeight: 'bold' }}>{announcement.title}</span>
-          <DialogButton
+    <Focusable
+      style={{
+        // Transparency is 20% of the color
+        backgroundColor: `${severity.color}33`,
+        color: severity.text,
+        borderColor: severity.color,
+        borderWidth: '2px',
+        borderStyle: 'solid',
+        padding: '0.7rem',
+        display: 'flex',
+        flexDirection: 'column',
+        position: 'relative',
+      }}
+    >
+      <div style={{ display: 'flex', justifyContent: 'space-between' }}>
+        <span style={{ fontWeight: 'bold' }}>{announcement.title}</span>
+        <DialogButton
+          style={{
+            width: '1rem',
+            minWidth: '1rem',
+            height: '1rem',
+            padding: '0',
+            display: 'flex',
+            alignItems: 'center',
+            justifyContent: 'center',
+            position: 'absolute',
+            top: '.75rem',
+            right: '.75rem',
+          }}
+          onClick={() => onHide()}
+        >
+          <FaTimes
             style={{
-              width: '1rem',
-              minWidth: '1rem',
-              height: '1rem',
-              padding: '0',
-              display: 'flex',
-              alignItems: 'center',
-              justifyContent: 'center',
-              position: 'absolute',
-              top: '.75rem',
-              right: '.75rem',
+              height: '.75rem',
             }}
-            onClick={() => onHide()}
-          >
-            <FaTimes
-              style={{
-                height: '.75rem',
-              }}
-            />
-          </DialogButton>
-        </div>
-        <span style={{ fontSize: '0.75rem', whiteSpace: 'pre-line' }}>{announcement.text}</span>
-      </Focusable>
+          />
+        </DialogButton>
+      </div>
+      <span style={{ fontSize: '0.75rem', whiteSpace: 'pre-line' }}>{announcement.text}</span>
+    </Focusable>
   );
-}
\ No newline at end of file
+}
-- 
cgit v1.2.3

