The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update the folder listing with new UI
Kiran K36c1b53f1a4c
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/folders/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/folders/page-client.tsxindex d856124957..2b4f270b8c 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/folders/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/folders/page-client.tsx@@ -6,7 +6,7 @@ import useWorkspace from "@/lib/swr/use-workspace";import { FolderCard } from "@/ui/folders/folder-card";import { FolderCardPlaceholder } from "@/ui/folders/folder-card-placeholder";import EmptyState from "@/ui/shared/empty-state";-import { CardList, TooltipContent } from "@dub/ui";+import { TooltipContent } from "@dub/ui";import { InfoTooltip } from "@dub/ui/src/tooltip";import { Folder } from "lucide-react";@@ -19,14 +19,6 @@ export const FoldersPageClient = () => {showArchived: true,});- // const { AddEditTagModal, AddTagButton } = useAddEditTagModal();- // const [openMenuTagId, setOpenMenuTagId] = useState<string | null>(null);- // const { tags, loading } = useTags();- // const { data: tagsCount } = useLinksCount({- // groupBy: "tagId",- // showArchived: true,- // });-return (<><div className="grid gap-5">@@ -51,34 +43,24 @@ export const FoldersPageClient = () => {</div></div>- {/* {workspaceId && <AddEditTagModal />} */}-- {isLoading || folders?.length ? (- <CardList variant="loose" loading={isLoading}>- {folders?.length- ? folders.map((folder) => (- <FolderCard- key={folder.id}- folder={folder}- linksCount={- linksCount?.find((c) => c.folderId === folder.id)- ?.count ?? 0- }- />- ))- : Array.from({ length: 6 }).map((_, idx) => (- <FolderCardPlaceholder key={idx} />- ))}- </CardList>- ) : (+ {!isLoading && !folders?.length && (<div className="flex flex-col items-center gap-4 rounded-xl border border-gray-200 py-10"><EmptyStateicon={Folder}- title="No folders found for this workspace."+ title="No folders found for this workspace"/>- {/* <AddTagButton /> */}</div>)}++ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">+ {isLoading+ ? Array.from({ length: 6 }).map((_, idx) => (+ <FolderCardPlaceholder key={idx} />+ ))+ : folders?.map((folder) => (+ <FolderCard key={folder.id} folder={folder} />+ ))}+ </div></div></>);diff --git a/apps/web/ui/folders/folder-card-placeholder.tsx b/apps/web/ui/folders/folder-card-placeholder.tsxindex f1b7be286c..462d950075 100644--- a/apps/web/ui/folders/folder-card-placeholder.tsx+++ b/apps/web/ui/folders/folder-card-placeholder.tsx@@ -1,18 +1,23 @@-import { CardList } from "@dub/ui";--export function FolderCardPlaceholder() {+export const FolderCardPlaceholder = () => {return (- <CardList.Card>- <div className="flex h-8 items-center justify-between gap-5 sm:gap-8 md:gap-12">- <div className="flex items-center gap-3">- <div className="h-5 w-5 animate-pulse rounded-md bg-gray-200" />- <div className="h-5 w-16 animate-pulse rounded-md bg-gray-200 sm:w-32" />- </div>- <div className="flex items-center gap-5 sm:gap-8 md:gap-12">- <div className="h-5 w-16 animate-pulse rounded-md bg-gray-200" />- <div className="w-8" />+ <div className="relative h-36 rounded-xl border border-gray-200 bg-white px-5 py-4">+ <div className="flex">+ <div className="h-8 w-8 rounded-full bg-gray-100" />+ </div>++ <div className="mt-6">+ <div className="h-5 w-32 rounded-full bg-gray-100" />+ <div className="mt-1 flex items-center gap-5">+ <div className="flex items-center gap-2">+ <div className="h-4 w-4 rounded-full bg-gray-100" />+ <div className="h-4 w-20 rounded-full bg-gray-100" />+ </div>+ <div className="flex items-center gap-2">+ <div className="h-4 w-4 rounded-full bg-gray-100" />+ <div className="h-4 w-24 rounded-full bg-gray-100" />+ </div></div></div>- </CardList.Card>+ </div>);-}+};diff --git a/apps/web/ui/folders/folder-card.tsx b/apps/web/ui/folders/folder-card.tsxindex 9182aa9adc..ef09cdca6e 100644--- a/apps/web/ui/folders/folder-card.tsx+++ b/apps/web/ui/folders/folder-card.tsx@@ -1,27 +1,50 @@-import { FolderProps } from "@/lib/types";-import { CardList, useMediaQuery } from "@dub/ui";-import { FolderInfo } from "./folder-info";+"use client";-export const FolderCard = ({- folder,- linksCount,-}: {- folder: FolderProps;- linksCount: number;-}) => {- const { isMobile } = useMediaQuery();+import { FolderProps } from "@/lib/types";+import { Avatar } from "@dub/ui";+import { formatDate } from "@dub/utils";+import { FolderIcon, Link2 } from "lucide-react";+import Link from "next/link";+export const FolderCard = ({ folder }: { folder: FolderProps }) => {return (- <>- <CardList.Card- key={folder.id}- onClick={isMobile ? undefined : () => () => {}}- innerClassName="flex items-center gap-5 sm:gap-8 md:gap-12 text-sm"- >- <div className="min-w-0 grow">- <FolderInfo folder={folder} linksCount={linksCount} />+ <Link+ href={"/"}+ className="hover:drop-shadow-card-hover relative h-auto rounded-xl border border-gray-200 bg-white p-3 transition-[filter] sm:h-36 sm:p-4 sm:px-5 sm:py-4"+ >+ <div className="flex">+ <div className="hidden rounded-full bg-green-200 p-0.5 sm:block">+ <div className="rounded-full border-2 border-white p-1.5 sm:p-2">+ <FolderIcon className="size-2.5 sm:size-3" />+ </div>+ </div>+ </div>++ <div className="sm:mt-6">+ <span className="text-sm font-semibold text-gray-900 sm:text-base">+ {folder.name}+ </span>+ <div className="mt-1 flex flex-col gap-1 text-gray-500 sm:flex-row sm:items-center sm:gap-5">+ <div className="flex items-center gap-1 sm:gap-2">+ <Link2 className="size-3 rotate-90 transform sm:size-4" />+ <span className="text-xs font-normal sm:text-sm">100 links</span>+ </div>+ <div className="flex items-center gap-1 sm:gap-2">+ <Avatar+ user={{+ image:+ "https://avatars.githubusercontent.com/u/28986134?s=64&v=4",+ }}+ className="size-3 sm:size-4"+ />+ <span className="text-xs font-normal sm:text-sm">+ {formatDate(folder.createdAt, {+ year: undefined,+ })}+ </span>+ </div></div>- </CardList.Card>- </>+ </div>+ </Link>);};diff --git a/apps/web/ui/folders/icons/all-folders.tsx b/apps/web/ui/folders/icons/all-folders.tsxdeleted file mode 100644index 29d1cad044..0000000000--- a/apps/web/ui/folders/icons/all-folders.tsx+++ /dev/null@@ -1,42 +0,0 @@-import { SVGProps } from "react";--export function AllFolders(props: SVGProps<SVGSVGElement>) {- return (- <svg- width="16"- height="16"- viewBox="0 0 16 16"- fill="none"- xmlns="http://www.w3.org/2000/svg"- >- <g clip-path="url(#clip0_298_25371)">- <path- d="M2 7.77767V4.22211C2 3.23989 2.79556 2.44434 3.77778 2.44434H5.512C6.05156 2.44434 6.56089 2.68878 6.89867 3.10922L7.43467 3.77767H12.2222C13.2044 3.77767 14 4.57322 14 5.55545V7.33322"- stroke="#166534"- stroke-width="1.5"- stroke-linecap="round"- stroke-linejoin="round"- />- <path- d="M13.9369 7.33333C13.7387 6.568 13.0498 6 12.2222 6H3.77778C2.79556 6 2 6.79644 2 7.77778V11.7778C2 12.7591 2.79556 13.5556 3.77778 13.5556H9.11111"- stroke="#166534"- stroke-width="1.5"- stroke-linecap="round"- stroke-linejoin="round"- />- <path- d="M15.3335 15.3334L13.3335 13.3334L11.3335 15.3334V10.4446C11.3335 9.95389 11.7317 9.55566 12.2224 9.55566H14.4446C14.9353 9.55566 15.3335 9.95389 15.3335 10.4446V15.3334Z"- stroke="#166534"- stroke-width="1.5"- stroke-linecap="round"- stroke-linejoin="round"- />- </g>- <defs>- <clipPath id="clip0_298_25371">- <rect width="16" height="16" fill="white" />- </clipPath>- </defs>- </svg>- );-}