From dbfdf8a0f958a1b351fed99b01ca50ffa6b19308 Mon Sep 17 00:00:00 2001 From: TZGyn Date: Mon, 30 Sep 2024 04:32:29 +0800 Subject: [PATCH] removed unused add shortener dialog component --- frontend/bun.lockb | Bin 220585 -> 220585 bytes .../lib/components/AddShortenerDialog.svelte | 130 ------------------ 2 files changed, 130 deletions(-) delete mode 100644 frontend/src/lib/components/AddShortenerDialog.svelte diff --git a/frontend/bun.lockb b/frontend/bun.lockb index 112585757c852c358b8991db3d0c42b3b0f76926..87a5a1b05b73df710122593bb373c1152e78ef00 100755 GIT binary patch delta 48 zcmZ3vn|I}I-i8*&ElldPatNhNjay{Fx?$xh5utdIs$(0ZiLf0+?HQ0d;*1 ArT_o{ delta 48 qcmZ3vn|I}I-i8*&Ell - import * as Dialog from '$lib/components/ui/dialog' - import * as Select from '$lib/components/ui/select' - import { Button, buttonVariants } from '$lib/components/ui/button' - import { Input } from '$lib/components/ui/input' - import { Label } from '$lib/components/ui/label' - import { Loader2, PlusCircle } from 'lucide-svelte' - import { invalidateAll } from '$app/navigation' - import { toast } from 'svelte-sonner' - import type { Project } from '$lib/db/types' - - export let projects: Project[] - export let dialogOpen: boolean - let inputLink = '' - let isLoading = false - - const addShortener = async () => { - isLoading = true - - const response = await fetch('/api/shortener', { - method: 'post', - body: JSON.stringify({ - link: inputLink, - projectId: shortenerCategory - ? shortenerCategory.value - : undefined, - }), - }) - - const responseData = await response.json() - - isLoading = false - - if (responseData.success) { - toast.success('Successfully Created Shortener') - await invalidateAll() - dialogOpen = false - } - } - - let inputTimer: any - let previewData: any - let isPreviewLoading: boolean = false - let shortenerCategory: any = undefined - - const getMetadata = async () => { - isPreviewLoading = true - clearTimeout(inputTimer) - inputTimer = setTimeout(async () => { - const response = await fetch( - `/api/url/metadata?url=${inputLink}`, - ) - previewData = await response.json() - isPreviewLoading = false - console.log(previewData) - }, 1000) - } - - - - - - Add Shortner - - - - Add Shortener - - Create A New Shortner Here. Click Add To Save. - - -
-
- - getMetadata()} - bind:value={inputLink} - placeholder="https://example.com" - class="col-span-3" /> -
-
- - - - - - - {#each projects as project} - {project.name} - {/each} - - -
-
-
Preview
-
-
- {#if isPreviewLoading} -
- -
- {:else if previewData} - -
- {previewData.title} -
- {/if} -
-
-
-
- - - -
-