add control requests, use pings and improve display_status

This commit is contained in:
E44
2025-11-06 11:50:21 +01:00
parent 9fd81821f1
commit 2168873d3a
5 changed files with 85 additions and 25 deletions
@@ -1,17 +1,19 @@
<script lang="ts">
import { display_status_to_info, type DisplayStatus } from "../ts/types";
let { selected, status, className = "" } = $props<{
selected: boolean;
status: string;
status: DisplayStatus;
className?: string;
}>();
function get_text_color(selected: boolean, status: string) {
function get_text_color(selected: boolean, status: DisplayStatus) {
switch (status) {
case 'Online':
case 'app_online':
return selected ? 'text-green-700' : 'text-green-400';
case 'Lädt':
case 'app_offline':
return selected ? 'text-amber-700' : 'text-amber-400';
case 'Offline':
case 'host_offline':
return selected ? 'text-red-700' : 'text-red-400';
default:
return selected ? 'text-stone-700' : 'text-stone-400';
@@ -20,5 +22,5 @@
</script>
<div class="{get_text_color(selected, status)} {className} transition-colors duration-100">
{status}
{display_status_to_info(status)}
</div>