|
|
|
@ -18,7 +18,7 @@
|
|
|
|
TrashIcon,
|
|
|
|
TrashIcon,
|
|
|
|
} from 'lucide-svelte'
|
|
|
|
} from 'lucide-svelte'
|
|
|
|
import DeleteShortenerDialog from './DeleteShortenerDialog.svelte'
|
|
|
|
import DeleteShortenerDialog from './DeleteShortenerDialog.svelte'
|
|
|
|
import EditLinkPage from '$lib/../routes/(app)/links/[id]/edit/+page.svelte'
|
|
|
|
import EditLinkPage from '$lib/../routes/(app)/dashboard/links/[id]/edit/+page.svelte'
|
|
|
|
|
|
|
|
|
|
|
|
import { goto, preloadData, pushState } from '$app/navigation'
|
|
|
|
import { goto, preloadData, pushState } from '$app/navigation'
|
|
|
|
import { cn } from '$lib/utils'
|
|
|
|
import { cn } from '$lib/utils'
|
|
|
|
@ -41,16 +41,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
const getUrl = () => {
|
|
|
|
const getUrl = () => {
|
|
|
|
if (shortener.projectUuid) {
|
|
|
|
if (shortener.projectUuid) {
|
|
|
|
return `/projects/${shortener.projectUuid}`
|
|
|
|
return `/dashboard/projects/${shortener.projectUuid}`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ''
|
|
|
|
return '/dashboard'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let editProjectLinkOpen = false
|
|
|
|
let editProjectLinkOpen = false
|
|
|
|
let editData: typeof $page.state.editLink
|
|
|
|
let editData: typeof $page.state.editLink
|
|
|
|
|
|
|
|
|
|
|
|
const showEditModal = async (code: string) => {
|
|
|
|
const showEditModal = async (code: string) => {
|
|
|
|
const href = `/links/${code}/edit`
|
|
|
|
const href = `/dashboard/links/${code}/edit`
|
|
|
|
const result = await preloadData(href)
|
|
|
|
const result = await preloadData(href)
|
|
|
|
|
|
|
|
|
|
|
|
if (result.type === 'loaded' && result.status === 200) {
|
|
|
|
if (result.type === 'loaded' && result.status === 200) {
|
|
|
|
@ -70,7 +70,7 @@
|
|
|
|
const result = await preloadData(href)
|
|
|
|
const result = await preloadData(href)
|
|
|
|
|
|
|
|
|
|
|
|
if (result.type === 'loaded' && result.status === 200) {
|
|
|
|
if (result.type === 'loaded' && result.status === 200) {
|
|
|
|
if (getUrl().startsWith('/projects')) {
|
|
|
|
if (getUrl().startsWith('/dashboard/projects')) {
|
|
|
|
pushState(href, { projectLinkQR: result.data })
|
|
|
|
pushState(href, { projectLinkQR: result.data })
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
pushState(href, { linkQR: result.data })
|
|
|
|
pushState(href, { linkQR: result.data })
|
|
|
|
@ -113,7 +113,7 @@
|
|
|
|
</Tooltip.Root>
|
|
|
|
</Tooltip.Root>
|
|
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
class="flex items-center gap-2 text-sm text-muted-foreground">
|
|
|
|
class="text-muted-foreground flex items-center gap-2 text-sm">
|
|
|
|
<a
|
|
|
|
<a
|
|
|
|
href={'https://' + shortenerUrl + '/' + shortener.code}
|
|
|
|
href={'https://' + shortenerUrl + '/' + shortener.code}
|
|
|
|
target="_blank"
|
|
|
|
target="_blank"
|
|
|
|
@ -131,7 +131,7 @@
|
|
|
|
<DropdownMenu.Content>
|
|
|
|
<DropdownMenu.Content>
|
|
|
|
<DropdownMenu.Group>
|
|
|
|
<DropdownMenu.Group>
|
|
|
|
<a
|
|
|
|
<a
|
|
|
|
href={`/links/${shortener.code}/edit`}
|
|
|
|
href={`/dashboard/links/${shortener.code}/edit`}
|
|
|
|
on:click|preventDefault={() =>
|
|
|
|
on:click|preventDefault={() =>
|
|
|
|
showEditModal(shortener.code)}>
|
|
|
|
showEditModal(shortener.code)}>
|
|
|
|
<DropdownMenu.Item class="flex items-center gap-2">
|
|
|
|
<DropdownMenu.Item class="flex items-center gap-2">
|
|
|
|
@ -140,7 +140,7 @@
|
|
|
|
</a>
|
|
|
|
</a>
|
|
|
|
<DropdownMenu.Item
|
|
|
|
<DropdownMenu.Item
|
|
|
|
on:click={() => openDeleteDialog(shortener.code)}
|
|
|
|
on:click={() => openDeleteDialog(shortener.code)}
|
|
|
|
class="flex items-center gap-2 text-destructive data-[highlighted]:bg-destructive">
|
|
|
|
class="text-destructive data-[highlighted]:bg-destructive flex items-center gap-2">
|
|
|
|
<TrashIcon size={16} />
|
|
|
|
<TrashIcon size={16} />
|
|
|
|
Delete
|
|
|
|
Delete
|
|
|
|
</DropdownMenu.Item>
|
|
|
|
</DropdownMenu.Item>
|
|
|
|
@ -153,8 +153,8 @@
|
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
<div class="flex gap-2">
|
|
|
|
<div class="flex gap-2">
|
|
|
|
<Button
|
|
|
|
<Button
|
|
|
|
href={`/links/${shortener.code}`}
|
|
|
|
href={`/dashboard/links/${shortener.code}`}
|
|
|
|
class="flex h-8 items-center justify-center gap-1 rounded bg-secondary text-sm">
|
|
|
|
class="bg-secondary flex h-8 items-center justify-center gap-1 rounded text-sm">
|
|
|
|
<BarChart size={20} />
|
|
|
|
<BarChart size={20} />
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
{shortener.visitorCount} visits
|
|
|
|
{shortener.visitorCount} visits
|
|
|
|
@ -163,7 +163,7 @@
|
|
|
|
<a
|
|
|
|
<a
|
|
|
|
class={cn(
|
|
|
|
class={cn(
|
|
|
|
buttonVariants({ variant: 'default' }),
|
|
|
|
buttonVariants({ variant: 'default' }),
|
|
|
|
'flex h-8 items-center justify-center gap-1 rounded bg-secondary text-sm',
|
|
|
|
'bg-secondary flex h-8 items-center justify-center gap-1 rounded text-sm',
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
href={`${getUrl()}/links/${shortener.code}/qr`}
|
|
|
|
href={`${getUrl()}/links/${shortener.code}/qr`}
|
|
|
|
on:click|preventDefault={showQRModal}>
|
|
|
|
on:click|preventDefault={showQRModal}>
|
|
|
|
|