Add overview popout

This commit is contained in:
Jasper Blanckenburg 2024-09-06 14:04:29 +02:00
parent 1da81476f7
commit 917464347a
4 changed files with 56 additions and 22 deletions

View File

@ -0,0 +1,5 @@
<script lang="ts">
import '../app.css';
</script>
<slot />

View File

@ -1,15 +1,18 @@
<script lang="ts">
import MasterStatusDisplay from './master-status-display.svelte';
import SlaveStatusDisplay from './slave-status-display.svelte';
import '../app.css';
import MasterErrorDisplay from './master-error-display.svelte';
import ShuntStatusDisplay from './shunt-status-display.svelte';
import Overview from './overview.svelte';
import { amsStatus, error, shunt, slaveLog, slaveStatus } from '$lib/client';
</script>
<svelte:head>
<title>Charging</title>
</svelte:head>
<div class="vertical-wrapper">
<Overview amsStatus={$amsStatus} current={$shunt.current} voltage={$shunt.voltage1} />
<Overview amsStatus={$amsStatus} shunt={$shunt} showPopout={true} />
<div class="wrapper">
<MasterErrorDisplay error={$error} />
<MasterStatusDisplay status={$amsStatus} />

View File

@ -1,19 +1,34 @@
<script lang="ts">
import type { ShuntData } from '$lib/client';
import { AMSState, type AMSStatus } from '$lib/messages';
export let amsStatus: AMSStatus | undefined;
export let current: number | undefined;
export let voltage: number | undefined;
export let shunt: ShuntData;
export let showPopout: boolean = false;
</script>
<div class="overview grid grid-rows-3 gap-3">
{#if amsStatus != null && current != null && voltage != null}
<div class="flex flex-col w-[30rem] border-2 border-black p-1 m-1">
{#if showPopout}
<div class="flex flex-row justify-end mb-2">
<a
class="text-sm underline hover:no-underline"
href="/overview"
target="_blank"
on:click|preventDefault={() => {
window.open('/overview', 'newwindow', 'width=500,height=200,resizable=yes');
return false;
}}>Pop out</a
>
</div>
{/if}
<div class="grid grid-rows-3 gap-3">
{#if amsStatus != null}
<div class="progress" data-label="{amsStatus.soc}%">
<span class="value" style="width:{amsStatus.soc}%;"></span>
</div>
<div class="grid grid-cols-4 gap-2">
<span class="text-center border-r">{voltage.toFixed(1)} V</span>
<span class="text-center border-r">{current.toFixed(1)} A</span>
<span class="text-center border-r">{shunt.voltage1.toFixed(1)} V</span>
<span class="text-center border-r">{shunt.current.toFixed(1)} A</span>
<span class="text-center border-r">{amsStatus.maxCellTemp.toFixed(1)}°C</span>
<span class="text-center">SDC {amsStatus.sdcClosed ? '✅' : '❌'}</span>
</div>
@ -27,6 +42,7 @@
>
</div>
{/if}
</div>
</div>
<style>

View File

@ -0,0 +1,10 @@
<script lang="ts">
import Overview from '../overview.svelte';
import { amsStatus, shunt } from '$lib/client';
</script>
<svelte:head>
<title>Charging Overview</title>
</svelte:head>
<Overview amsStatus={$amsStatus} shunt={$shunt} />