From 2413f0efee2dcb4cd4c9389f5a496d4b3f71335c Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Tue, 5 Mar 2024 19:38:34 +0000
Subject: fix: Show loading indicators in the bookmark preview page

---
 .../web/app/dashboard/bookmarks/components/TextCard.tsx  | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

(limited to 'packages/web/app/dashboard/bookmarks/components/TextCard.tsx')

diff --git a/packages/web/app/dashboard/bookmarks/components/TextCard.tsx b/packages/web/app/dashboard/bookmarks/components/TextCard.tsx
index 5e0ba3f9..2565e69d 100644
--- a/packages/web/app/dashboard/bookmarks/components/TextCard.tsx
+++ b/packages/web/app/dashboard/bookmarks/components/TextCard.tsx
@@ -9,15 +9,8 @@ import TagList from "./TagList";
 import Markdown from "react-markdown";
 import { useState } from "react";
 import { BookmarkedTextViewer } from "./BookmarkedTextViewer";
-import { Button } from "@/components/ui/button";
 import Link from "next/link";
-
-function isStillTagging(bookmark: ZBookmark) {
-  return (
-    bookmark.taggingStatus == "pending" &&
-    Date.now().valueOf() - bookmark.createdAt.valueOf() < 30 * 1000
-  );
-}
+import { isBookmarkStillTagging } from "@/lib/bookmarkUtils";
 
 export default function TextCard({
   bookmark: initialData,
@@ -37,7 +30,7 @@ export default function TextCard({
         if (!data) {
           return false;
         }
-        if (isStillTagging(data)) {
+        if (isBookmarkStillTagging(data)) {
           return 1000;
         }
         return false;
@@ -69,7 +62,10 @@ export default function TextCard({
           {bookmarkedText.text}
         </Markdown>
         <div className="mt-4 flex flex-none flex-wrap gap-1 overflow-hidden">
-          <TagList bookmark={bookmark} loading={isStillTagging(bookmark)} />
+          <TagList
+            bookmark={bookmark}
+            loading={isBookmarkStillTagging(bookmark)}
+          />
         </div>
         <div className="flex w-full justify-between">
           <div />
-- 
cgit v1.2.3-70-g09d2

