diff --git a/frontend/src/routes/(app)/links/(component)/AddShortenerDialog.svelte b/frontend/src/routes/(app)/links/(component)/AddShortenerDialog.svelte index a4a5e63..ece5372 100644 --- a/frontend/src/routes/(app)/links/(component)/AddShortenerDialog.svelte +++ b/frontend/src/routes/(app)/links/(component)/AddShortenerDialog.svelte @@ -1,12 +1,16 @@ @@ -71,6 +81,22 @@ placeholder="https://example.com" class="col-span-3" /> +
+ + + + + + + {#each projects as project} + {project.name} + {/each} + + +
Preview
@@ -79,14 +105,14 @@
- {:else if data} + {:else if previewData}
- {data.title} + class="absolute bottom-2 left-2 rounded-lg bg-secondary px-2"> + {previewData.title}
{/if}
diff --git a/frontend/src/routes/(app)/links/+page.svelte b/frontend/src/routes/(app)/links/+page.svelte index 669f5c4..82cabd2 100644 --- a/frontend/src/routes/(app)/links/+page.svelte +++ b/frontend/src/routes/(app)/links/+page.svelte @@ -85,7 +85,7 @@
Links
- +
@@ -166,7 +166,7 @@
diff --git a/frontend/src/routes/api/shortener/+server.ts b/frontend/src/routes/api/shortener/+server.ts index a2b6829..b6377b6 100644 --- a/frontend/src/routes/api/shortener/+server.ts +++ b/frontend/src/routes/api/shortener/+server.ts @@ -10,6 +10,7 @@ export const GET: RequestHandler = async () => { const shortenerInsertSchema = z.object({ link: z.string().url(), + projectId: z.number().nullable(), }) export const POST: RequestHandler = async (event) => { @@ -32,6 +33,7 @@ export const POST: RequestHandler = async (event) => { await db.insert(shortener).values({ link: shortenerInsert.data.link, + projectId: shortenerInsert.data.projectId, userId: user.id, code: code, })