Skip to content

Commit 000ac5c

Browse files
committed
UPDATES: ambassador DAO components and configuration
- Refactored the ambassador DAO components for improved readability and consistency. - Updated the Next.js configuration to streamline server external packages and image remote patterns. - Enhanced the user interface by adjusting styles and structure in various components. - Removed unnecessary console logs and improved error handling in API requests. - Added new onboarding options for users without roles in the AuthButton component. These changes enhance the overall functionality and user experience of the ambassador DAO.
1 parent 088cc16 commit 000ac5c

File tree

11 files changed

+323
-222
lines changed

11 files changed

+323
-222
lines changed

app/(home)/ambassador-dao/onboard/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ const TalentForm = () => {
336336
},
337337
{
338338
onSuccess: () => {
339-
console.log("success");
340339
if (isEditProfilePage) {
341340
return;
342341
} else {

app/(home)/ambassador-dao/page.tsx

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,97 +5,107 @@ import { Suspense } from "react";
55
import Team1 from "@/public/ambassador-dao-images/Avalanche-team1.png";
66
import Team1Logo from "@/public/ambassador-dao-images/team1.svg";
77

8-
import React from "react";
8+
import React, { useState } from "react";
99

1010
import MainContent from "@/components/ambassador-dao/dashboard/MainContent";
1111
import { useFetchUserDataQuery } from "@/services/ambassador-dao/requests/auth";
1212
import FullScreenLoader from "@/components/ambassador-dao/full-screen-loader";
1313
import { AmbassadorCard } from "@/components/ambassador-dao/dashboard/SideContent";
14+
import { AuthModal } from "@/components/ambassador-dao/sections/auth-modal";
1415

1516
const WelcomeSection = ({ user }: { user: any }) => {
1617
return (
17-
<div className="relative bg-welcome overflow-hidden backdrop-blur-[200px] h-full max-h-[340px] sm:max-h-[256px] py-16">
18-
<div className="max-w-7xl mx-auto my-auto px-4 sm:px-6 lg:px-8 flex flex-col sm:flex-row sm:justify-between sm:items-center">
19-
<div className="relative z-10">
18+
<div className='relative bg-welcome overflow-hidden backdrop-blur-[200px] h-full max-h-[340px] sm:max-h-[256px] py-16'>
19+
<div className='max-w-7xl mx-auto my-auto px-4 sm:px-6 lg:px-8 flex flex-col sm:flex-row sm:justify-between sm:items-center'>
20+
<div className='relative z-10'>
2021
{user && (
2122
<>
22-
<h1 className="text-2xl sm:text-4xl font-normal text-[var(--white-text-color)] mb-2">
23+
<h1 className='text-2xl sm:text-4xl font-normal text-[var(--white-text-color)] mb-2'>
2324
Welcome back, {user?.first_name}
2425
</h1>
25-
<p className="text-md sm:text-xl text-[var(--secondary-text-color)]">
26+
<p className='text-md sm:text-xl text-[var(--secondary-text-color)]'>
2627
We're so glad to have you on Team 1
2728
</p>
2829
</>
2930
)}
3031

3132
{!user && (
3233
<>
33-
<h1 className="text-2xl sm:text-4xl text-[var(--white-text-color)] mb-2">
34+
<h1 className='text-2xl sm:text-4xl text-[var(--white-text-color)] mb-2'>
3435
Welcome to Team 1
3536
</h1>
36-
<p className="text-md sm:text-xl text-[var(--secondary-text-color)]">
37+
<p className='text-md sm:text-xl text-[var(--secondary-text-color)]'>
3738
Where talent connects with opportunity in the Avalanche
3839
ecosystem
3940
</p>
4041
</>
4142
)}
4243
</div>
43-
44-
<div className="flex mt-4 sm:mt-0 items-end justify-end">
45-
<div className="hidden dark:block">
46-
<Image
47-
src={Team1}
48-
alt="Avalanche Logo (Dark Mode)"
49-
className="h-full object-cover"
50-
width={110}
51-
height={115}
52-
/>
44+
{!user && (
45+
<div className='flex mt-4 sm:mt-0 items-end justify-end'>
46+
<div className='hidden dark:block'>
47+
<Image
48+
src={Team1}
49+
alt='Avalanche Logo (Dark Mode)'
50+
className='h-full object-cover'
51+
width={110}
52+
height={115}
53+
/>
54+
</div>
55+
<div className='block dark:hidden'>
56+
<Image
57+
src={Team1Logo}
58+
alt='Avalanche Logo (Light Mode)'
59+
className='h-full object-cover'
60+
width={110}
61+
height={115}
62+
/>
63+
</div>
5364
</div>
54-
<div className="block dark:hidden">
55-
<Image
56-
src={Team1Logo}
57-
alt="Avalanche Logo (Light Mode)"
58-
className="h-full object-cover"
59-
width={110}
60-
height={115}
61-
/>
62-
</div>
63-
</div>
65+
)}
6466
</div>
6567
</div>
6668
);
6769
};
6870

6971
const AmbasssadorDao = () => {
7072
const { data: user, isLoading } = useFetchUserDataQuery();
71-
73+
const [openAuthModal, setOpenAuthModal] = useState(false);
7274
if (isLoading) {
7375
return <FullScreenLoader />;
7476
}
7577

7678
return (
77-
<div className="bg-[#fff] dark:bg-[#000] text-[var(--white-text-color)] min-h-screen">
79+
<div className='bg-[#fff] dark:bg-[#000] text-[var(--white-text-color)] min-h-screen'>
7880
<WelcomeSection user={user} />
79-
<div className="max-w-[1220px] bg-[var(--drop-shadow)] mx-auto px-8 py-8 rounded-xl grid grid-cols-1 md:grid-cols-2 gap-4 -mt-8 shadow-sm backdrop-blur-xs border-[1px] border-[#FFFFFF66] dark:border-none">
80-
{user?.role !== "AMBASSADOR" && (
81-
<AmbassadorCard
82-
title="Become a Member"
83-
description="Reach 70,000+ talent from one single dashboard"
84-
link="/"
85-
/>
86-
)}
87-
{user?.role !== "AMBASSADOR" && (
88-
<AmbassadorCard
89-
title="Become a Client"
90-
description="Post projects and hire top talent for your business needs"
91-
link="/"
92-
/>
93-
)}
94-
</div>
81+
{!user && (
82+
<div className='max-w-[1220px] bg-[var(--drop-shadow)] mx-auto px-8 py-8 rounded-xl grid grid-cols-1 md:grid-cols-2 gap-4 -mt-8 shadow-sm backdrop-blur-xs border-[1px] border-[#FFFFFF66] dark:border-none'>
83+
{user?.role !== "AMBASSADOR" && (
84+
<AmbassadorCard
85+
title='Become a Member'
86+
description='Reach 70,000+ talent from one single dashboard'
87+
onClick={() => setOpenAuthModal(true)}
88+
/>
89+
)}
90+
{user?.role !== "AMBASSADOR" && (
91+
<AmbassadorCard
92+
title='Become a Client'
93+
description='Post projects and hire top talent for your business needs'
94+
onClick={() => setOpenAuthModal(true)}
95+
/>
96+
)}
97+
</div>
98+
)}
9599

96-
<main className="max-w-7xl mx-auto px-4 sm:px-6 xl:px-8 py-12">
100+
<main className='max-w-7xl mx-auto px-4 sm:px-6 xl:px-8 py-12'>
97101
<Suspense fallback={<div>Loading...</div>}>
98102
<MainContent user={user} />
103+
104+
<AuthModal
105+
isOpen={openAuthModal}
106+
onClose={() => setOpenAuthModal(false)}
107+
stopRedirection={false}
108+
/>
99109
</Suspense>
100110
</main>
101111
</div>

components/ambassador-dao/How-it-works.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ const [openAuthModal, setOpenAuthModal] = useState(false);
8383
);
8484
};
8585

86-
export default HowItWorks;
86+
export default HowItWorks;

components/ambassador-dao/auth-button.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import {
99
} from "@/services/ambassador-dao/requests/auth";
1010
import Image from "next/image";
1111
import { Popover, PopoverTrigger, PopoverContent } from "../ui/popover";
12-
import { ListIcon, LogOut, User2Icon } from "lucide-react";
12+
import {
13+
ListIcon,
14+
LogOut,
15+
User2Icon,
16+
UserCheck2,
17+
UserIcon,
18+
} from "lucide-react";
1319
import { useRouter } from "next/navigation";
1420

1521
export const AuthButton = () => {
@@ -37,6 +43,21 @@ export const AuthButton = () => {
3743
</PopoverTrigger>
3844
<PopoverContent className='w-auto p-0' align='start'>
3945
<div className='w-42 bg-[#fafafa] dark:bg-[#09090B] rounded-md flex flex-col space-y-1'>
46+
{(!user.role || !user.first_name) && (
47+
<>
48+
<div
49+
onClick={() => router.push("/ambassador-dao/onboard")}
50+
className='px-3 py-2 flex items-center gap-2 cursor-pointer hover:bg-opacity-50 dark:bg-[#000]'
51+
>
52+
<UserCheck2
53+
color='var(--white-text-color)'
54+
size={16}
55+
/>
56+
Onboard
57+
</div>
58+
<hr />
59+
</>
60+
)}
4061
{user.role === "SPONSOR" ? (
4162
<>
4263
<div

components/ambassador-dao/dashboard/BountiesSection.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const BountiesSection = ({
5454
onResetFilters;
5555
};
5656

57-
console.log(filters)
5857
return (
5958
<section className="border border-[var(--default-border-color)] rounded-md py-10 px-6 mb-12">
6059
<div className="flex justify-between">

components/ambassador-dao/dashboard/SideContent.tsx

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import HowItWorks from "../How-it-works";
1010

1111
const UserProfileCard = ({ userData }: any) => {
1212
return (
13-
<div className="shadow-sm border border-[var(--default-border-color)] rounded-lg p-4 mb-6">
14-
<div className="flex flex-wrap items-center">
15-
<div className="w-10 h-10 rounded-full bg-gray-600 mr-3 flex items-center justify-center">
16-
<span className="text-white">
13+
<div className='shadow-sm border border-[var(--default-border-color)] rounded-lg p-4 mb-6'>
14+
<div className='flex flex-wrap items-center'>
15+
<div className='w-10 h-10 rounded-full bg-gray-600 mr-3 flex items-center justify-center'>
16+
<span className='text-white'>
1717
{userData?.first_name && userData?.last_name
1818
? `${userData.first_name.charAt(0)}${userData.last_name.charAt(
1919
0
@@ -23,17 +23,17 @@ const UserProfileCard = ({ userData }: any) => {
2323
: ""}
2424
</span>
2525
</div>
26-
<div className="text-sm">
27-
<h3 className="font-medium text-wrap">
26+
<div className='text-sm'>
27+
<h3 className='font-medium text-wrap'>
2828
{userData?.first_name} {userData?.last_name}{" "}
2929
{!userData?.first_name && userData?.email}
3030
</h3>
31-
<p className="text-xs text-[var(--secondary-text-color)]">
31+
<p className='text-xs text-[var(--secondary-text-color)]'>
3232
{userData?.username ? `@${userData?.username}` : ""}
3333
</p>
3434
</div>
35-
<div className="ml-auto">
36-
<span className="px-3 py-1 rounded-full text-sm">
35+
<div className='ml-auto'>
36+
<span className='px-3 py-1 rounded-full text-sm'>
3737
{userData?.job_title}
3838
</span>
3939
</div>
@@ -45,15 +45,15 @@ const UserProfileCard = ({ userData }: any) => {
4545
export const AmbassadorCard = ({
4646
title,
4747
description,
48-
link,
48+
onClick,
4949
}: {
5050
title: string;
5151
description: string;
52-
link: string;
52+
onClick: () => void;
5353
}) => {
54-
const openInNewTab = (url: string) => {
55-
window.open(url, "_blank", "noopener,noreferrer");
56-
};
54+
// const openInNewTab = (url: string) => {
55+
// window.open(url, "_blank", "noopener,noreferrer");
56+
// };
5757

5858
return (
5959
<>
@@ -62,18 +62,18 @@ export const AmbassadorCard = ({
6262
className={`max-w-[592px] ${
6363
title === "Become a Member" ? "red-card-bg" : "blue-card-bg"
6464
} rounded-lg p-4 mb-4 relative overflow-hidden cursor-pointer border border-[var(--default-border-color)]`}
65-
onClick={() => openInNewTab(link)}
65+
onClick={onClick}
6666
>
67-
<div className="relative z-10 text-[var(--white-text-color)]">
68-
<h3 className="font-medium mb-1 text-lg md:text-xl text-[var(--white-text-color)]">
67+
<div className='relative z-10 text-[var(--white-text-color)]'>
68+
<h3 className='font-medium mb-1 text-lg md:text-xl text-[var(--white-text-color)]'>
6969
{title}
7070
</h3>
71-
<p className="text-sm opacity-80 text-[var(--secondary-text-color)]">
71+
<p className='text-sm opacity-80 text-[var(--secondary-text-color)]'>
7272
{description}
7373
</p>
7474
</div>
75-
<div className="absolute right-3 top-1/2 transform -translate-y-1/2">
76-
<ArrowUpRight color="white" className="h-6 w-6" />
75+
<div className='absolute right-3 top-1/2 transform -translate-y-1/2'>
76+
<ArrowUpRight color='white' className='h-6 w-6' />
7777
</div>
7878
</div>
7979
</>
@@ -84,14 +84,14 @@ const LeaderboardCard = () => {
8484
return (
8585
<Link href={"/ambassador-dao/leaderboard"}>
8686
{" "}
87-
<div className="rounded-md trophy mb-4 relative overflow-hidden cursor-pointer dark:border-none border border-[var(--default-border-color)] h-[72px]">
88-
<div className="relative z-10 text-[var(--white-text-color)] p-4">
89-
<h3 className="font-medium text-lg md:text-xl mb-1 text-[var(--white-text-color)]">
87+
<div className='rounded-md trophy mb-4 relative overflow-hidden cursor-pointer dark:border-none border border-[var(--default-border-color)] h-[72px]'>
88+
<div className='relative z-10 text-[var(--white-text-color)] p-4'>
89+
<h3 className='font-medium text-lg md:text-xl mb-1 text-[var(--white-text-color)]'>
9090
Leaderboard
9191
</h3>
9292
</div>
93-
<div className="absolute right-3 top-1/2 transform -translate-y-1/2">
94-
<ArrowUpRight color="var(--white-text-color)" className="h-6 w-6" />
93+
<div className='absolute right-3 top-1/2 transform -translate-y-1/2'>
94+
<ArrowUpRight color='var(--white-text-color)' className='h-6 w-6' />
9595
</div>
9696
</div>
9797
</Link>
@@ -122,33 +122,34 @@ const SideContent = ({ user }: { user: any }) => {
122122

123123
if (position === 1) {
124124
return (
125-
<Image src={GoldReward} alt="First Place" width={46} height={46} />
125+
<Image src={GoldReward} alt='First Place' width={46} height={46} />
126126
);
127127
} else if (position === 2) {
128128
return (
129-
<Image src={SilverReward} alt="Second Place" width={46} height={46} />
129+
<Image src={SilverReward} alt='Second Place' width={46} height={46} />
130130
);
131131
} else if (position === 3) {
132132
return (
133-
<Image src={BronzeReward} alt="Third Place" width={46} height={46} />
133+
<Image src={BronzeReward} alt='Third Place' width={46} height={46} />
134134
);
135135
} else {
136136
return (
137137
<div
138-
className="px-6 py-1 flex items-center justify-center rounded-full bg-[#2F2F33] w-fit"
138+
className='px-6 py-1 flex items-center justify-center rounded-full bg-[#2F2F33] w-fit'
139139
style={{
140140
background: "linear-gradient(90deg, #E84142 0%, #822425 100%)",
141141
}}
142142
>
143-
<span className="text-[var(--white-text-color)]">{position}</span>
143+
<span className='text-[var(--white-text-color)]'>{position}</span>
144144
</div>
145145
);
146146
}
147147
};
148148

149149
return (
150-
<div className="lg:col-span-1">
151-
<HowItWorks steps={steps} />
150+
<div className='lg:col-span-1'>
151+
{!user ? <HowItWorks steps={steps} /> : null}
152+
152153
<LeaderboardCard />
153154
<>
154155
{leaderboardData?.data?.slice(0, 3)?.map((user, index) => (
@@ -166,27 +167,27 @@ const SideContent = ({ user }: { user: any }) => {
166167
: "",
167168
}}
168169
>
169-
<div className="col-span-1">{getRankIcon(index, currentPage)}</div>
170+
<div className='col-span-1'>{getRankIcon(index, currentPage)}</div>
170171

171-
<div className="col-span-9 flex items-center gap-4">
172+
<div className='col-span-9 flex items-center gap-4'>
172173
<Image
173174
src={DefaultAvatar}
174175
alt={user.nickname}
175176
width={32}
176177
height={32}
177-
className="hidden md:block rounded-full"
178+
className='hidden md:block rounded-full'
178179
/>
179180
<span
180-
className="text-[var(--white-text-color)] text-xs sm:!text-base capitalize truncate max-w-[150px]"
181+
className='text-[var(--white-text-color)] text-xs sm:!text-base capitalize truncate max-w-[150px]'
181182
title={user.nickname}
182183
>
183184
{user.nickname}
184185
</span>
185186
</div>
186187

187-
<div className="col-span-2 flex justify-end">
188+
<div className='col-span-2 flex justify-end'>
188189
{user.tag === "ambassador" && (
189-
<span className="px-3 py-1 text-xs flex justify-center items-center dark:bg-[#444444] bg-[#e4e4e7] text-[var(--white-text-color)] rounded-md capitalize">
190+
<span className='px-3 py-1 text-xs flex justify-center items-center dark:bg-[#444444] bg-[#e4e4e7] text-[var(--white-text-color)] rounded-md capitalize'>
190191
{user.tag}
191192
</span>
192193
)}

0 commit comments

Comments
 (0)