|
| 1 | +<script lang="ts"> |
| 2 | + import { afterUpdate, onDestroy, onMount } from 'svelte'; |
| 3 | + import { modeCurrent } from '@skeletonlabs/skeleton'; |
| 4 | + import type { Unsubscriber } from 'svelte/store'; |
| 5 | +
|
| 6 | + let container: HTMLDivElement; |
| 7 | + let modeUnsubscribe: Unsubscriber; |
| 8 | + onMount(async () => { |
| 9 | + modeUnsubscribe = modeCurrent.subscribe((m) => { |
| 10 | + container.style.backgroundColor = m ? 'white' : '#121212'; |
| 11 | + }); |
| 12 | +
|
| 13 | + // @ts-ignore |
| 14 | + !(function (w, d, i, s) { |
| 15 | + function l() { |
| 16 | + if (!d.getElementById(i)) { |
| 17 | + var f = d.getElementsByTagName(s)[0], |
| 18 | + e = d.createElement(s); |
| 19 | + // @ts-ignore |
| 20 | + (e.type = 'text/javascript'), |
| 21 | + // @ts-ignore |
| 22 | + (e.async = !0), |
| 23 | + // @ts-ignore |
| 24 | + (e.src = 'https://canny.io/sdk.js'), |
| 25 | + // @ts-ignore |
| 26 | + f.parentNode.insertBefore(e, f); |
| 27 | + } |
| 28 | + } |
| 29 | + // @ts-ignore |
| 30 | + if ('function' != typeof w.Canny) { |
| 31 | + var c = function () { |
| 32 | + // @ts-ignore |
| 33 | + c.q.push(arguments); |
| 34 | + }; |
| 35 | + // @ts-ignore |
| 36 | + (c.q = []), |
| 37 | + // @ts-ignore |
| 38 | + (w.Canny = c), |
| 39 | + 'complete' === d.readyState |
| 40 | + ? l() |
| 41 | + : // @ts-ignore |
| 42 | + w.attachEvent |
| 43 | + ? // @ts-ignore |
| 44 | + w.attachEvent('onload', l) |
| 45 | + : w.addEventListener('load', l, !1); |
| 46 | + } |
| 47 | + })(window, document, 'canny-jssdk', 'script'); |
| 48 | + }); |
| 49 | + afterUpdate(() => { |
| 50 | + // @ts-ignore |
| 51 | + if ('function' === typeof window.Canny) { |
| 52 | + // @ts-ignore |
| 53 | + Canny('render', { |
| 54 | + boardToken: '185218a5-57c7-2354-9eba-30105a9da7bd', |
| 55 | + basePath: '/feedback', // See step 2 |
| 56 | + ssoToken: null, // See step 3, |
| 57 | + theme: $modeCurrent ? 'light' : 'dark' |
| 58 | + }); |
| 59 | + } |
| 60 | + }); |
| 61 | + onDestroy(() => { |
| 62 | + if (modeUnsubscribe) modeUnsubscribe(); |
| 63 | + }); |
| 64 | +</script> |
| 65 | + |
| 66 | +<div class="flex justify-center h-full w-full" bind:this={container}> |
| 67 | + <div class="w-full h-full max-w-5xl p-8" data-canny></div> |
| 68 | +</div> |
0 commit comments