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.

rename, fix a few styles

Steven Teyf36e0f7bd30f
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/[programSlug]/page.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/[programSlug]/page.tsx
index 582d4030ed..7a2d7e4641 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/[programSlug]/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/[programSlug]/page.tsx
@@ -4,8 +4,8 @@ import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
import { BLOCK_COMPONENTS } from "@/ui/partners/lander/blocks";
import { LanderHero } from "@/ui/partners/lander/lander-hero";
import { LanderRewards } from "@/ui/partners/lander/lander-rewards";
-import { ProgramCategory } from "@/ui/partners/program-network/program-category";
-import { ProgramRewardsDisplay } from "@/ui/partners/program-network/program-rewards-display";
+import { ProgramCategory } from "@/ui/partners/program-marketplace/program-category";
+import { ProgramRewardsDisplay } from "@/ui/partners/program-marketplace/program-rewards-display";
import { ChevronRight, Shop, Tooltip } from "@dub/ui";
import { OG_AVATAR_URL, cn } from "@dub/utils";
import Link from "next/link";
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-program-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-program-card.tsx
index be6251da20..fa2863825f 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-program-card.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/featured-program-card.tsx
@@ -1,6 +1,6 @@
import { NetworkProgramProps } from "@/lib/types";
-import { ProgramCategory } from "@/ui/partners/program-network/program-category";
-import { ProgramRewardsDisplay } from "@/ui/partners/program-network/program-rewards-display";
+import { ProgramCategory } from "@/ui/partners/program-marketplace/program-category";
+import { ProgramRewardsDisplay } from "@/ui/partners/program-marketplace/program-rewards-display";
import { Tooltip, useClickHandlers, useRouterStuff } from "@dub/ui";
import { OG_AVATAR_URL, cn } from "@dub/utils";
import { useRouter } from "next/navigation";
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
index 1f56235ca7..cab8be5c1c 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/marketplace/program-card.tsx
@@ -1,6 +1,6 @@
import { NetworkProgramProps } from "@/lib/types";
-import { ProgramCategory } from "@/ui/partners/program-network/program-category";
-import { ProgramRewardsDisplay } from "@/ui/partners/program-network/program-rewards-display";
+import { ProgramCategory } from "@/ui/partners/program-marketplace/program-category";
+import { ProgramRewardsDisplay } from "@/ui/partners/program-marketplace/program-rewards-display";
import { Tooltip, useClickHandlers, useRouterStuff } from "@dub/ui";
import { OG_AVATAR_URL, cn } from "@dub/utils";
import { useRouter } from "next/navigation";
diff --git a/apps/web/scripts/migrations/backfill-program-marketplace.ts b/apps/web/scripts/migrations/backfill-program-marketplace.ts
new file mode 100644
index 0000000000..ea641183b6
--- /dev/null
+++ b/apps/web/scripts/migrations/backfill-program-marketplace.ts
@@ -0,0 +1,77 @@
+import { DEFAULT_PARTNER_GROUP } from "@/lib/zod/schemas/groups";
+import { prisma } from "@dub/prisma";
+import FireCrawlApp from "@mendable/firecrawl-js";
+import "dotenv-flow/config";
+
+if (!process.env.FIRECRAWL_API_KEY)
+ throw new Error("FIRECRAWL_API_KEY is not set");
+
+// Initialize FireCrawl
+const firecrawl = new FireCrawlApp({
+ apiKey: process.env.FIRECRAWL_API_KEY,
+});
+
+// Function to scrape website content
+async function scrapeWebsite(url: string) {
+ try {
+ const scrapeResult = await firecrawl.scrapeUrl(url, {
+ formats: ["markdown"],
+ onlyMainContent: true,
+ parsePDF: false,
+ maxAge: 14400000, // 4 hours cache
+ excludeTags: ["img"],
+ });
+
+ if (!scrapeResult.success) {
+ throw new Error(scrapeResult.error || "Failed to scrape");
+ }
+
+ return {
+ content: scrapeResult.markdown || "",
+ title: scrapeResult.metadata?.title || "",
+ description: scrapeResult.metadata?.description || "",
+ };
+ } catch (error) {
+ console.error(`Error scraping ${url}:`, error);
+ return null;
+ }
+}
+
+async function main() {
+ const programToAdd = await prisma.program.findUniqueOrThrow({
+ where: {
+ slug: "",
+ groups: {
+ some: {
+ slug: DEFAULT_PARTNER_GROUP.slug,
+ applicationFormPublishedAt: {
+ not: null,
+ },
+ },
+ },
+ },
+ });
+ console.table(programToAdd, ["id", "name", "slug", "url"]);
+
+ if (!programToAdd.url) {
+ throw new Error("Program URL is not set");
+ }
+
+ const scraped = await scrapeWebsite(programToAdd.url);
+
+ const res = await prisma.program.update({
+ where: {
+ id: programToAdd.id,
+ },
+ data: {
+ addedToMarketplaceAt: new Date(),
+ description: scraped?.description || null,
+ },
+ });
+
+ console.log(
+ `Added ${res.name} to the marketplace with description: ${res.description}`,
+ );
+}
+
+main();
diff --git a/apps/web/ui/partners/program-network/program-category.tsx b/apps/web/ui/partners/program-marketplace/program-category.tsx
similarity index 88%
rename from apps/web/ui/partners/program-network/program-category.tsx
rename to apps/web/ui/partners/program-marketplace/program-category.tsx
index 8709648cb2..a82b53c0b4 100644
--- a/apps/web/ui/partners/program-network/program-category.tsx
+++ b/apps/web/ui/partners/program-marketplace/program-category.tsx
@@ -30,9 +30,7 @@ export const ProgramCategory = ({
)}
>
<Icon className="size-4" />
- <span className="text-content-subtle min-w-0 truncate text-sm font-medium">
- {label}
- </span>
+ <span className="min-w-0 truncate text-sm font-medium">{label}</span>
</As>
);
};
diff --git a/apps/web/ui/partners/program-network/program-reward-icon.tsx b/apps/web/ui/partners/program-marketplace/program-reward-icon.tsx
similarity index 100%
rename from apps/web/ui/partners/program-network/program-reward-icon.tsx
rename to apps/web/ui/partners/program-marketplace/program-reward-icon.tsx
diff --git a/apps/web/ui/partners/program-network/program-rewards-display.tsx b/apps/web/ui/partners/program-marketplace/program-rewards-display.tsx
similarity index 96%
rename from apps/web/ui/partners/program-network/program-rewards-display.tsx
rename to apps/web/ui/partners/program-marketplace/program-rewards-display.tsx
index 9196facf61..f02c7edcdc 100644
--- a/apps/web/ui/partners/program-network/program-rewards-display.tsx
+++ b/apps/web/ui/partners/program-marketplace/program-rewards-display.tsx
@@ -83,7 +83,7 @@ export function ProgramRewardsDisplay({
<As
{...(item.onClick && { type: "button", onClick: item.onClick })}
className={cn(
- "-ml-1 flex items-center gap-1",
+ "-ml-1 flex items-center gap-1 pr-1",
item.onClick &&
"hover:bg-bg-subtle active:bg-bg-emphasis rounded-md transition-colors",
className,
@@ -99,7 +99,7 @@ export function ProgramRewardsDisplay({
</div>
<span
className={cn(
- "text-content-subtle max-w-[160px] truncate text-sm font-medium",
+ "text-content-default max-w-[160px] truncate text-sm font-medium",
isDarkImage && "text-content-inverted",
descriptionClassName,
)}