Skip to content

Commit 41eb8fe

Browse files
authored
Merge pull request #777 from hackclub/add-referral-bonus
Add referral link to signpost
2 parents 99204df + 83f1ece commit 41eb8fe

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

src/app/harbor/signpost/referral.tsx

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
'use client'
2+
3+
import { useState, useEffect } from 'react'
4+
5+
import { getSession } from '@/app/utils/auth'
6+
import Pill from '@/components/ui/pill'
7+
import {
8+
Popover,
9+
PopoverTrigger,
10+
PopoverContent,
11+
} from '@/components/ui/popover'
12+
import Icon from '@hackclub/icons'
13+
14+
export default function Referral() {
15+
const [shareLink, setShareLink] = useState<string | null>(null)
16+
const [open, setOpen] = useState(false)
17+
18+
useEffect(() => {
19+
getSession().then((session) => {
20+
if (session) {
21+
setShareLink(`https://highseas.hackclub.com/?ref=${session.slackId}`)
22+
}
23+
})
24+
}, [])
25+
26+
if (!shareLink) return null
27+
28+
return (
29+
<Popover open={open} onOpenChange={setOpen}>
30+
<PopoverTrigger
31+
asChild
32+
onMouseEnter={() => setOpen(true)}
33+
onMouseLeave={() => setOpen(false)}
34+
>
35+
<div className="text-center mb-5">
36+
<a href={shareLink} target="_blank">
37+
<Pill msg="Referral link" color="green" glyph="link" />
38+
</a>
39+
</div>
40+
</PopoverTrigger>
41+
<PopoverContent className="text-sm">
42+
<div>
43+
<p className="inline-flex text-base">Your referral link!</p>
44+
<ul className="flex flex-col gap-1 mt-2">
45+
<li className="flex gap-1">
46+
<Icon glyph="friend" size={20} className="inline flex-shrink-0" />{' '}
47+
Get your friends to sign up at this link!
48+
</li>
49+
<li className="flex gap-1">
50+
<img
51+
sizes="20px"
52+
src="doubloon.svg"
53+
alt="doubloons"
54+
className="w-4 sm:w-5 h-4 sm:h-5"
55+
/>{' '}
56+
Once they ship you'll earn 4 doubloons!
57+
</li>
58+
<li className="flex gap-1">
59+
<span className="w-4 sm:w-5 h-4 sm:h-5">🦈</span>
60+
You'll also be entered into a raffle to win a smolhaj!
61+
</li>
62+
</ul>
63+
</div>
64+
</PopoverContent>
65+
</Popover>
66+
)
67+
}

src/app/harbor/signpost/signpost.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import JaggedCard from '../../../components/jagged-card'
99
import Cookies from 'js-cookie'
1010
import FeedItems from './feed-items'
1111
import { getWakaSessions } from '@/app/utils/waka'
12+
import Referral from './referral'
1213

1314
import pluralize from '../../../../lib/pluralize.js'
1415

@@ -86,6 +87,7 @@ export default function Signpost() {
8687
!
8788
</p>
8889

90+
<Referral />
8991
<Verification />
9092

9193
<div className="text-center mb-2">

0 commit comments

Comments
 (0)