flotilla/src/app/components/Alerts.svelte

39 lines
1.1 KiB
Svelte
Raw Normal View History

2025-02-25 21:36:32 +00:00
<script lang="ts">
2025-03-20 19:55:12 +00:00
import {onMount} from "svelte"
import {pubkey} from "@welshman/app"
2025-02-25 21:36:32 +00:00
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import AlertAdd from "@app/components/AlertAdd.svelte"
import AlertItem from "@app/components/AlertItem.svelte"
2025-03-20 19:55:12 +00:00
import {loadAlertStatuses, loadAlerts} from "@app/requests"
2025-02-25 21:36:32 +00:00
import {pushModal} from "@app/modal"
import {alerts} from "@app/state"
const startAlert = () => pushModal(AlertAdd)
2025-03-20 19:55:12 +00:00
onMount(() => {
loadAlertStatuses($pubkey!)
loadAlerts($pubkey!)
})
2025-02-25 21:36:32 +00:00
</script>
<div class="card2 bg-alt flex flex-col gap-6 shadow-xl">
<div class="flex items-center justify-between">
2025-03-04 18:58:14 +00:00
<strong class="flex items-center gap-3">
<Icon icon="inbox" />
Alerts
</strong>
2025-02-25 21:36:32 +00:00
<Button class="btn btn-primary btn-sm" onclick={startAlert}>
<Icon icon="add-circle" />
Add Alert
</Button>
</div>
<div class="col-4">
{#each $alerts as alert (alert.event.id)}
<AlertItem {alert} />
{:else}
<p class="text-center opacity-75 py-12">No alerts found</p>
{/each}
</div>
</div>