Updated dashbpard and added sonner

This commit is contained in:
2025-06-26 14:09:10 +02:00
parent da0524a4fc
commit 4381d81710
14 changed files with 628 additions and 12 deletions

View File

@@ -9,8 +9,12 @@ export default function DashboardLayout({
}) {
return (
<SidebarProvider>
<DashboardSidebar />
{children}
<div className="min-h-screen flex w-full">
<DashboardSidebar />
<main className="flex-1 overflow-auto">
{children}
</main>
</div>
</SidebarProvider>
)
}

View File

@@ -1,8 +1,16 @@
export default function DashboardListPage() {
import { UrlsDataTable } from "@/components/dashboard/urls-data-table"
import { getAllUrls } from "@/lib/db/urls"
export default async function DashboardListPage() {
const urls = await getAllUrls()
return (
<div className="p-6">
<h1 className="text-2xl font-bold text-gray-900 mb-4">List</h1>
<p className="text-gray-600">This is the list page where you can view all items.</p>
<div className="mb-6">
<h1 className="text-2xl font-bold text-gray-900 mb-2">URLs</h1>
<p className="text-gray-600">Manage all your shortened URLs.</p>
</div>
<UrlsDataTable data={urls} />
</div>
)
}

View File

@@ -15,11 +15,15 @@ export default async function Dashboard() {
// Determine the most visited URL display value
const mostVisitedDisplay = stats.mostVisitedUrl
? `${stats.mostVisitedUrl.title} (${stats.mostVisitedUrl.visitCount})`
? stats.mostVisitedUrl.visitCount > 0
? `${stats.mostVisitedUrl.title} (${stats.mostVisitedUrl.visitCount})`
: "No visits"
: "No URLs"
const mostVisitedDescription = stats.mostVisitedUrl
? `/${stats.mostVisitedUrl.slug} - ${stats.mostVisitedUrl.visitCount} visits`
? stats.mostVisitedUrl.visitCount > 0
? `/${stats.mostVisitedUrl.slug} - ${stats.mostVisitedUrl.visitCount} visits`
: "No URLs have been visited yet"
: "Create your first shortened URL"
return (