From 994691b02515dfb579a5c3618631065bd76b9e4b Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sun, 7 Apr 2024 19:02:52 +0100 Subject: refactor(web): Move the tooltip provider to the root of the app --- .../web/components/dashboard/preview/ActionBar.tsx | 117 ++++++++++----------- .../dashboard/preview/BookmarkPreview.tsx | 45 ++++---- apps/web/components/ui/info-tooltip.tsx | 26 ++--- apps/web/lib/providers.tsx | 3 +- 4 files changed, 89 insertions(+), 102 deletions(-) (limited to 'apps') diff --git a/apps/web/components/dashboard/preview/ActionBar.tsx b/apps/web/components/dashboard/preview/ActionBar.tsx index f2e3023e..45d67b34 100644 --- a/apps/web/components/dashboard/preview/ActionBar.tsx +++ b/apps/web/components/dashboard/preview/ActionBar.tsx @@ -2,7 +2,6 @@ import { ActionButton } from "@/components/ui/action-button"; import { Tooltip, TooltipContent, - TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; import { toast } from "@/components/ui/use-toast"; @@ -52,64 +51,62 @@ export default function ActionBar({ bookmark }: { bookmark: ZBookmark }) { }); return ( - -
- - - { - favBookmark({ - bookmarkId: bookmark.id, - favourited: !bookmark.favourited, - }); - }} - > - - - - - {bookmark.favourited ? "Un-favourite" : "Favourite"} - - - - - { - archiveBookmark({ - bookmarkId: bookmark.id, - archived: !bookmark.archived, - }); - }} - > - - - - - {bookmark.archived ? "Un-archive" : "Archive"} - - - - - { - deleteBookmark({ bookmarkId: bookmark.id }); - }} - > - - - - Delete - -
-
+
+ + + { + favBookmark({ + bookmarkId: bookmark.id, + favourited: !bookmark.favourited, + }); + }} + > + + + + + {bookmark.favourited ? "Un-favourite" : "Favourite"} + + + + + { + archiveBookmark({ + bookmarkId: bookmark.id, + archived: !bookmark.archived, + }); + }} + > + + + + + {bookmark.archived ? "Un-archive" : "Archive"} + + + + + { + deleteBookmark({ bookmarkId: bookmark.id }); + }} + > + + + + Delete + +
); } diff --git a/apps/web/components/dashboard/preview/BookmarkPreview.tsx b/apps/web/components/dashboard/preview/BookmarkPreview.tsx index bd7881a3..cf8bc2d8 100644 --- a/apps/web/components/dashboard/preview/BookmarkPreview.tsx +++ b/apps/web/components/dashboard/preview/BookmarkPreview.tsx @@ -8,7 +8,6 @@ import { Tooltip, TooltipContent, TooltipPortal, - TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; import { @@ -41,18 +40,16 @@ function ContentLoading() { function CreationTime({ createdAt }: { createdAt: Date }) { return ( - - - - - {dayjs(createdAt).fromNow()} - - - - {createdAt.toLocaleString()} - - - + + + + {dayjs(createdAt).fromNow()} + + + + {createdAt.toLocaleString()} + + ); } @@ -65,18 +62,16 @@ function LinkHeader({ bookmark }: { bookmark: ZBookmark }) { return (
- - - -

{title}

-
- - - {title} - - -
-
+ + +

{title}

+
+ + + {title} + + +
- - - {variant === "tip" ? ( - - ) : ( - - )} - - {children} - - + + + {variant === "tip" ? ( + + ) : ( + + )} + + {children} + ); } diff --git a/apps/web/lib/providers.tsx b/apps/web/lib/providers.tsx index b700d0c1..60f30931 100644 --- a/apps/web/lib/providers.tsx +++ b/apps/web/lib/providers.tsx @@ -3,6 +3,7 @@ import type { Session } from "next-auth"; import React, { useState } from "react"; import { ThemeProvider } from "@/components/theme-provider"; +import { TooltipProvider } from "@/components/ui/tooltip"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { httpBatchLink, loggerLink } from "@trpc/client"; import { SessionProvider } from "next-auth/react"; @@ -80,7 +81,7 @@ export default function Providers({ enableSystem disableTransitionOnChange > - {children} + {children} -- cgit v1.2.3-70-g09d2