The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
only show the hint if there filters but showArchived is false
Steven Tey75bf2b481a67
diff --git a/apps/web/ui/links/archived-links-hint.tsx b/apps/web/ui/links/archived-links-hint.tsxindex 0c04082400..c63844560c 100644--- a/apps/web/ui/links/archived-links-hint.tsx+++ b/apps/web/ui/links/archived-links-hint.tsx@@ -1,5 +1,3 @@-"use client";-import useLinksCount from "@/lib/swr/use-links-count";import { useRouterStuff } from "@dub/ui";import { Archive } from "lucide-react";@@ -8,27 +6,28 @@ 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+ return searchParams.size > 0 && !showArchived && <ArchivedLinksHintHelper />;+}++function ArchivedLinksHintHelper() {const { data: count } = useLinksCount({ showArchived: true });const { queryParams } = useRouterStuff();return (- count > 0 &&- !showArchived && (+ count > 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 {count} archived links that match your filters.</p><buttonclassName="ml-1 font-medium underline underline-offset-2 hover:text-gray-800"onClick={() =>- queryParams(- showArchived- ? { del: "showArchived" }- : {- set: {- showArchived: "true",- },- },- )+ queryParams({+ set: {+ showArchived: "true",+ },+ })}>Show archived links?