diff --git a/src/components/notification-center/NotificationCenterView.tsx b/src/components/notification-center/NotificationCenterView.tsx index 5090d3b..6fc502c 100644 --- a/src/components/notification-center/NotificationCenterView.tsx +++ b/src/components/notification-center/NotificationCenterView.tsx @@ -14,55 +14,28 @@ export const NotificationCenterView: FC<{}> = props => { if(!alerts || !alerts.length) return null; - const elements: ReactNode[] = []; - - for(const alert of alerts) - { - const element = GetAlertLayout(alert, () => closeAlert(alert)); - - elements.push(element); - } - - return elements; + return alerts.map((alert) => GetAlertLayout(alert, () => closeAlert(alert))); }, [ alerts, closeAlert ]); const getBubbleAlerts = useMemo(() => { if(!bubbleAlerts || !bubbleAlerts.length) return null; - const elements: ReactNode[] = []; - - for(const alert of bubbleAlerts) - { + return bubbleAlerts.map((alert) => { const element = GetBubbleLayout(alert, () => closeBubbleAlert(alert)); - if(alert.notificationType === NotificationBubbleType.CLUBGIFT) { - elements.unshift(element); - - continue; + return element; } - - elements.push(element); - } - - return elements; + return element; + }); }, [ bubbleAlerts, closeBubbleAlert ]); const getConfirms = useMemo(() => { if(!confirms || !confirms.length) return null; - const elements: ReactNode[] = []; - - for(const confirm of confirms) - { - const element = GetConfirmLayout(confirm, () => closeConfirm(confirm)); - - elements.push(element); - } - - return elements; + return confirms.map((confirm) => GetConfirmLayout(confirm, () => closeConfirm(confirm))); }, [ confirms, closeConfirm ]); return ( @@ -74,4 +47,4 @@ export const NotificationCenterView: FC<{}> = props => { getAlerts } ); -} +} \ No newline at end of file diff --git a/src/components/notification-center/views/alert-layouts/GetAlertLayout.tsx b/src/components/notification-center/views/alert-layouts/GetAlertLayout.tsx index 1c37e5a..4d39528 100644 --- a/src/components/notification-center/views/alert-layouts/GetAlertLayout.tsx +++ b/src/components/notification-center/views/alert-layouts/GetAlertLayout.tsx @@ -7,15 +7,16 @@ export const GetAlertLayout = (item: NotificationAlertItem, onClose: () => void) { if(!item) return null; - const props = { key: item.id, item, onClose }; + const key = item.id; + const props = { item, onClose }; switch(item.alertType) { case NotificationAlertType.NITRO: - return + return ; case NotificationAlertType.SEARCH: - return + return ; default: - return + return ; } -} +} \ No newline at end of file diff --git a/src/components/notification-center/views/alert-layouts/NitroSystemAlertView.tsx b/src/components/notification-center/views/alert-layouts/NitroSystemAlertView.tsx index 0067d3f..64f1722 100644 --- a/src/components/notification-center/views/alert-layouts/NitroSystemAlertView.tsx +++ b/src/components/notification-center/views/alert-layouts/NitroSystemAlertView.tsx @@ -38,7 +38,7 @@ export const NitroSystemAlertView: FC = props - DuckieTM (Re-Design) - Jonas (Contributing) - Ohlucas (Sunset resources) - v1.2.0 + v1.5.0