diff --git a/src/routes/clients/[id]/+page.svelte b/src/routes/clients/[id]/+page.svelte index 98522e2..59c2fc6 100644 --- a/src/routes/clients/[id]/+page.svelte +++ b/src/routes/clients/[id]/+page.svelte @@ -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/index.js'; + import { WireguardGuide } from '$lib/components/app/wireguard-guide'; const { data }: { data: PageData } = $props(); @@ -16,7 +16,39 @@ 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; + }, ''); + + @@ -31,6 +63,14 @@
{@html qrCode.svg()}
+ + +
+ + + +
+

Usage