diff --git a/front-end/src/views/Share.svelte b/front-end/src/views/Share.svelte
index 8c40171..1d18a71 100644
--- a/front-end/src/views/Share.svelte
+++ b/front-end/src/views/Share.svelte
@@ -10,6 +10,10 @@
let { question }: Props = $props();
+ let copied = $state(false);
+
+ const url = `${window.location.origin}/${question.key}`;
+
$effect(() => {
var style = window.getComputedStyle(document.documentElement);
const light = style.getPropertyValue("--color-bg");
@@ -17,7 +21,7 @@
const rem = parseFloat(style.fontSize);
const canvas = document.getElementById("qrcode") as HTMLCanvasElement;
- QRCode.toCanvas(canvas, `${window.location.origin}/${question.key}`, {
+ QRCode.toCanvas(canvas, url, {
color: {
dark,
light,
@@ -26,20 +30,66 @@
width: 12 * rem,
});
});
+
+ const copyLink = async () => {
+ try {
+ await navigator.clipboard.writeText(url);
+ copied = true;
+ setTimeout(() => {
+ copied = false;
+ }, 1500);
+ } catch {
+ /* Ignore error */
+ }
+ };
Scan the QR code to open the feedback form.
- +