Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fixed archived links hint

Steven Teya87cfed8a3fa
diff --git a/apps/web/ui/links/archived-links-hint.tsx b/apps/web/ui/links/archived-links-hint.tsx
index d87f7058f7..b4ff8b8bb5 100644
--- a/apps/web/ui/links/archived-links-hint.tsx
+++ b/apps/web/ui/links/archived-links-hint.tsx
@@ -1,12 +1,12 @@
import useLinksCount from "@/lib/swr/use-links-count";
-import { useRouterStuff } from "@dub/ui";
-import { Archive } from "lucide-react";
+import { Button, useRouterStuff } from "@dub/ui";
+import { BoxArchive } from "@dub/ui/src/icons";
+import { Tooltip } from "@dub/ui/src/tooltip";
import { useSearchParams } from "next/navigation";
export default function ArchivedLinksHint() {
const searchParams = useSearchParams();
const showArchived = searchParams.get("showArchived") === "true";
-
// only show the hint if there filters but showArchived is false
// @ts-ignore – until https://github.com/microsoft/TypeScript/issues/54466 is fixed
return searchParams.size > 0 && !showArchived && <ArchivedLinksHintHelper />;
@@ -20,22 +20,41 @@ function ArchivedLinksHintHelper() {
return (
archivedCount > 0 && (
- <li className="flex items-center rounded-lg border border-gray-200 bg-white p-3 text-sm text-gray-500 ring-2 ring-gray-50 transition-all sm:p-4">
- <Archive className="mr-2 h-4 w-4" />
- <p>You have {archivedCount} archived links that match your filters.</p>
- <button
- className="ml-1 font-medium underline underline-offset-2 hover:text-gray-800"
- onClick={() =>
- queryParams({
- set: {
- showArchived: "true",
- },
- })
- }
- >
- Show archived links?
- </button>
- </li>
+ <Tooltip
+ side="top"
+ content={
+ <div className="px-3 py-2 text-sm text-gray-500">
+ <div className="flex items-center gap-4">
+ <span>
+ <span className="font-medium text-gray-950">
+ {archivedCount}
+ </span>{" "}
+ archived link{archivedCount !== 1 && "s"} that match
+ {archivedCount === 1 && "es"} the applied filters
+ </span>
+ <div>
+ <Button
+ className="h-6 px-2"
+ variant="secondary"
+ text="Show archived links"
+ onClick={() =>
+ queryParams({
+ set: {
+ showArchived: "true",
+ },
+ })
+ }
+ />
+ </div>
+ </div>
+ </div>
+ }
+ >
+ <div className="flex cursor-default items-center gap-1.5 rounded-md bg-gray-100 px-2 py-0.5 text-sm font-medium text-gray-950 hover:bg-gray-200">
+ <BoxArchive className="h-3 w-3" />
+ {archivedCount}
+ </div>
+ </Tooltip>
)
);
}
diff --git a/apps/web/ui/links/links-container.tsx b/apps/web/ui/links/links-container.tsx
index 32e6d4037b..e4b596932c 100644
--- a/apps/web/ui/links/links-container.tsx
+++ b/apps/web/ui/links/links-container.tsx
@@ -4,16 +4,14 @@ import useLinks from "@/lib/swr/use-links";
import useLinksCount from "@/lib/swr/use-links-count";
import { LinkWithTagsProps, UserProps } from "@/lib/types";
import {
- Button,
CardList,
MaxWidthWrapper,
- Tooltip,
useMediaQuery,
useRouterStuff,
} from "@dub/ui";
-import { BoxArchive } from "@dub/ui/src/icons";
import { useSearchParams } from "next/navigation";
import { Dispatch, SetStateAction, createContext, useState } from "react";
+import ArchivedLinksHint from "./archived-links-hint";
import { LinkCard } from "./link-card";
import LinkCardPlaceholder from "./link-card-placeholder";
import LinkNotFound from "./link-not-found";
@@ -129,43 +127,7 @@ function LinksList({
totalCount={count ?? links.length}
resourceName={(plural) => `${plural ? "links" : "link"}`}
>
- {!!archivedCount && !isMobile && (
- <Tooltip
- side="top"
- content={
- <div className="px-3 py-2 text-sm text-gray-500">
- <div className="flex items-center gap-4">
- <span>
- <span className="font-medium text-gray-950">
- {archivedCount}
- </span>{" "}
- archived link{archivedCount !== 1 && "s"} that match
- {archivedCount === 1 && "es"} the applied filters
- </span>
- <div>
- <Button
- className="h-6 px-2"
- variant="secondary"
- text="Show archived links"
- onClick={() =>
- queryParams({
- set: {
- showArchived: "true",
- },
- })
- }
- />
- </div>
- </div>
- </div>
- }
- >
- <div className="flex cursor-default items-center gap-1.5 rounded-md bg-gray-100 px-2 py-0.5 text-sm font-medium text-gray-950 hover:bg-gray-200">
- <BoxArchive className="h-3 w-3" />
- {archivedCount}
- </div>
- </Tooltip>
- )}
+ <ArchivedLinksHint />
</CardList.Pagination>
)}
</LinksListContext.Provider>