1 Commits

Author SHA1 Message Date
151d519805 super mega layout improvements 2024-12-31 19:35:23 -08:00
4 changed files with 7 additions and 47 deletions

View File

@@ -1,9 +1,11 @@
import type { LayoutServerLoad } from "./$types";
import type { LayoutServerLoad } from './$types';
export const load: LayoutServerLoad = async (event) => {
const { user } = event.locals;
return {
user
user,
};
};
export const trailingSlash = 'always';

View File

@@ -15,9 +15,7 @@
</script>
<header class="flex w-full flex-wrap justify-between gap-x-6 gap-y-4 xl:max-w-screen-xl">
<a href="/" class="contents">
<span class="font-bold sm:inline-block">VPGen</span>
</a>
<span class="font-bold sm:inline-block">VPGen</span>
<nav class="max-w-full">
<ul class="flex items-center gap-6 overflow-x-auto text-sm">
<li><a href="/" class={getNavClass(/^\/$/)}>Home</a></li>

View File

@@ -41,7 +41,7 @@
<Table.Row class="group hover:bg-background hover:bg-opacity-40">
<Table.Head scope="row">
<a
href={`/clients/${client.id}`}
href={`./${client.id}`}
class="flex size-full items-center group-hover:underline"
>
{client.name}

View File

@@ -2,7 +2,7 @@
import type { PageData } from './$types';
import QRCode from 'qrcode-svg';
import { CodeSnippet } from '$lib/components/app/code-snippet';
import { WireguardGuide } from '$lib/components/app/wireguard-guide';
import { WireguardGuide } from '$lib/components/app/wireguard-guide/index.js';
const { data }: { data: PageData } = $props();
@@ -16,39 +16,7 @@
content: data.config,
join: true,
background: 'hsl(var(--accent-light))',
xmlDeclaration: false,
// predefined: true,
});
const modules = qrCode.qrcode.modules;
const length = modules.length;
const s = 1;
// Rectangles representing modules
// let pathData = '';
//
// for (let y = 0; y < length; y++) {
// for (let x = 0; x < length; x++) {
// let module = modules[x][y];
// if (module) {
// pathData += `M${x*s},${y*s} h${s} v${s} h-${s} Z `
// }
// }
// }
// const path = modules.reduce((acc, row, y) => {
// return acc + row.reduce((rowAcc, module, x) => {
// return module ? rowAcc + `M${x*s},${y*s} h${s} v${s} h-${s} Z ` : rowAcc;
// }, '');
// }, '');
const path = modules.flat().reduce((acc, module, i) => {
const x = Math.floor(i / length)
const y = i % length;
return module ? acc + `M${x*s},${y*s} h${s} v${s} h-${s} Z ` : acc;
}, '');
</script>
<svelte:head>
@@ -63,14 +31,6 @@
<div class="overflow-hidden rounded-lg">
{@html qrCode.svg()}
</div>
<!--{qrCode.svg({ container: 'none' })}-->
<!--{qrCode.sv}-->
<div class="aspect-square min-h-64 p-3 bg-white rounded-lg">
<svg viewBox="0 0 {length*s*0.5} {length*s*0.5}" shape-rendering="crispEdges" image-rendering="optimizeQuality">
<path transform="scale(0.5)" d={path} />
</svg>
</div>
<!--{pathdata}-->
</section>
<section id="usage" class="flex w-full flex-col gap-2">
<h2 class="text-xl font-semibold">Usage</h2>