@@ -6,7 +6,7 @@ import { CalendarDays, Gift, History, Info, Sparkles } from 'lucide-react';
66
77import { Alert , AlertDescription , AlertTitle } from '@/components/ui/alert' ;
88import { Button } from '@/components/ui/button' ;
9- import { Card , CardContent , CardDescription , CardHeader , CardTitle } from '@/components/ui/card' ;
9+ import { Card , CardContent } from '@/components/ui/card' ;
1010import { Tooltip , TooltipContent , TooltipTrigger } from '@/components/ui/tooltip' ;
1111import { formatIsoDateString_UsaDateOnlyFormat } from '@/lib/utils' ;
1212
@@ -138,7 +138,7 @@ export function KiloPassReferralPageContent({
138138 < div className = "space-y-2" >
139139 < h1 className = "text-3xl font-bold tracking-tight" > Earn Kilo Pass referral bonuses</ h1 >
140140 < p className = "max-w-3xl text-sm leading-6 text-muted-foreground" >
141- Share Kilo Pass with another developer. When their first eligible monthly payment is
141+ Share Kilo Pass with someone else and when their first eligible monthly payment is
142142 confirmed, you both earn a 50% monthly Kilo Pass bonus based on their tier.
143143 </ p >
144144 </ div >
@@ -149,30 +149,10 @@ export function KiloPassReferralPageContent({
149149 </ div >
150150
151151 < Card >
152- < CardHeader >
153- < CardTitle > How rewards apply</ CardTitle >
154- < CardDescription >
155- One pending referral reward is consumed per eligible monthly base issuance. Referral
156- bonus credits replace the normal monthly bonus for that issuance, and unused bonus
157- credits expire at month end.
158- </ CardDescription >
159- </ CardHeader >
160- </ Card >
161-
162- < Card >
163- < CardHeader >
164- < CardTitle id = "kilo-pass-referral-widget-heading" className = "flex items-center gap-2" >
165- < Sparkles className = "size-4" aria-hidden = "true" />
166- Share your Kilo Pass referral link
167- </ CardTitle >
168- < CardDescription >
169- Use the Kilo Pass referral widget to copy your link and track Impact Advocate sharing.
170- </ CardDescription >
171- </ CardHeader >
172- < CardContent >
152+ < CardContent className = "space-y-6 p-6" >
173153 < section
174154 id = { SHARE_WIDGET_ANCHOR_ID }
175- aria-labelledby = "kilo-pass- referral-widget-heading "
155+ aria-label = "Kilo Pass referral sharing "
176156 className = "rounded-lg border border-border bg-input/30 p-4"
177157 >
178158 { shareWidget ?? (
@@ -181,100 +161,107 @@ export function KiloPassReferralPageContent({
181161 </ div >
182162 ) }
183163 </ section >
164+
165+ { isLoading ? (
166+ < div
167+ className = "border-t border-border pt-6 text-sm text-muted-foreground"
168+ role = "status"
169+ >
170+ Loading Kilo Pass referral rewards…
171+ </ div >
172+ ) : errorMessage ? (
173+ < div className = "border-t border-border pt-6" >
174+ < Alert variant = "destructive" role = "alert" >
175+ < AlertTitle > Kilo Pass referral rewards are unavailable</ AlertTitle >
176+ < AlertDescription > { errorMessage || 'Try again in a minute.' } </ AlertDescription >
177+ </ Alert >
178+ </ div >
179+ ) : summary ? (
180+ < KiloPassReferralSummary summary = { summary } />
181+ ) : null }
184182 </ CardContent >
185183 </ Card >
186-
187- { isLoading ? (
188- < Card >
189- < CardContent className = "p-6 text-sm text-muted-foreground" role = "status" >
190- Loading Kilo Pass referral rewards…
191- </ CardContent >
192- </ Card >
193- ) : errorMessage ? (
194- < Alert variant = "destructive" role = "alert" >
195- < AlertTitle > Kilo Pass referral rewards are unavailable</ AlertTitle >
196- < AlertDescription > { errorMessage || 'Try again in a minute.' } </ AlertDescription >
197- </ Alert >
198- ) : summary ? (
199- < KiloPassReferralSummary summary = { summary } />
200- ) : null }
201184 </ div >
202185 ) ;
203186}
204187
205188function KiloPassReferralSummary ( { summary } : { summary : KiloPassReferralRewardSummary } ) {
206189 return (
207- < Card >
208- < CardHeader >
209- < CardTitle > Reward summary</ CardTitle >
210- < CardDescription >
190+ < section
191+ aria-labelledby = "kilo-pass-referral-summary-heading"
192+ className = "space-y-6 border-t border-border pt-6"
193+ >
194+ < div className = "space-y-1.5" >
195+ < h2 id = "kilo-pass-referral-summary-heading" className = "font-semibold tracking-tight" >
196+ Reward summary
197+ </ h2 >
198+ < p className = "text-sm text-muted-foreground" >
211199 Track pending referral bonuses and previous Kilo Pass referral reward history.
212- </ CardDescription >
213- </ CardHeader >
214- < CardContent className = "space-y-6" >
215- { summary . referrerCap . reached ? (
216- < div className = "flex flex-col gap-2 rounded-lg border border-yellow-500/20 bg-yellow-500/10 p-3 text-sm sm:flex-row sm:items-center sm:justify-between" >
217- < div >
218- < div className = "font-medium text-yellow-400" > Cap reached</ div >
219- < div className = "text-muted-foreground" >
220- { summary . referrerCap . grantedRewards } of { summary . referrerCap . limit } referrer rewards
221- granted. Referee rewards do not count toward this cap.
222- </ div >
200+ </ p >
201+ </ div >
202+
203+ { summary . referrerCap . reached ? (
204+ < div className = "flex flex-col gap-2 rounded-lg border border-yellow-500/20 bg-yellow-500/10 p-3 text-sm sm:flex-row sm:items-center sm:justify-between" >
205+ < div >
206+ < div className = "font-medium text-yellow-400" > Cap reached</ div >
207+ < div className = "text-muted-foreground" >
208+ { summary . referrerCap . grantedRewards } of { summary . referrerCap . limit } referrer rewards
209+ granted. Referee rewards do not count toward this cap.
223210 </ div >
224211 </ div >
225- ) : null }
226-
227- < div className = "grid gap-3 md:grid-cols-3" >
228- < SummaryTile label = "Total rewards" value = { String ( summary . totals . totalRewards ) } />
229- < SummaryTile
230- label = "Pending rewards"
231- value = { String ( summary . totals . pendingRewards ) }
232- info = "Pending rewards wait for a future eligible monthly Kilo Pass issuance."
233- indicator = { summary . totals . pendingRewards > 0 ? 'warning' : undefined }
234- />
235- < SummaryTile label = "Applied rewards" value = { String ( summary . totals . appliedRewards ) } />
236- < SummaryTile
237- label = "Total bonus value"
238- value = { formatUsd ( summary . totals . totalRewardAmountUsd ) }
239- />
240- < SummaryTile
241- label = "Pending bonus value"
242- value = { formatUsd ( summary . totals . pendingRewardAmountUsd ) }
243- />
244- < SummaryTile
245- label = "Applied bonus value"
246- value = { formatUsd ( summary . totals . appliedRewardAmountUsd ) }
247- />
248212 </ div >
213+ ) : null }
249214
250- < section aria-labelledby = "kilo-pass-rewards-heading" className = "space-y-3" >
251- < h2 id = "kilo-pass-rewards-heading" className = "text-sm font-semibold text-foreground" >
252- Reward history
253- </ h2 >
254- { summary . rewards . length === 0 ? (
255- < div className = "rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground" >
256- No Kilo Pass referral rewards yet.{ ' ' }
257- < a
258- href = { `#${ SHARE_WIDGET_ANCHOR_ID } ` }
259- className = "rounded-sm text-foreground underline decoration-foreground/35 underline-offset-2 hover:decoration-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
260- >
261- Share your referral link
262- </ a > { ' ' }
263- to earn a future monthly bonus.
264- </ div >
265- ) : (
266- < div className = "divide-y divide-border rounded-lg border border-border" >
267- { summary . rewards . map ( ( reward , index ) => (
268- < RewardRow
269- key = { `${ reward . role } -${ reward . status } -${ reward . earnedAt } -${ index } ` }
270- reward = { reward }
271- />
272- ) ) }
273- </ div >
274- ) }
275- </ section >
276- </ CardContent >
277- </ Card >
215+ < div className = "grid gap-3 md:grid-cols-3" >
216+ < SummaryTile label = "Total rewards" value = { String ( summary . totals . totalRewards ) } />
217+ < SummaryTile
218+ label = "Pending rewards"
219+ value = { String ( summary . totals . pendingRewards ) }
220+ info = "Pending rewards wait for a future eligible monthly Kilo Pass issuance."
221+ indicator = { summary . totals . pendingRewards > 0 ? 'warning' : undefined }
222+ />
223+ < SummaryTile label = "Applied rewards" value = { String ( summary . totals . appliedRewards ) } />
224+ < SummaryTile
225+ label = "Total bonus value"
226+ value = { formatUsd ( summary . totals . totalRewardAmountUsd ) }
227+ />
228+ < SummaryTile
229+ label = "Pending bonus value"
230+ value = { formatUsd ( summary . totals . pendingRewardAmountUsd ) }
231+ />
232+ < SummaryTile
233+ label = "Applied bonus value"
234+ value = { formatUsd ( summary . totals . appliedRewardAmountUsd ) }
235+ />
236+ </ div >
237+
238+ < section aria-labelledby = "kilo-pass-rewards-heading" className = "space-y-3" >
239+ < h3 id = "kilo-pass-rewards-heading" className = "text-sm font-semibold text-foreground" >
240+ Reward history
241+ </ h3 >
242+ { summary . rewards . length === 0 ? (
243+ < div className = "rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground" >
244+ No Kilo Pass referral rewards yet.{ ' ' }
245+ < a
246+ href = { `#${ SHARE_WIDGET_ANCHOR_ID } ` }
247+ className = "rounded-sm text-foreground underline decoration-foreground/35 underline-offset-2 hover:decoration-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
248+ >
249+ Share your referral link
250+ </ a > { ' ' }
251+ to earn a future monthly bonus.
252+ </ div >
253+ ) : (
254+ < div className = "divide-y divide-border rounded-lg border border-border" >
255+ { summary . rewards . map ( ( reward , index ) => (
256+ < RewardRow
257+ key = { `${ reward . role } -${ reward . status } -${ reward . earnedAt } -${ index } ` }
258+ reward = { reward }
259+ />
260+ ) ) }
261+ </ div >
262+ ) }
263+ </ section >
264+ </ section >
278265 ) ;
279266}
280267
0 commit comments