-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add external program marketplace #4053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
600d69c
Add external program marketplace on dub.co and app.dub.co.
pepeladeira 6babeb7
server-render external marketplace list + consolidate program count l…
pepeladeira 01ba251
external marketplace ssr improvements
pepeladeira 611af52
srr improvements
pepeladeira 1b44926
ssr improvements
pepeladeira 24bfca3
fix build error
pepeladeira 493d088
update get-public-network-programs
pepeladeira 73c969e
missed a few spots
steven-tey 469af77
fix more missed issues
steven-tey ce5007e
fix merge conflicts
steven-tey c3768ff
skip auth redirect
steven-tey 05b439a
Update middleware.ts
steven-tey 4f6a220
small improvements
steven-tey 6e4440e
redirect to marketplace page
steven-tey cc5d872
default exports: generateStaticParams, revalidate
steven-tey 8e9c962
fix getMarketplaceProgramsSummary
steven-tey bd9cf5c
simplify marketplace url utils
steven-tey 9d10da3
Merge branch 'main' into external-program-marketplace
steven-tey 75d28fa
remove console log
steven-tey 21fa6ac
Merge branch 'main' into external-program-marketplace
pepeladeira 1f00a68
Merge branch 'main' into external-program-marketplace
steven-tey c70e311
Merge branch 'main' into external-program-marketplace
steven-tey f7b5caa
Merge branch 'main' into external-program-marketplace
steven-tey 531c652
fix app redirects
steven-tey ed6bcbe
Merge branch 'main' into external-program-marketplace
steven-tey 9decc83
Merge branch 'main' into external-program-marketplace
steven-tey 5c172c7
fix nav
steven-tey 2a68dcc
Merge branch 'main' into external-program-marketplace
steven-tey 56c1b1a
Merge branch 'main' into external-program-marketplace
steven-tey de4c244
finalize copy
steven-tey 243873c
sitemap
pepeladeira 0c3bf9b
update OG images
steven-tey 4c80195
Merge branch 'main' into external-program-marketplace
steven-tey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
apps/web/app/(ee)/api/marketplace/programs/counts/route.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { getNetworkProgramCounts } from "@/lib/fetchers/get-network-program-counts"; | ||
| import { parsePublicMarketplaceQuery } from "@/lib/marketplace/parse-public-marketplace-query"; | ||
| import { NextResponse } from "next/server"; | ||
|
|
||
| // cache filtered/searched count responses at the edge (public, not partner-scoped) | ||
| export const revalidate = 3600; | ||
|
|
||
| // GET /api/marketplace/programs/counts - public marketplace total + filter counts | ||
| export async function GET(req: Request) { | ||
| const searchParams = Object.fromEntries(new URL(req.url).searchParams); | ||
| const { category, rewardType, search } = | ||
| parsePublicMarketplaceQuery(searchParams); | ||
|
|
||
| const counts = await getNetworkProgramCounts({ | ||
| category, | ||
| rewardType, | ||
| search, | ||
| }); | ||
|
|
||
| return NextResponse.json(counts); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { getPublicNetworkPrograms } from "@/lib/fetchers/get-public-network-programs"; | ||
| import { parsePublicMarketplaceQuery } from "@/lib/marketplace/parse-public-marketplace-query"; | ||
| import { NextResponse } from "next/server"; | ||
|
|
||
| // cache filtered/searched list responses at the edge (public, not partner-scoped) | ||
| export const revalidate = 3600; | ||
|
|
||
| // GET /api/marketplace/programs - public marketplace program list | ||
| export async function GET(req: Request) { | ||
| const searchParams = Object.fromEntries(new URL(req.url).searchParams); | ||
| const params = parsePublicMarketplaceQuery(searchParams); | ||
|
|
||
| const programs = await getPublicNetworkPrograms(params); | ||
|
|
||
| return NextResponse.json(programs); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
apps/web/app/(ee)/partners.dub.co/(dashboard)/marketplace/[[...segments]]/page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| import { PROGRAM_CATEGORIES } from "@/lib/network/program-categories"; | ||
| import { DUB_WORDMARK } from "@dub/utils"; | ||
| import { ImageResponse } from "next/og"; | ||
| import { NextRequest } from "next/server"; | ||
| import { loadGoogleFont } from "../../load-google-font"; | ||
|
|
||
| const DARK_CELLS = [ | ||
| [2, 3], | ||
| [5, 3], | ||
| [56, 7], | ||
| [53, 1], | ||
| ]; | ||
|
|
||
| // GET /api/og/program/categories?categorySlug=ai | ||
| export async function GET(req: NextRequest) { | ||
| const categorySlug = req.nextUrl.searchParams.get("categorySlug"); | ||
|
|
||
| if (!categorySlug) { | ||
| return new Response("Missing 'categorySlug' parameter", { | ||
| status: 400, | ||
| }); | ||
| } | ||
|
|
||
| const category = PROGRAM_CATEGORIES.find( | ||
| ({ id }) => id.toLowerCase() === categorySlug.toLowerCase(), | ||
| ); | ||
|
|
||
| if (!category) { | ||
| return new Response("Category not found", { | ||
| status: 404, | ||
| }); | ||
| } | ||
|
|
||
| const interSemibold = await loadGoogleFont("Inter:wght@600"); | ||
|
|
||
| return new ImageResponse( | ||
| ( | ||
| <div | ||
| tw="flex flex-col bg-white w-full h-full" | ||
| style={{ fontFamily: "Inter" }} | ||
| > | ||
| {/* @ts-ignore */} | ||
| <svg tw="absolute inset-0 text-black/10" width="1200" height="630"> | ||
| <defs> | ||
| <pattern | ||
| id="grid" | ||
| width={20} | ||
| height={20} | ||
| patternUnits="userSpaceOnUse" | ||
| > | ||
| <path | ||
| d={`M 20 0 L 0 0 0 20`} | ||
| fill="transparent" | ||
| stroke="currentColor" | ||
| strokeWidth={1} | ||
| /> | ||
| </pattern> | ||
| <pattern | ||
| id="grid-large" | ||
| width={160} | ||
| height={160} | ||
| patternUnits="userSpaceOnUse" | ||
| > | ||
| <path | ||
| d={`M 160 0 L 0 0 0 160`} | ||
| fill="transparent" | ||
| stroke="currentColor" | ||
| strokeOpacity={0.5} | ||
| strokeWidth={1} | ||
| /> | ||
| </pattern> | ||
| <linearGradient id="gradient" x1="0" y1="0" x2="0" y2="1"> | ||
| <stop offset="0%" stopColor="#fff" stopOpacity={0} /> | ||
| <stop offset="100%" stopColor="#fff" stopOpacity={1} /> | ||
| </linearGradient> | ||
| </defs> | ||
| {DARK_CELLS.map(([x, y]) => ( | ||
| <rect | ||
| key={`${x}-${y}`} | ||
| x={x * 20 + 1} | ||
| y={y * 20 + 1} | ||
| width={19} | ||
| height={19} | ||
| fill="black" | ||
| fillOpacity={0.02} | ||
| /> | ||
| ))} | ||
| <rect fill="url(#grid)" width="1200" height="630" /> | ||
| <rect fill="url(#grid-large)" width="1200" height="630" /> | ||
| <rect fill="url(#gradient)" width="1200" height="630" /> | ||
| </svg> | ||
|
|
||
| <div tw="relative flex flex-col mx-auto h-full bg-white w-[920px] px-16 py-20 overflow-hidden"> | ||
| <div tw="flex items-center"> | ||
| <img src={DUB_WORDMARK} height={56} /> | ||
| <div tw="ml-4 h-10 w-px bg-neutral-300" /> | ||
| <div tw="ml-4 text-left uppercase text-2xl text-neutral-500"> | ||
| Program Marketplace | ||
| </div> | ||
| </div> | ||
| <div | ||
| tw="mt-32 text-5xl font-semibold text-neutral-800" | ||
| style={{ | ||
| display: "block", | ||
| lineClamp: 2, | ||
| textOverflow: "ellipsis", | ||
| fontFamily: "Inter", | ||
| }} | ||
| > | ||
| {`${category.label} Affiliate Programs`} | ||
| </div> | ||
| <div tw="mt-10 flex"> | ||
| <div | ||
| tw="w-full flex items-center rounded-md bg-neutral-100 border border-neutral-200 p-10 text-3xl" | ||
| style={{ | ||
| display: "block", | ||
| lineClamp: 3, | ||
| textOverflow: "ellipsis", | ||
| }} | ||
| > | ||
| {category.listPageDescription} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ), | ||
| { | ||
| width: 1200, | ||
| height: 630, | ||
| fonts: interSemibold | ||
| ? [ | ||
| { | ||
| name: "Inter", | ||
| data: interSemibold, | ||
| style: "normal", | ||
| weight: 600, | ||
| }, | ||
| ] | ||
| : [], | ||
| }, | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.