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.

Merge branch 'multi-tags-analytics' into payouts

Steven Tey2c6916e72985
diff --cc apps/web/ui/analytics/analytics-provider.tsx
index a77ebe2e94,664d7ead62..46fe95c24d
--- a/apps/web/ui/analytics/analytics-provider.tsx
+++ b/apps/web/ui/analytics/analytics-provider.tsx
@@@ -105,16 -107,12 +106,19 @@@ export default function AnalyticsProvid
const key = searchParams?.get("key") || dashboardProps?.key;
// Whether to show conversions in shared analytics dashboards
- const showConversions = dashboardProps?.showConversions;
+ const showConversions =
+ adminPage ||
+ demoPage ||
+ partnerPage ||
+ conversionEnabled ||
+ dashboardProps?.showConversions
+ ? true
+ : false;
- const tagId = searchParams?.get("tagId") ?? undefined;
+ const tagIds = combineTagIds({
+ tagId: searchParams?.get("tagId"),
+ tagIds: searchParams?.get("tagIds")?.split(","),
+ })?.join(",");
// Default to last 24 hours
const { start, end } = useMemo(() => {
diff --cc apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
index a73037b277,63c644c08c..437080152c
--- a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
@@@ -1,8 -1,8 +1,9 @@@
"use client";
+import usePrograms from "@/lib/swr/use-programs";
import useWorkspace from "@/lib/swr/use-workspace";
import { BetaFeatures } from "@/lib/types";
+ import { useRouterStuff } from "@dub/ui";
import {
Books2,
CircleInfo,
@@@ -32,11 -30,11 +33,12 @@@ import { WorkspaceDropdown } from "./wo
const NAV_AREAS: SidebarNavAreas<{
slug: string;
+ queryString: string;
flags?: Record<BetaFeatures, boolean>;
+ programs?: { id: string }[];
}> = {
// Top-level
- default: ({ slug, programs }) => ({
- default: ({ slug, queryString }) => ({
++ default: ({ slug, queryString, programs }) => ({
showSwitcher: true,
showNews: true,
direction: "left",
@@@ -250,7 -194,7 +252,8 @@@ export function AppSidebarNav(
const { slug } = useParams() as { slug?: string };
const pathname = usePathname();
const { flags } = useWorkspace();
+ const { programs } = usePrograms();
+ const { getQueryString } = useRouterStuff();
const currentArea = useMemo(() => {
return pathname.startsWith("/account/settings")
@@@ -264,7 -208,7 +267,12 @@@
<SidebarNav
areas={NAV_AREAS}
currentArea={currentArea}
- data={{ slug: slug || "", flags, programs }}
- data={{ slug: slug || "", queryString: getQueryString(), flags }}
++ data={{
++ slug: slug || "",
++ queryString: getQueryString(),
++ flags,
++ programs,
++ }}
toolContent={toolContent}
newsContent={newsContent}
switcher={<WorkspaceDropdown />}
diff --cc apps/web/ui/layout/sidebar/sidebar-nav.tsx
index 2337200888,b883c67f66..b61a886a2a
--- a/apps/web/ui/layout/sidebar/sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
@@@ -152,67 -138,32 +152,69 @@@ function NavItem({ item }: { item: NavI
const pathname = usePathname();
- const isActive = useMemo(
- () => isItemActive(pathname, { href, exact }),
- [pathname, href, exact],
- );
+ const isActive = useMemo(() => {
+ const hrefWithoutQuery = href.split("?")[0];
+ return exact
+ ? pathname === hrefWithoutQuery
+ : pathname.startsWith(hrefWithoutQuery);
+ }, [pathname, href, exact]);
return (
- <Link
- href={href}
- data-active={isActive}
- onPointerEnter={() => setHovered(true)}
- onPointerLeave={() => setHovered(false)}
- className={cn(
- "group flex items-center gap-2.5 rounded-md p-2 text-sm leading-none text-neutral-600 transition-[background-color,color,font-weight] duration-75 hover:bg-neutral-200/50 active:bg-neutral-200/80",
- "outline-none focus-visible:ring-2 focus-visible:ring-black/50",
- isActive &&
- "bg-blue-100/50 font-medium text-blue-600 hover:bg-blue-100/80 active:bg-blue-100",
+ <div>
+ <Link
+ href={href}
+ data-active={isActive}
+ onPointerEnter={() => setHovered(true)}
+ onPointerLeave={() => setHovered(false)}
+ className={cn(
+ "group flex items-center gap-2.5 rounded-md p-2 text-sm leading-none text-neutral-600 transition-[background-color,color,font-weight] duration-75 hover:bg-neutral-200/50 active:bg-neutral-200/80",
+ "outline-none focus-visible:ring-2 focus-visible:ring-black/50",
+ isActive &&
+ !items &&
+ "bg-blue-100/50 font-medium text-blue-600 hover:bg-blue-100/80 active:bg-blue-100",
+ )}
+ >
+ {Icon && (
+ <Icon
+ className={cn(
+ "size-4 text-neutral-500 transition-colors duration-75",
+ !items && "group-data-[active=true]:text-blue-600",
+ )}
+ data-hovered={hovered}
+ />
+ )}
+ {name}
+ {items && (
+ <div className="flex grow justify-end">
+ <ChevronDown className="size-3.5 text-neutral-500 transition-transform duration-75 group-data-[active=true]:rotate-180" />
+ </div>
+ )}
+ </Link>
+ {items && (
+ <AnimatedSizeContainer
+ height
+ transition={{ duration: 0.2, ease: "easeInOut" }}
+ >
+ <div
+ className={cn(
+ "transition-opacity duration-200",
+ isActive ? "h-auto" : "h-0 opacity-0",
+ )}
+ aria-hidden={!isActive}
+ >
+ <div className="pl-px pt-1">
+ <div className="pl-3.5">
+ <div className="flex flex-col gap-0.5 border-l border-neutral-200 pl-2">
+ {items.map((item) => (
+ <NavItem key={item.name} item={item} />
+ ))}
+ </div>
+ </div>
+ </div>
+ </div>
+ </AnimatedSizeContainer>
)}
- >
- <Icon
- className="size-4 text-neutral-500 transition-colors duration-75 group-data-[active=true]:text-blue-600"
- data-hovered={hovered}
- />
- {name}
- </Link>
+ </div>
);
}