webapp/src/components/Nav/Notifications.tsx

20 lines
506 B
TypeScript
Raw Normal View History

2022-09-09 11:53:35 +00:00
import { For, Portal, Show } from 'solid-js/web'
import { useWarningsStore } from '../../stores/ui'
import { createMemo } from 'solid-js'
export default () => {
2022-10-25 16:25:42 +00:00
const { warnings } = useWarningsStore()
2022-09-09 11:53:35 +00:00
2022-10-25 16:25:42 +00:00
const notSeen = createMemo(() => warnings().filter((warning) => !warning.seen))
2022-09-09 11:53:35 +00:00
return (
<Show when={notSeen().length > 0}>
<Portal>
<ul class="warns">
2022-10-25 16:25:42 +00:00
<For each={warnings()}>{(warning) => <li>{warning.body}</li>}</For>
2022-09-09 11:53:35 +00:00
</ul>
</Portal>
</Show>
)
}