From ec15d20abac65bfda6c8e6396ce9fc2061f5067a Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Wed, 24 Apr 2024 14:52:57 +0100
Subject: ui(web): Show bookmark URL when maximizing a bookmark

---
 apps/web/components/dashboard/preview/BookmarkPreview.tsx | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

(limited to 'apps/web/components/dashboard/preview/BookmarkPreview.tsx')

diff --git a/apps/web/components/dashboard/preview/BookmarkPreview.tsx b/apps/web/components/dashboard/preview/BookmarkPreview.tsx
index 581ec4bd..3d98dd19 100644
--- a/apps/web/components/dashboard/preview/BookmarkPreview.tsx
+++ b/apps/web/components/dashboard/preview/BookmarkPreview.tsx
@@ -3,6 +3,7 @@
 import { useEffect, useState } from "react";
 import Link from "next/link";
 import { TagsEditor } from "@/components/dashboard/bookmarks/TagsEditor";
+import { FullPageSpinner } from "@/components/ui/full-page-spinner";
 import { Separator } from "@/components/ui/separator";
 import { Skeleton } from "@/components/ui/skeleton";
 import {
@@ -65,13 +66,15 @@ function CreationTime({ createdAt }: { createdAt: Date }) {
 }
 
 export default function BookmarkPreview({
+  bookmarkId,
   initialData,
 }: {
-  initialData: ZBookmark;
+  bookmarkId: string;
+  initialData?: ZBookmark;
 }) {
   const { data: bookmark } = api.bookmarks.getBookmark.useQuery(
     {
-      bookmarkId: initialData.id,
+      bookmarkId,
     },
     {
       initialData,
@@ -89,6 +92,10 @@ export default function BookmarkPreview({
     },
   );
 
+  if (!bookmark) {
+    return <FullPageSpinner />;
+  }
+
   let content;
   switch (bookmark.content.type) {
     case "link": {
-- 
cgit v1.2.3-70-g09d2

