From 6928800a604f05ef62234cb5c3ee1e60fb27ea1a Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sun, 9 Jun 2024 21:05:21 +0000 Subject: refactor: Extract the bookmark polling logic into a separate shared component --- .../dashboard/bookmarks/BookmarksGrid.tsx | 34 ++++++---------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx') diff --git a/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx b/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx index b44dea33..540546fe 100644 --- a/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx +++ b/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx @@ -11,12 +11,10 @@ import resolveConfig from "tailwindcss/resolveConfig"; import type { ZBookmark } from "@hoarder/shared/types/bookmarks"; -import AssetCard from "./AssetCard"; +import BookmarkCard from "./BookmarkCard"; import EditorCard from "./EditorCard"; -import LinkCard from "./LinkCard"; -import TextCard from "./TextCard"; -function BookmarkCard({ children }: { children: React.ReactNode }) { +function StyledBookmarkCard({ children }: { children: React.ReactNode }) { return ( {children} @@ -36,24 +34,6 @@ function getBreakpointConfig() { return breakpointColumnsObj; } -function renderBookmark(bookmark: ZBookmark) { - let comp; - switch (bookmark.content.type) { - case "link": - comp = ; - break; - case "text": - comp = ; - break; - case "asset": - comp = ( - - ); - break; - } - return {comp}; -} - export default function BookmarksGrid({ bookmarks, hasNextPage = false, @@ -76,11 +56,15 @@ export default function BookmarksGrid({ const children = [ showEditorCard && ( - + - + ), - ...bookmarks.map((b) => renderBookmark(b)), + ...bookmarks.map((b) => ( + + + + )), ]; return ( <> -- cgit v1.2.3-70-g09d2