add initial test client

This commit is contained in:
Samuel Lorch 2023-03-06 23:56:36 +01:00
parent 0a51ba0beb
commit fbc899fbe0
28 changed files with 4829 additions and 0 deletions

View file

@ -0,0 +1,16 @@
<script setup lang="ts">
const { title, noSpacer } = $(withDefaults(defineProps<{
title?: string,
noSpacer?: boolean,
}>(), {
title: "",
noSpacer: false,
}));
watchEffect(() => useTitle(`${title} - nfSense`));
</script>
<template>
<Portal to="page-header">
<h1 v-if="title !== ''" v-text="title" :class="{'flex-grow': !noSpacer}"/>
<slot/>
</Portal>
</template>

View file

@ -0,0 +1,25 @@
<script lang="ts">
let activeTargets = $ref<string[]>([]);
</script>
<script setup lang="ts">
const props = $defineProps<{
from?: string,
to?: string,
}>();
const { from, to } = $(props);
if (from) {
onMounted(() => activeTargets.push(from));
onBeforeUnmount(() => activeTargets.splice(activeTargets.indexOf(from), 1));
}
</script>
<template>
<div v-if="from" :id="'portal-' + from">
<slot/>
</div>
<Teleport v-else-if="to && activeTargets.includes(to)" :to="'#portal-' + to">
<slot/>
</Teleport>
</template>