11import { getNetworkProgram } from "@/lib/fetchers/get-network-program" ;
22import { ApplicationAnalytics } from "@/ui/application-analytics" ;
3- import { BLOCK_COMPONENTS } from "@/ui/partners/lander/blocks" ;
4- import { LanderHero } from "@/ui/partners/lander/lander-hero" ;
5- import { LanderRewards } from "@/ui/partners/lander/lander-rewards" ;
6- import { ProgramEligibilityCard } from "@/ui/partners/program-eligibility-card" ;
73import {
84 getMarketplaceHref ,
9- getMarketplaceProgramHref ,
5+ getMarketplacePublicApplyHref ,
106} from "@/ui/partners/program-marketplace/get-marketplace-href" ;
11- import { ProgramCategory } from "@/ui/partners/program-marketplace/program-category" ;
12- import { ProgramRewardsDisplay } from "@/ui/partners/program-marketplace/program-rewards-display" ;
13- import { Button , ChevronRight , Shop , Tooltip } from "@dub/ui" ;
14- import { Globe } from "@dub/ui/icons" ;
15- import {
16- OG_AVATAR_URL ,
17- PARTNERS_DOMAIN ,
18- cn ,
19- getDomainWithoutWWW ,
20- } from "@dub/utils" ;
7+ import { MarketplaceProgramBackLink } from "@/ui/partners/program-marketplace/marketplace-program-back-link" ;
8+ import { MarketplaceProgramDetailBody } from "@/ui/partners/program-marketplace/marketplace-program-detail-body" ;
9+ import { MarketplaceProgramDetailsLayout } from "@/ui/partners/program-marketplace/marketplace-program-details-layout" ;
10+ import { MarketplaceProgramHero } from "@/ui/partners/program-marketplace/marketplace-program-hero" ;
11+ import { Button } from "@dub/ui" ;
2112import Link from "next/link" ;
2213import { redirect } from "next/navigation" ;
2314import { MarketplaceExternalShell } from "./marketplace-external-shell" ;
@@ -35,220 +26,31 @@ export async function MarketplaceExternalProgramPage({
3526 redirect ( getMarketplaceHref ( ) ) ;
3627 }
3728
38- const isDarkImage = program . marketplaceHeaderImage ?. includes ( "dark" ) ;
39- const applyHref = `${ PARTNERS_DOMAIN } ${ getMarketplaceProgramHref ( program . slug ) } ` ;
40-
4129 return (
4230 < >
4331 < ApplicationAnalytics />
4432 < MarketplaceExternalShell variant = "none" >
45- < div className = "mx-auto max-w-screen-md" >
46- < div className = "mb-6 flex items-center gap-1.5" >
47- < Link
48- href = { getMarketplaceHref ( ) }
49- className = "bg-bg-subtle hover:bg-bg-emphasis flex size-8 shrink-0 items-center justify-center rounded-lg transition-[transform,background-color] duration-150 active:scale-95"
50- >
51- < Shop className = "text-content-default size-4" />
52- </ Link >
53- < ChevronRight className = "text-content-subtle size-2.5 shrink-0 [&_*]:stroke-2" />
54- < span className = "text-content-emphasis text-lg font-semibold" >
55- { program . name }
56- </ span >
57- </ div >
58-
59- < div className = "mb-6 flex justify-end" >
60- < Link href = { applyHref } >
61- < Button text = "Apply on Dub Partners" className = "h-9 rounded-lg" />
62- </ Link >
63- </ div >
64-
65- < div
66- className = { cn (
67- "relative" ,
68- program . featuredOnMarketplaceAt &&
69- "border-border-subtle overflow-hidden rounded-xl border" ,
70- ) }
71- >
72- { program . featuredOnMarketplaceAt &&
73- program . marketplaceHeaderImage && (
74- < >
75- < img
76- src = { program . marketplaceHeaderImage }
77- alt = { program . name }
78- className = "absolute inset-0 size-full object-cover"
79- />
80- { ! isDarkImage && (
81- < div className = "absolute inset-0 size-full bg-gradient-to-t from-white via-white/75 to-transparent" />
82- ) }
83- </ >
84- ) }
85- < div className = "relative px-4 py-8 sm:px-0" >
86- < img
87- src = { program . logo || `${ OG_AVATAR_URL } ${ program . name } ` }
88- alt = { program . name }
89- className = "size-16 rounded-full border border-white/20"
90- />
91-
92- < div className = "mt-6 flex flex-col" >
93- < span
94- className = { cn (
95- "text-3xl font-semibold" ,
96- isDarkImage && "text-content-inverted" ,
97- ) }
98- >
99- { program . name }
100- </ span >
101-
102- < div
103- className = { cn (
104- "mt-2 flex max-w-md items-center gap-1" ,
105- isDarkImage && "text-content-inverted/90" ,
106- ) }
33+ < MarketplaceProgramDetailsLayout
34+ header = { < MarketplaceProgramBackLink /> }
35+ hero = {
36+ < MarketplaceProgramHero
37+ program = { program }
38+ applySlot = {
39+ < Link
40+ href = { getMarketplacePublicApplyHref ( program . slug ) }
41+ className = "inline-block w-fit"
10742 >
108- { program . description ||
109- `${ program . name } is a program in the Dub Partner Network. Join the network to start partnering with them.` }
110- </ div >
111- </ div >
112-
113- < div className = "mt-6 flex gap-8" >
114- { Boolean ( program . rewards ?. length || program . discount ) && (
115- < div >
116- < span
117- className = { cn (
118- "block text-xs font-medium" ,
119- isDarkImage
120- ? "text-content-inverted"
121- : "text-neutral-400" ,
122- ) }
123- >
124- Rewards
125- </ span >
126- < ProgramRewardsDisplay
127- rewards = { program . rewards }
128- discount = { program . discount }
129- isDarkImage = { isDarkImage }
130- className = "mt-1"
131- descriptionClassName = "max-w-[240px]"
132- />
133- </ div >
134- ) }
135- { Boolean ( program . categories ?. length ) && (
136- < div className = "min-w-0" >
137- < span
138- className = { cn (
139- "block text-xs font-medium" ,
140- isDarkImage
141- ? "text-content-inverted"
142- : "text-neutral-400" ,
143- ) }
144- >
145- Category
146- </ span >
147- < div className = "mt-1 flex items-center gap-1.5" >
148- { program . categories
149- . slice ( 0 , 1 )
150- ?. map ( ( category ) => (
151- < ProgramCategory
152- key = { category }
153- category = { category }
154- className = { cn (
155- isDarkImage && "text-content-inverted" ,
156- ) }
157- />
158- ) ) }
159- { program . categories . length > 1 && (
160- < Tooltip
161- content = {
162- < div className = "flex flex-col gap-0.5 p-2" >
163- { program . categories . slice ( 1 ) . map ( ( category ) => (
164- < ProgramCategory
165- key = { category }
166- category = { category }
167- className = { cn (
168- isDarkImage && "text-content-inverted" ,
169- ) }
170- />
171- ) ) }
172- </ div >
173- }
174- >
175- < div
176- className = { cn (
177- "-ml-1.5 flex size-6 items-center justify-center rounded-md text-xs font-medium" ,
178- isDarkImage && "text-content-inverted/70" ,
179- ) }
180- >
181- +{ program . categories . length - 1 }
182- </ div >
183- </ Tooltip >
184- ) }
185- </ div >
186- </ div >
187- ) }
188- { program . url && (
189- < div className = "min-w-0" >
190- < span className = "block text-xs font-medium text-neutral-400" >
191- Website
192- </ span >
193- < Link
194- href = { program . url }
195- target = "_blank"
196- rel = "noopener noreferrer"
197- className = { cn (
198- "mt-1 flex max-w-[220px] items-center gap-1.5 text-sm font-medium" ,
199- isDarkImage
200- ? "text-content-inverted/90 hover:text-content-inverted"
201- : "text-content-default hover:text-content-emphasis" ,
202- ) }
203- >
204- < Globe className = "size-4 shrink-0" />
205- < span className = "truncate" >
206- { getDomainWithoutWWW ( program . url ) } ↗
207- </ span >
208- </ Link >
209- </ div >
210- ) }
211- </ div >
212- </ div >
213- </ div >
214-
215- < LanderHero
216- program = { program }
217- landerData = { program . landerData || { } }
218- showLabel = { false }
219- className = "mt-8 sm:mt-8"
220- heading = "h2"
221- titleClassName = "text-2xl"
222- />
223-
224- < LanderRewards
225- className = "mt-4"
226- rewards = { program . rewards || [ ] }
227- discount = { program . discount || null }
228- bounties = { program . bounties }
229- />
230-
231- { program . applicationRequirements ?. length ? (
232- < ProgramEligibilityCard
233- requirements = { program . applicationRequirements }
234- />
235- ) : null }
236-
237- { program . landerData && (
238- < div className = "mt-16 grid grid-cols-1 gap-10" >
239- { program . landerData . blocks . map ( ( block , idx ) => {
240- const Component = BLOCK_COMPONENTS [ block . type ] ;
241- return Component ? (
242- < Component
243- key = { idx }
244- block = { block }
245- group = { { logo : program . logo } }
43+ < Button
44+ text = "Apply"
45+ className = "h-10 w-fit rounded-lg px-6 text-sm font-medium"
24646 />
247- ) : null ;
248- } ) }
249- </ div >
250- ) }
251- </ div >
47+ </ Link >
48+ }
49+ />
50+ }
51+ >
52+ < MarketplaceProgramDetailBody program = { program } />
53+ </ MarketplaceProgramDetailsLayout >
25254 </ MarketplaceExternalShell >
25355 </ >
25456 ) ;
0 commit comments