Skip to content

Commit dc40933

Browse files
committed
refactor(webui): use device name in header
1 parent 6cee46e commit dc40933

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

data/src/lib/components/NavigationMenu.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import { websocketState } from "$lib/stores/websocket.svelte";
1010
import { p } from "sv-router/generated";
1111
import { isActiveLink } from 'sv-router';
12+
import { systemInfo } from "$lib/stores/system.svelte";
1213
1314
let { onClose, id } = $props();
1415
@@ -30,7 +31,13 @@
3031
<img src={logoSrc()} alt="HomeKey-ESP32 logo" class="size-7" />
3132
</div>
3233
<div class="flex items-start flex-col w-full">
33-
<span class="pl-2 text-sm font-bold">HomeKey-ESP32</span>
34+
<span class="pl-2 text-sm font-bold">
35+
{#if !systemInfo.deviceName}
36+
<div class="skeleton h-5 w-32"></div>
37+
{:else}
38+
{systemInfo.deviceName}
39+
{/if}
40+
</span>
3441
<div class="pl-2 flex items-center gap-1">
3542
<div class="inline-grid *:[grid-area:1/1]">
3643
<div

data/src/routes/layout.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import '@/app.css';
33
import { onMount, onDestroy } from 'svelte';
4-
import { getLoadingState, updateSystemInfo } from '$lib/stores/system.svelte.js';
4+
import { getLoadingState, systemInfo, updateSystemInfo } from '$lib/stores/system.svelte.js';
55
import { initTheme, logoSrc } from '$lib/stores/theme.svelte.js';
66
import ws, { type WebSocketEvent } from '$lib/services/ws.js';
77
import Logo from '$lib/assets/favicon.png';
@@ -80,7 +80,13 @@
8080
</svg>
8181
</label>
8282
<div class="flex justify-between w-full">
83-
<span class="font-bold text-lg">HomeKey-ESP32</span>
83+
<span class="font-bold text-lg">
84+
{#if !systemInfo.deviceName}
85+
<div class="skeleton h-8 w-32"></div>
86+
{:else}
87+
{systemInfo.deviceName}
88+
{/if}
89+
</span>
8490
<div class="gap-1 pr-2">
8591
<div class="inline-grid *:[grid-area:1/1]">
8692
<div class="status animate-ping" class:status-success={websocketState.connected} class:status-error={!websocketState.connected} class:status-warning={websocketState.state == "reconnecting"}></div>

0 commit comments

Comments
 (0)