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.

freePlanOrTrial, bottomContent, remove showNews

Steven Teyf8ecc472ad12
diff --git a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
index 52bc38c577..5e60a28557 100644
--- a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
@@ -295,7 +295,6 @@ const NAV_AREAS: SidebarNavAreas<SidebarNavData> = {
// short links
links: ({ slug, pathname, queryString }) => ({
title: "Short Links",
- showNews: true,
direction: "left",
content: [
{
@@ -647,6 +646,9 @@ export function AppSidebarNav({
</Link>
) : null;
+ const freePlanOrTrial =
+ plan && (plan === "free" || isWorkspaceBillingTrialActive(trialEndsAt));
+
return (
<SidebarNav
groups={NAV_GROUPS}
@@ -669,17 +671,15 @@ export function AppSidebarNav({
partnerNetworkEnabled:
program && program.partnerNetworkEnabledAt !== null,
}}
+ switcher={<WorkspaceDropdown />}
toolContent={toolContent}
- newsContent={
- plan &&
- (plan === "free" || isWorkspaceBillingTrialActive(trialEndsAt) ? (
- <SidebarUsage />
- ) : (
- newsContent
- ))
+ bottomContent={
+ <>
+ <div className="px-3 pb-2">{AppBottomContent}</div>
+ {freePlanOrTrial && <SidebarUsage />}
+ </>
}
- switcher={<WorkspaceDropdown />}
- bottom={<div className="px-3 pb-2">{AppBottomContent}</div>}
+ newsContent={!freePlanOrTrial && currentArea === "links" && newsContent}
/>
);
}
diff --git a/apps/web/ui/layout/sidebar/partners-sidebar-nav.tsx b/apps/web/ui/layout/sidebar/partners-sidebar-nav.tsx
index d89a9c2162..6aabfb3ca6 100644
--- a/apps/web/ui/layout/sidebar/partners-sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/partners-sidebar-nav.tsx
@@ -137,7 +137,6 @@ const NAV_AREAS: SidebarNavAreas<SidebarNavData> = {
title: <PartnerProgramDropdown />,
content: PROGRAMS_CONTENT({ invitationsCount }),
direction: "left",
- showNews: true,
}),
marketplace: ({ isMobile, invitationsCount }) => ({
@@ -428,8 +427,7 @@ export function PartnersSidebarNav({
newsContent,
}}
toolContent={composedToolContent}
- newsContent={newsContent}
- bottom={
+ bottomContent={
isEnrolledProgramPage ? (
<ProgramHelpSupport />
) : (
diff --git a/apps/web/ui/layout/sidebar/sidebar-nav.tsx b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
index b761d71a1a..46e48c12a8 100644
--- a/apps/web/ui/layout/sidebar/sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/sidebar-nav.tsx
@@ -67,7 +67,6 @@ export type SidebarNavAreas<T extends Record<any, any>> = Record<
(args: T) => {
title?: string | ReactNode;
backHref?: string;
- showNews?: boolean; // show news segment – TODO: enable this for Partner Program too
hideSwitcherIcons?: boolean; // hide workspace switcher + product icons for this area
direction?: "left" | "right";
// can either be a list of items, or a ReactNode
@@ -89,19 +88,19 @@ export function SidebarNav<T extends Record<any, any>>({
areas,
currentArea,
data,
+ switcher,
toolContent,
+ bottomContent,
newsContent,
- switcher,
- bottom,
}: {
groups: SidebarNavGroups<T>;
areas: SidebarNavAreas<T>;
currentArea: string | null;
data: T;
+ switcher?: ReactNode;
toolContent?: ReactNode;
+ bottomContent?: ReactNode;
newsContent?: ReactNode;
- switcher?: ReactNode;
- bottom?: ReactNode;
}) {
return (
<div
@@ -156,7 +155,7 @@ export function SidebarNav<T extends Record<any, any>>({
data={data}
currentArea={currentArea}
newsContent={newsContent}
- bottom={bottom}
+ bottomContent={bottomContent}
/>
</div>
</nav>
@@ -170,17 +169,16 @@ function SidebarAreasPanel<T extends Record<any, any>>({
data,
currentArea,
newsContent,
- bottom,
+ bottomContent,
}: {
areas: SidebarNavAreas<T>;
data: T;
currentArea: string | null;
newsContent?: ReactNode;
- bottom?: ReactNode;
+ bottomContent?: ReactNode;
}) {
const scrollRef = useRef<HTMLDivElement>(null);
const { scrollProgress, updateScrollProgress } = useScrollProgress(scrollRef);
- const showNews = currentArea && areas[currentArea]?.(data).showNews;
return (
<div className="flex h-full w-[calc(var(--sidebar-areas-width)-0.5rem)] flex-col rounded-xl bg-neutral-100">
@@ -264,8 +262,8 @@ function SidebarAreasPanel<T extends Record<any, any>>({
height
className="flex flex-shrink-0 flex-col gap-2 rounded-b-xl"
>
- {bottom}
- {showNews && newsContent}
+ {bottomContent}
+ {newsContent}
</AnimatedSizeContainer>
</div>
);