-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #777 from hackclub/add-referral-bonus
Add referral link to signpost
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,67 @@ | ||
'use client' | ||
|
||
import { useState, useEffect } from 'react' | ||
|
||
import { getSession } from '@/app/utils/auth' | ||
import Pill from '@/components/ui/pill' | ||
import { | ||
Popover, | ||
PopoverTrigger, | ||
PopoverContent, | ||
} from '@/components/ui/popover' | ||
import Icon from '@hackclub/icons' | ||
|
||
export default function Referral() { | ||
const [shareLink, setShareLink] = useState<string | null>(null) | ||
const [open, setOpen] = useState(false) | ||
|
||
useEffect(() => { | ||
getSession().then((session) => { | ||
if (session) { | ||
setShareLink(`https://highseas.hackclub.com/?ref=${session.slackId}`) | ||
} | ||
}) | ||
}, []) | ||
|
||
if (!shareLink) return null | ||
|
||
return ( | ||
<Popover open={open} onOpenChange={setOpen}> | ||
<PopoverTrigger | ||
asChild | ||
onMouseEnter={() => setOpen(true)} | ||
onMouseLeave={() => setOpen(false)} | ||
> | ||
<div className="text-center mb-5"> | ||
<a href={shareLink} target="_blank"> | ||
<Pill msg="Referral link" color="green" glyph="link" /> | ||
</a> | ||
</div> | ||
</PopoverTrigger> | ||
<PopoverContent className="text-sm"> | ||
<div> | ||
<p className="inline-flex text-base">Your referral link!</p> | ||
<ul className="flex flex-col gap-1 mt-2"> | ||
<li className="flex gap-1"> | ||
<Icon glyph="friend" size={20} className="inline flex-shrink-0" />{' '} | ||
Get your friends to sign up at this link! | ||
</li> | ||
<li className="flex gap-1"> | ||
<img | ||
sizes="20px" | ||
src="doubloon.svg" | ||
alt="doubloons" | ||
className="w-4 sm:w-5 h-4 sm:h-5" | ||
/>{' '} | ||
Once they ship you'll earn 4 doubloons! | ||
</li> | ||
<li className="flex gap-1"> | ||
<span className="w-4 sm:w-5 h-4 sm:h-5">🦈</span> | ||
You'll also be entered into a raffle to win a smolhaj! | ||
</li> | ||
</ul> | ||
</div> | ||
</PopoverContent> | ||
</Popover> | ||
) | ||
} |
This file contains 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