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.

add SpecialNewsContent

Steven Tey8bc80689dea9
diff --git a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
index 5e60a28557..0cf1668036 100644
--- a/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
+++ b/apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
@@ -66,6 +66,7 @@ import { LinesY } from "./icons/lines-y";
import { User } from "./icons/user";
import { SidebarNav, SidebarNavAreas, SidebarNavGroups } from "./sidebar-nav";
import { SidebarUsage } from "./sidebar-usage";
+import { SpecialNewsContent } from "./special-news-content";
import { useProgramApplicationsCount } from "./use-program-applications-count";
import { WorkspaceDropdown } from "./workspace-dropdown";
@@ -679,7 +680,15 @@ export function AppSidebarNav({
{freePlanOrTrial && <SidebarUsage />}
</>
}
- newsContent={!freePlanOrTrial && currentArea === "links" && newsContent}
+ newsContent={
+ currentArea === "program" &&
+ defaultProgramId &&
+ !["enterprise", "advanced"].includes(plan ?? "") ? (
+ <SpecialNewsContent />
+ ) : !freePlanOrTrial && currentArea === "links" ? (
+ newsContent
+ ) : null
+ }
/>
);
}
diff --git a/apps/web/ui/layout/sidebar/news.tsx b/apps/web/ui/layout/sidebar/news.tsx
index 48d90dfe46..05619aa566 100644
--- a/apps/web/ui/layout/sidebar/news.tsx
+++ b/apps/web/ui/layout/sidebar/news.tsx
@@ -41,7 +41,7 @@ export function News({ articles }: { articles: NewsArticle[] }) {
<div
className={cn(
"group overflow-hidden border-t border-neutral-200 p-3 pt-6 transition-all duration-200",
- cardCount > 0 ? "hover:pt-10" : "pt-3",
+ cardCount > 1 ? "hover:pt-10" : "pt-3",
)}
data-active={cardCount !== 0}
>
@@ -274,14 +274,29 @@ function NewsCard({
</div>
<div className="relative mt-3 aspect-[16/9] w-full shrink-0 overflow-hidden rounded border border-neutral-200 bg-neutral-100">
{image && (
- <Image
- src={image}
- alt=""
- fill
- sizes="10vw"
- className="rounded object-cover object-center"
- draggable={false}
- />
+ <Link
+ href={href || "https://dub.co"}
+ target="_blank"
+ className="absolute inset-0"
+ onClick={(e) => {
+ e.stopPropagation();
+ if (
+ drag.current.maxDelta >
+ (ref.current?.clientWidth ?? 0) / 10
+ ) {
+ e.preventDefault();
+ }
+ }}
+ >
+ <Image
+ src={image}
+ alt=""
+ fill
+ sizes="10vw"
+ className="rounded object-cover object-center"
+ draggable={false}
+ />
+ </Link>
)}
</div>
<div
diff --git a/apps/web/ui/layout/sidebar/special-news-content.tsx b/apps/web/ui/layout/sidebar/special-news-content.tsx
new file mode 100644
index 0000000000..0904426394
--- /dev/null
+++ b/apps/web/ui/layout/sidebar/special-news-content.tsx
@@ -0,0 +1,17 @@
+import { News } from "./news";
+
+export function SpecialNewsContent() {
+ return (
+ <News
+ articles={[
+ {
+ href: "https://dub.co/startups",
+ title: "Dub Startup Program 🚀",
+ summary:
+ "50% off our yearly Advanced plan – our biggest discount ever.",
+ image: "https://assets.dub.co/og/startups.jpg",
+ },
+ ]}
+ />
+ );
+}