From f759eda4d299d2360712b399d284198f45db58db Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Thu, 3 Oct 2024 22:36:46 +0100 Subject: [PATCH] Update invite friends UI --- .../AccountStreak/InviteFriends.tsx | 120 ++++++++---------- 1 file changed, 50 insertions(+), 70 deletions(-) diff --git a/src/components/AccountStreak/InviteFriends.tsx b/src/components/AccountStreak/InviteFriends.tsx index 1cbcd7128..ff3885818 100644 --- a/src/components/AccountStreak/InviteFriends.tsx +++ b/src/components/AccountStreak/InviteFriends.tsx @@ -3,6 +3,7 @@ import { useAuth } from '../../hooks/use-auth'; import { useCopyText } from '../../hooks/use-copy-text'; import { cn } from '../../lib/classname'; import { CheckIcon } from '../ReactIcons/CheckIcon'; +import {TrophyEmoji} from "../ReactIcons/TrophyEmoji.tsx"; type InviteFriendsProps = { refByUserCount: number; @@ -19,84 +20,63 @@ export function InviteFriends(props: InviteFriendsProps) { import.meta.env.DEV ? 'http://localhost:3000' : 'https://roadmap.sh', ).toString(); - if (refByUserCount === 1) { - return ( -
-

Invite 5 Friends to roadmap.sh

-
-
- - - - - -
-

2 of 5 friends invited

-
-

- Share{' '} - to - invite your friends. -

-
- ); - } - return ( -
-
- -

Invite Friends

-

- Invite your friends to join roadmap.sh +

+

+ Invite people to join roadmap.sh

+
+
+ {Array.from({ length: 10 }).map((_, index) => ( + + ))} +
+ {refByUserCount === 0 && ( +

You haven't invited anyone yet.

+ )} -
- { - e.currentTarget.select(); - copyText(referralLink); - }} - readOnly - /> + {refByUserCount > 0 && refByUserCount < 10 && ( +

{refByUserCount} of 10 users joined

+ )} + + {refByUserCount >= 10 && ( +

+ 🎉 You've invited {refByUserCount} users +

+ )} +
+

+ Share{' '} -

- -

- {refByUserCount > 0 && ( - <> - 🥳 You have invited{' '} - - {refByUserCount} user{refByUserCount > 1 ? 's' : ''} so far - - - )} - {refByUserCount === 0 && <>🤔 You haven't invited anyone yet} + {isCopied && ( + + )} + {' '} + with anyone you think would benefit from roadmap.sh

@@ -104,7 +84,7 @@ export function InviteFriends(props: InviteFriendsProps) { href="/leaderboard" className="text-purple-400 underline-offset-2 hover:underline" > - See how you compare to others + See how you rank on the leaderboard