flotilla/src/app/components/RelaySettingsHealthChecks.svelte

46 lines
1.6 KiB
Svelte
Raw Normal View History

2026-03-19 20:26:52 +00:00
<script lang="ts">
import Stars from "@assets/icons/stars.svg?dataurl"
import CheckCircle from "@assets/icons/check-circle.svg?dataurl"
import DangerTriangle from "@assets/icons/danger-triangle.svg?dataurl"
import Stethoscope from "@assets/icons/stethoscope.svg?dataurl"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import RelaySettingsHealthCheck from "@app/components/RelaySettingsHealthCheck.svelte"
import {PLATFORM_NAME} from "@app/env"
2026-07-28 16:16:26 +00:00
import {healthChecks} from "@app/healthChecks"
const pending = $healthChecks.pending.$
2026-03-19 20:26:52 +00:00
const applyAll = () => {
2026-07-28 16:16:26 +00:00
for (const healthCheck of $pending) {
$healthChecks.apply(healthCheck)
2026-03-19 20:26:52 +00:00
}
}
</script>
<div class="card flex flex-col gap-4 shadow-md">
2026-03-19 20:26:52 +00:00
<div class="flex justify-between items-center">
<strong class="flex items-center gap-3 text-lg">
<Icon icon={Stethoscope} />
Health Check
</strong>
<span class="flex items-center gap-2 text-sm">
2026-07-28 16:16:26 +00:00
<Icon icon={$pending.length === 0 ? CheckCircle : DangerTriangle} />
{$pending.length} Issue{$pending.length === 1 ? "" : "s"} Detected
2026-03-19 20:26:52 +00:00
</span>
</div>
<p>
{PLATFORM_NAME} actively checks your connection to the network in the background to discover relays
that are offline, that you don't have access to, or are otherwise causing trouble.
</p>
2026-07-28 16:16:26 +00:00
{#each $pending as healthCheck}
2026-03-19 20:26:52 +00:00
<RelaySettingsHealthCheck {healthCheck} />
{/each}
2026-07-28 16:16:26 +00:00
{#if $pending.length > 0}
<Button class="button button-primary" onclick={applyAll}>
2026-03-19 20:26:52 +00:00
<Icon icon={Stars} />
Apply All Recommendations
</Button>
{/if}
</div>