Rewrite page in Svelte 5 #49
6 changed files with 51 additions and 59 deletions
|
@ -42,14 +42,13 @@
|
||||||
if (typeof monitor !== 'undefined') {
|
if (typeof monitor !== 'undefined') {
|
||||||
status = monitor.status;
|
status = monitor.status;
|
||||||
}
|
}
|
||||||
if (icons.length != 0 && typeof server.icon !== "undefined") {
|
if (icons.length != 0 && typeof server.icon !== 'undefined') {
|
||||||
const rootSplit = server.icon.split('/');
|
const rootSplit = server.icon.split('/');
|
||||||
const root = rootSplit[rootSplit.length - 1];
|
const root = rootSplit[rootSplit.length - 1];
|
||||||
|
|
||||||
if (server.iconType === IconType.SVG) {
|
if (server.iconType === IconType.SVG) {
|
||||||
checkForImage(server);
|
checkForImage(server);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (icons.includes(`${root}-36.${server.iconType}`)) {
|
if (icons.includes(`${root}-36.${server.iconType}`)) {
|
||||||
img_source = `${server.icon}-36.${server.iconType}`;
|
img_source = `${server.icon}-36.${server.iconType}`;
|
||||||
} else {
|
} else {
|
||||||
|
@ -62,7 +61,8 @@
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="flex h-48 w-[28rem] flex-col gap-y-2 rounded-xl border-t-4
|
class="flex h-48 w-[28rem] flex-col gap-y-2 rounded-xl border-t-4
|
||||||
{status == 99 ? 'border-primary'
|
{status == 99
|
||||||
|
? 'border-primary'
|
||||||
: status == 0
|
: status == 0
|
||||||
? 'border-offline'
|
? 'border-offline'
|
||||||
: status == 1
|
: status == 1
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
on:mouseover={() => (hover.title = true)}
|
on:mouseover={() => (hover.title = true)}
|
||||||
on:mouseleave={() => (hover.title = false)}
|
on:mouseleave={() => (hover.title = false)}
|
||||||
>
|
>
|
||||||
{#if typeof server.icon !== "undefined"}
|
{#if typeof server.icon !== 'undefined'}
|
||||||
{#if img_source != ''}
|
{#if img_source != ''}
|
||||||
<img
|
<img
|
||||||
width="24px"
|
width="24px"
|
||||||
|
@ -92,11 +92,7 @@
|
||||||
<Skeleton class="h-6 w-6 rounded-full" />
|
<Skeleton class="h-6 w-6 rounded-full" />
|
||||||
{/if}
|
{/if}
|
||||||
{:else}{/if}
|
{:else}{/if}
|
||||||
<a
|
<a href={server.href} class="font-bold {!hover.title || 'text-secondary'}">{server.name}</a>
|
||||||
href={server.href}
|
|
||||||
class="font-bold {!hover.title || 'text-secondary'}"
|
|
||||||
>{server.name}</a
|
|
||||||
>
|
|
||||||
{#if hover.title}
|
{#if hover.title}
|
||||||
<div
|
<div
|
||||||
transition:slide={{ delay: 100, duration: 200, easing: quintInOut, axis: 'x' }}
|
transition:slide={{ delay: 100, duration: 200, easing: quintInOut, axis: 'x' }}
|
||||||
|
@ -110,7 +106,7 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if typeof server.id !== "undefined"}
|
{#if typeof server.id !== 'undefined'}
|
||||||
<h1
|
<h1
|
||||||
class="w-16 rounded-md border-b-2
|
class="w-16 rounded-md border-b-2
|
||||||
{status == 0
|
{status == 0
|
||||||
|
|
|
@ -87,11 +87,7 @@
|
||||||
<Skeleton class="h-6 w-6 rounded-full" />
|
<Skeleton class="h-6 w-6 rounded-full" />
|
||||||
{/if}
|
{/if}
|
||||||
{:else}{/if}
|
{:else}{/if}
|
||||||
<a
|
<a href={service.href} class="font-bold {!hover.title || 'text-secondary'}">{service.name}</a>
|
||||||
href={service.href}
|
|
||||||
class="font-bold {!hover.title || 'text-secondary'}"
|
|
||||||
>{service.name}</a
|
|
||||||
>
|
|
||||||
{#if hover.title}
|
{#if hover.title}
|
||||||
<div
|
<div
|
||||||
transition:slide={{ delay: 100, duration: 200, easing: quintInOut, axis: 'x' }}
|
transition:slide={{ delay: 100, duration: 200, easing: quintInOut, axis: 'x' }}
|
||||||
|
|
|
@ -8,4 +8,3 @@
|
||||||
<div class="h-full pt-16">
|
<div class="h-full pt-16">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
href="/"
|
href="/"
|
||||||
class="{button} + {!($page.url.pathname === '/')
|
class="{button} + {!($page.url.pathname === '/') || 'border-secondary text-secondary'}"
|
||||||
|| 'border-secondary text-secondary'}"
|
|
||||||
>
|
>
|
||||||
Home
|
Home
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -22,8 +21,8 @@
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
href="/servers"
|
href="/servers"
|
||||||
class="{button} + {!$page.url.pathname.startsWith('/servers')
|
class="{button} + {!$page.url.pathname.startsWith('/servers') ||
|
||||||
|| 'border-secondary text-secondary'}"
|
'border-secondary text-secondary'}"
|
||||||
>
|
>
|
||||||
Servers
|
Servers
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -32,8 +31,8 @@
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
href="/services"
|
href="/services"
|
||||||
class="{button} + {!$page.url.pathname.startsWith('/services')
|
class="{button} + {!$page.url.pathname.startsWith('/services') ||
|
||||||
|| 'border-secondary text-secondary'}"
|
'border-secondary text-secondary'}"
|
||||||
>
|
>
|
||||||
Services
|
Services
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -42,8 +41,8 @@
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
href="/about"
|
href="/about"
|
||||||
class="{button} + {!$page.url.pathname.startsWith('/about')
|
class="{button} + {!$page.url.pathname.startsWith('/about') ||
|
||||||
|| 'border-secondary text-secondary'}"
|
'border-secondary text-secondary'}"
|
||||||
>
|
>
|
||||||
About
|
About
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { version } from '$app/environment'
|
import { version } from '$app/environment';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
@ -9,12 +9,14 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Version:
|
Version:
|
||||||
<a href="https://forgejo.neshweb.net/Neshweb-Sites/main-site/releases/tag/{version}" class="hover:underline">
|
<a
|
||||||
|
href="https://forgejo.neshweb.net/Neshweb-Sites/main-site/releases/tag/{version}"
|
||||||
|
class="hover:underline"
|
||||||
|
>
|
||||||
{version}
|
{version}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<p class="text-background">Background</p>
|
<p class="text-background">Background</p>
|
||||||
<p class="text-foreground">Foreground</p>
|
<p class="text-foreground">Foreground</p>
|
||||||
<p class="text-muted">Muted</p>
|
<p class="text-muted">Muted</p>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import type { Server } from '$lib/types/data-types';
|
import type { Server } from '$lib/types/data-types';
|
||||||
import { io } from 'socket.io-client';
|
import { io } from 'socket.io-client';
|
||||||
import type { Heartbeat } from '$lib/types/uptime-kuma-types';
|
import type { Heartbeat } from '$lib/types/uptime-kuma-types';
|
||||||
import ServerCard from "$lib/components/ServerCard.svelte";
|
import ServerCard from '$lib/components/ServerCard.svelte';
|
||||||
|
|
||||||
let { data }: { data: { promise: Promise<string> } } = $props();
|
let { data }: { data: { promise: Promise<string> } } = $props();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
};
|
};
|
||||||
monitorList.set(monitor.monitorID, monitor);
|
monitorList.set(monitor.monitorID, monitor);
|
||||||
monitorList = new Map(monitorList.entries());
|
monitorList = new Map(monitorList.entries());
|
||||||
})
|
});
|
||||||
|
|
||||||
socket.on('heartbeatList', (_, data) => {
|
socket.on('heartbeatList', (_, data) => {
|
||||||
let recent = data[data.length - 1];
|
let recent = data[data.length - 1];
|
||||||
|
|
Loading…
Reference in a new issue