feat: map alerts

This commit is contained in:
RadoslavDimchev 2023-10-18 09:43:17 +03:00
parent b8e43a986b
commit c6908e902f

View File

@ -9,7 +9,7 @@ type Alert = {
} }
const AlertsList = () => { const AlertsList = () => {
const [_, setAlerts] = useState([] as Alert[]) const [alerts, setAlerts] = useState([] as Alert[])
useEffect(() => { useEffect(() => {
setAlerts([ setAlerts([
@ -38,24 +38,14 @@ const AlertsList = () => {
<ChevronRightIcon size={20} /> <ChevronRightIcon size={20} />
</div> </div>
</XStack> </XStack>
{alerts.map(alert => (
<InformationBox <InformationBox
message="Network: Participation rate below 66%" key={alert.message}
message={alert.message}
icon={<CloseCircleIcon size={20} />} icon={<CloseCircleIcon size={20} />}
variant="default" variant={alert.variant}
onClosePress={() => alert('dismissed')}
/>
<InformationBox
message="Node: 32 Peers Connected"
icon={<CloseCircleIcon size={20} />}
variant="information"
onClosePress={() => alert('dismissed')}
/>
<InformationBox
message="Node / Validator: Process Down"
icon={<CloseCircleIcon size={20} />}
variant="error"
onClosePress={() => alert('dismissed')}
/> />
))}
</YStack> </YStack>
) )
} }