webui/src/routes/Rendered.svelte

58 lines
1.4 KiB
Svelte
Raw Normal View History

2023-11-17 00:05:35 +00:00
<script lang="ts">
2023-11-19 19:27:22 +00:00
export let status = {};
2024-07-29 18:10:26 +00:00
import RocketIcon from '../icons/RocketIcon.svelte';
import PickaxeIcon from '../icons/PickaxeIcon.svelte';
2024-08-31 13:37:20 +00:00
import ZapIcon from '../icons/ZapIcon.svelte';
2023-11-17 00:05:35 +00:00
2023-11-19 19:27:22 +00:00
const isSplitText = (str: string) => {
return str.includes('/');
};
2024-08-31 15:10:26 +00:00
export let className = 'btclock-wrapper';
2023-11-17 00:05:35 +00:00
</script>
2024-08-31 15:18:26 +00:00
<div class={className} id={className}>
2023-11-19 19:27:22 +00:00
<div class="btclock">
{#each status.data as char}
{#if isSplitText(char)}
<div class="splitText">
2024-08-31 15:10:26 +00:00
{#if char.split('/').length}
<span class="top-text">{char.split('/')[0]}</span>
<hr />
<span class="bottom-text">{char.split('/')[1]}</span>
{/if}
<!-- {#each char.split('/') as part}
2023-11-19 19:27:22 +00:00
<div class="flex-items">{part}</div>
2024-08-31 15:10:26 +00:00
{/each} -->
2023-11-19 19:27:22 +00:00
</div>
2024-07-29 18:10:26 +00:00
{:else if char.startsWith('mdi')}
<div class="digit icon">
{#if char.endsWith('rocket')}
<RocketIcon></RocketIcon>
{/if}
{#if char.endsWith('pickaxe')}
<PickaxeIcon></PickaxeIcon>
{/if}
2024-08-31 13:37:20 +00:00
{#if char.endsWith('bolt')}
<ZapIcon></ZapIcon>
{/if}
2024-07-29 18:10:26 +00:00
</div>
{:else if char === 'STS'}
2024-08-31 13:37:20 +00:00
<div class="digit sats">S</div>
2023-11-24 23:42:37 +00:00
{:else if char.length >= 3}
<div class="mediumText">{char}</div>
2023-11-19 19:27:22 +00:00
{:else if char.length === 0 || char === ' '}
<div class="digit">&nbsp;&nbsp;</div>
{:else}
<div class="digit">{char}</div>
{/if}
{/each}
</div>
</div>
2024-07-29 18:10:26 +00:00
<style>
.icon {
fill: currentColor;
}
</style>