The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update folder switcher for new app layout
Tim Wilsona77e2f68df43
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/links-title.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links-title.tsxnew file mode 100644index 0000000000..09a12a5652--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/links-title.tsx@@ -0,0 +1,14 @@+"use client";++import useWorkspace from "@/lib/swr/use-workspace";+import { FolderSwitcher } from "@/ui/folders/folder-switcher";++/**+ * Renders the title for the links page ("Links"), or the folder switcher if the linkFolders feature flag is enabled+ * We can remove this component when removing the linkFolders feature flag+ */+export function LinksTitle() {+ const { flags } = useWorkspace();++ return flags?.linkFolders ? <FolderSwitcher /> : <h1>Links</h1>;+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/page-client.tsxindex 706c4deaa3..e660d2c314 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/page-client.tsx@@ -6,7 +6,6 @@ import {} from "@/lib/swr/use-folder-permissions";import useLinks from "@/lib/swr/use-links";import useWorkspace from "@/lib/swr/use-workspace";-import { FolderSwitcher } from "@/ui/folders/folder-switcher";import { FolderEditAccessRequestButton } from "@/ui/folders/request-edit-button";import LinkDisplay from "@/ui/links/link-display";import LinksContainer from "@/ui/links/links-container";@@ -90,8 +89,6 @@ function WorkspaceLinks() {<div className="flex w-full items-center pt-3"><MaxWidthWrapper className="flex flex-col gap-y-3"><div className="flex flex-wrap items-center justify-between gap-2 lg:flex-nowrap">- {flags?.linkFolders && <FolderSwitcher />}-<div className="flex w-full grow gap-2 md:w-auto"><div className="grow basis-0 md:grow-0"><Filter.Selectdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/page.tsxindex 84e1359829..365118e3a7 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/page.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/page.tsx@@ -1,9 +1,10 @@import { PageContent } from "@/ui/layout/page-content";+import { LinksTitle } from "./links-title";import WorkspaceLinksClient from "./page-client";export default function WorkspaceLinks() {return (- <PageContent title="Links">+ <PageContent title={<LinksTitle />}><WorkspaceLinksClient /></PageContent>);diff --git a/apps/web/ui/folders/folder-switcher.tsx b/apps/web/ui/folders/folder-switcher.tsxindex f552bb688e..5c6756f85b 100644--- a/apps/web/ui/folders/folder-switcher.tsx+++ b/apps/web/ui/folders/folder-switcher.tsx@@ -108,12 +108,12 @@ export const FolderSwitcher = () => {setOpenPopover={setOpenPopover}align="start">- <button className="flex items-center gap-2 rounded-md px-2 py-1 hover:bg-gray-100">- <h1 className="order-1 text-2xl font-semibold tracking-tight text-black">+ <button className="group -my-1 flex items-center gap-2 rounded-lg py-1 pl-2 pr-1 transition-colors duration-75 hover:bg-gray-100 data-[state=open]:bg-gray-200">+ <h1 className="text-xl font-semibold leading-7 text-neutral-900 md:text-2xl">{selectedFolder?.name}</h1><ChevronsUpDown- className="h-5 w-5 shrink-0 text-gray-400"+ className="size-5 shrink-0 text-gray-400"aria-hidden="true"/></button>@@ -145,7 +145,7 @@ const FolderList = ({return (<div className="relative mt-1 max-h-72 w-full space-y-0.5 overflow-auto rounded-md bg-white p-2 text-base sm:w-60 sm:text-sm sm:shadow-lg"><div className="flex items-center justify-between px-2 pb-1">- <p className="text-xs text-gray-500">Folders</p>+ <p className="text-xs font-medium text-gray-500">Folders</p>{folders.length > 0 && (<Linkhref="/settings/folders"@@ -337,8 +337,6 @@ const FolderActions = ({const FolderSwitcherPlaceholder = () => {return (- <div className="flex animate-pulse items-center space-x-1.5 rounded-lg px-1.5 py-2 sm:w-60">- <div className="hidden h-10 animate-pulse rounded-md bg-gray-200 sm:block sm:w-40" />- </div>+ <div className="h-7 w-20 animate-pulse rounded-lg bg-gray-200 sm:w-32 md:h-9" />);};diff --git a/apps/web/ui/layout/page-content/index.tsx b/apps/web/ui/layout/page-content/index.tsxindex 02c3615852..b246683e1c 100644--- a/apps/web/ui/layout/page-content/index.tsx+++ b/apps/web/ui/layout/page-content/index.tsx@@ -10,6 +10,7 @@ export function PageContent({children,}: PropsWithChildren<{ title?: ReactNode }>) {const hasTitle = title !== undefined;+ const TitleComponent = typeof title === "string" ? "h1" : "div";return (<div className="bg-neutral-100 md:bg-white">@@ -18,9 +19,9 @@ export function PageContent({<div className="flex items-center gap-4"><NavButton />{hasTitle && (- <h1 className="text-xl font-semibold leading-7 text-neutral-900 md:text-2xl">+ <TitleComponent className="text-xl font-semibold leading-7 text-neutral-900 md:text-2xl">{title}- </h1>+ </TitleComponent>)}</div><div className="flex items-center gap-4 md:hidden">