mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 19:21:59 +00:00
fix array length 0 check
This commit is contained in:
@@ -68,24 +68,28 @@ 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 (
|
||||||
<Focusable
|
<Focusable
|
||||||
style={{
|
style={{
|
||||||
// Transparency is 20% of the color
|
// Transparency is 20% of the color
|
||||||
backgroundColor: `${severity.color}33`,
|
backgroundColor: `${severity.color}33`,
|
||||||
|
|||||||
Reference in New Issue
Block a user