setistextVisible(true)} onMouseLeave={() => setistextVisible(false)} onClick={onClick}>
+
setIsTextVisible(true)}
+ onMouseLeave={() => setIsTextVisible(false)}
+ onClick={onClick}
+ data-testid={testId}
+ >
<>
{loading ? (
) : (
<>
-
{text}
+
+ {text}{" "}
+
>
)}
>
diff --git a/src/components/cards/challenge/_partials/FormTeam.tsx b/src/components/cards/challenge/_partials/FormTeam.tsx
index de8b23714..dab41b2aa 100644
--- a/src/components/cards/challenge/_partials/FormTeam.tsx
+++ b/src/components/cards/challenge/_partials/FormTeam.tsx
@@ -5,7 +5,7 @@ import Link from "next/link";
/**
* Props for the FormTeam component.
*/
-interface FormTeamCardProps {
+export interface FormTeamCardProps {
title: string;
description: string;
index: number;
diff --git a/src/components/cards/challenge/_partials/InvitationButton.tsx b/src/components/cards/challenge/_partials/InvitationButton.tsx
index 7aa757f41..08f944d58 100644
--- a/src/components/cards/challenge/_partials/InvitationButton.tsx
+++ b/src/components/cards/challenge/_partials/InvitationButton.tsx
@@ -10,9 +10,10 @@ import CheckIcon from "@/icons/check.svg";
* @interface InvitationButtonProps
* @typedef {InvitationButtonProps}
*/
-interface InvitationButtonProps {
+export interface InvitationButtonProps {
text: "accept" | "decline";
confirmInvitation: (text: "accept" | "decline") => void;
+ testId?: string;
}
/**
@@ -23,7 +24,7 @@ interface InvitationButtonProps {
* @param {InvitationButtonProps} { text }
* @returns {ReactElement}
*/
-export default function InvitationButton({ text, confirmInvitation }: InvitationButtonProps): ReactElement {
+export default function InvitationButton({ text, confirmInvitation, testId }: InvitationButtonProps): ReactElement {
const buttonClassNames = classNames(`flex items-center bg-white border text-sm px-3 py-1 gap-2`, {
"text-green-700 border-green-700": text === "accept",
"text-red-700 border-red-700": text === "decline",
@@ -36,6 +37,7 @@ export default function InvitationButton({ text, confirmInvitation }: Invitation
e.stopPropagation();
confirmInvitation(text);
}}
+ data-testid={testId}
>
{text === "accept" ?
:
}
{text}
diff --git a/src/components/cards/challenge/_partials/ReplyToInvitation.tsx b/src/components/cards/challenge/_partials/ReplyToInvitation.tsx
index ed213bc05..4270ee816 100644
--- a/src/components/cards/challenge/_partials/ReplyToInvitation.tsx
+++ b/src/components/cards/challenge/_partials/ReplyToInvitation.tsx
@@ -16,9 +16,10 @@ interface MultiSelector {
export interface InvitationProps {
invite_id: string;
team_ref: string;
+ testId?: string;
}
-export default function ReplyToInvitation({ invite_id, team_ref }: InvitationProps) {
+export default function ReplyToInvitation({ invite_id, team_ref, testId = "reply-to-invitation" }: InvitationProps) {
const dispatch = useDispatch();
const [loading, setLoading] = useState(false);
const [canReply, setCanReply] = useState(false);
@@ -70,7 +71,7 @@ export default function ReplyToInvitation({ invite_id, team_ref }: InvitationPro
}, [invite_id, team]);
return (
-
+
{loading ? (
) : (
diff --git a/src/components/cards/challenge/_partials/Reward.tsx b/src/components/cards/challenge/_partials/Reward.tsx
index 8a8747684..aa89047cc 100644
--- a/src/components/cards/challenge/_partials/Reward.tsx
+++ b/src/components/cards/challenge/_partials/Reward.tsx
@@ -3,7 +3,7 @@ import Coin from "@/components/ui/Coin";
import { useTranslation } from "next-i18next";
import { Reward } from "@/types/course";
-interface OverviewRewardsProps {
+export interface OverviewRewardsProps {
reward: Reward;
size: string;
}
diff --git a/src/components/cards/course/index.tsx b/src/components/cards/course/index.tsx
index f36cc693f..a81cf20e7 100644
--- a/src/components/cards/course/index.tsx
+++ b/src/components/cards/course/index.tsx
@@ -6,8 +6,6 @@ import { DurationBadge } from "@/components/badges/Duration";
import { useTranslation } from "next-i18next";
import { useSelector } from "@/hooks/useTypedSelector";
-
-
interface CourseCardProps {
title: string;
description: string;
@@ -33,9 +31,7 @@ export default function CourseCard({ title, description, link, level, learningMo
-
- {t('communities.overview.challenge.course')}
-
+
{t("communities.overview.challenge.course")}
diff --git a/src/components/cards/profile/Referral.tsx b/src/components/cards/profile/Referral.tsx
index fbbc44a61..07884b50b 100644
--- a/src/components/cards/profile/Referral.tsx
+++ b/src/components/cards/profile/Referral.tsx
@@ -30,13 +30,13 @@ export default function Referral({ referral }: ReferralProps): ReactElement {
const joinedAt = useMemo(() => DateManager.fromNow(referral.created_at, locale), [locale, referral.created_at]);
const rewardAt = useMemo(() => (referral.rewarded ? DateManager.fromNow(referral.updated_at, locale) : null), [locale, referral.rewarded, referral.updated_at]);
const status = (evaluation: Evaluation) => {
- if (!evaluation) return t("referrals.challenge.evaluation.status.pending")
- return t(evaluation?.reward ? "referrals.challenge.evaluation.status.passed" : "referrals.challenge.evaluation.status.failed")
- }
+ if (!evaluation) return t("referrals.challenge.evaluation.status.pending");
+ return t(evaluation?.reward ? "referrals.challenge.evaluation.status.passed" : "referrals.challenge.evaluation.status.failed");
+ };
const formatDate = (date: Date) => {
- return date ? DateManager.fromNow(date, locale) : null
- }
+ return date ? DateManager.fromNow(date, locale) : null;
+ };
return (
@@ -44,24 +44,38 @@ export default function Referral({ referral }: ReferralProps): ReactElement {
{referral.user?.displayName}
- {t("referrals.joined")} {joinedAt}
+
+ {t("referrals.joined")} {joinedAt}
+
- {referral.user.submissions.length ? referral.user.submissions.map((submission) => (
-
-
-
- {status(submission.metadata.evaluation)} {submission.challengeData.name} {t("referrals.submission.challenge")}
+ {referral.user.submissions.length ? (
+ referral.user.submissions.map((submission) => (
+
+
+
+ {status(submission.metadata.evaluation)}{" "}
+
+ {submission.challengeData.name} {t("referrals.submission.challenge")}
+
+
+ {!submission?.metadata?.evaluation && (
+
+ {" "}
+
+ {t("referrals.challenge.evaluation.pending")}
+
+ )}
- {!submission?.metadata?.evaluation && {t("referrals.challenge.evaluation.pending")} }
-
- {formatDate(submission.updated_at)}
-
- )
- ) : <>>}
+ {formatDate(submission.updated_at)}
+
+ ))
+ ) : (
+ <>>
+ )}
{referral?.rewarded && referral.metadata && referral.metadata.reward && (
@@ -77,8 +91,8 @@ export default function Referral({ referral }: ReferralProps): ReactElement {
)}
-
-
-
+
+
+
);
}
diff --git a/src/components/popups/NotificationPopup.tsx b/src/components/popups/NotificationPopup.tsx
index 43f4200ba..d2b5bf40e 100644
--- a/src/components/popups/NotificationPopup.tsx
+++ b/src/components/popups/NotificationPopup.tsx
@@ -62,15 +62,9 @@ export default function NotificationPopup({ buttonStyles }: NotificationPopupPro
-
+
- {unread > 0 && }
+ {unread > 0 && }
{isNotificationVisible && (
diff --git a/src/components/popups/profile-settings/EmailForm.tsx b/src/components/popups/profile-settings/EmailForm.tsx
index 140609e18..5e5c285a0 100644
--- a/src/components/popups/profile-settings/EmailForm.tsx
+++ b/src/components/popups/profile-settings/EmailForm.tsx
@@ -110,7 +110,7 @@ export default function EditEmail({ show, onClose }: EditProfileProps): ReactEle
message: "This must be a valid email address",
},
validate: (val: string) => {
- if (watch('email') !== val) return "Emails should match."
+ if (watch("email") !== val) return "Emails should match.";
},
})}
/>
diff --git a/src/components/sections/bounties/Navigation.tsx b/src/components/sections/bounties/Navigation.tsx
index 1f819bf15..8e4c619c0 100644
--- a/src/components/sections/bounties/Navigation.tsx
+++ b/src/components/sections/bounties/Navigation.tsx
@@ -30,7 +30,7 @@ interface BountiesNavigationMultiSelector {
* @export
* @returns {ReactElement}
*/
-export default function BountiesNavigation({testId}: {testId?: string}): ReactElement {
+export default function BountiesNavigation({ testId }: { testId?: string }): ReactElement {
const { t } = useTranslation();
const router = useRouter();
const { colors, bounties } = useMultiSelector({
diff --git a/src/components/sections/challenges/Learning.tsx b/src/components/sections/challenges/Learning.tsx
index 3a48c0c23..3bc281b29 100644
--- a/src/components/sections/challenges/Learning.tsx
+++ b/src/components/sections/challenges/Learning.tsx
@@ -37,10 +37,7 @@ export default function Learning({ courses, learningModules, community }: { cour
{learningModules?.map((learning) => (
-
+
))}
>
diff --git a/src/components/sections/challenges/_partials/HackathonPrize.tsx b/src/components/sections/challenges/_partials/HackathonPrize.tsx
index 35d8a12f4..1fc09bb9b 100644
--- a/src/components/sections/challenges/_partials/HackathonPrize.tsx
+++ b/src/components/sections/challenges/_partials/HackathonPrize.tsx
@@ -3,16 +3,16 @@ import { shortenNumber } from "@/utilities";
import { useTranslation } from "react-i18next";
export default function HackathonPrize({ reward, description }: { reward: Reward; description: string }) {
- const { t } = useTranslation()
+ const { t } = useTranslation();
const { first, second, third } = reward?.distribution || ({} as Distribution);
const amount = shortenNumber(reward?.amount);
return (
<>
- {reward?.fiatCurrency ?
- t('communities.overview.reward.fiat.prize.pool', { amount, currency: reward.fiatCurrency, token: reward?.token }) :
- t('communities.overview.reward.crypto.prize.pool', { amount, token: reward?.token })}
+ {reward?.fiatCurrency
+ ? t("communities.overview.reward.fiat.prize.pool", { amount, currency: reward.fiatCurrency, token: reward?.token })
+ : t("communities.overview.reward.crypto.prize.pool", { amount, token: reward?.token })}
{description}
diff --git a/src/components/sections/communities/overview/LearningMaterials.tsx b/src/components/sections/communities/overview/LearningMaterials.tsx
index 674d9347d..876595e73 100644
--- a/src/components/sections/communities/overview/LearningMaterials.tsx
+++ b/src/components/sections/communities/overview/LearningMaterials.tsx
@@ -1,5 +1,5 @@
-import CourseCard from "@/components/cards/course"
-import { useMultiSelector } from "@/hooks/useTypedSelector"
+import CourseCard from "@/components/cards/course";
+import { useMultiSelector } from "@/hooks/useTypedSelector";
import { LearningModuleCard } from "@/components/cards/LearningModule";
import { Course, LearningModule } from "@/types/course";
import { Community } from "@/types/community";
@@ -9,51 +9,49 @@ import { useTranslation } from "next-i18next";
import CommunityNavItem from "./_partials/NavItem";
interface LearningMaterialsSectionProps {
- community: Community;
- learningModules: LearningModule[],
- courses: Course[],
- loading: boolean
+ community: Community;
+ learningModules: LearningModule[];
+ courses: Course[];
+ loading: boolean;
}
export default function LearningMaterialsOverview() {
- const { t } = useTranslation()
- const { courses, learningModules, community, loading } = useMultiSelector
({
- courses: (state: IRootState) => state.learningMaterials.courses,
- learningModules: (state: IRootState) => state.learningMaterials.learningModules,
- community: (state: IRootState) => state.communities.current,
- loading: (state: IRootState) => state.learningMaterials.loading
- })
+ const { t } = useTranslation();
+ const { courses, learningModules, community, loading } = useMultiSelector({
+ courses: (state: IRootState) => state.learningMaterials.courses,
+ learningModules: (state: IRootState) => state.learningMaterials.learningModules,
+ community: (state: IRootState) => state.communities.current,
+ loading: (state: IRootState) => state.learningMaterials.loading,
+ });
- if (loading) return ;
+ if (loading) return ;
- return (
- <>
-
+
+
+ {courses?.map((course) => {
+ return (
+
-
- {courses?.map((course) => {
- return
- })}
-
-
- {learningModules?.map((module) => {
- return
- })}
-
- >
- )
+ );
+ })}
+
+
+ {learningModules?.map((module) => {
+ return ;
+ })}
+
+ >
+ );
}
-
diff --git a/src/components/sections/communities/overview/Sidebar.tsx b/src/components/sections/communities/overview/Sidebar.tsx
index 595c44f13..16ef07a67 100644
--- a/src/components/sections/communities/overview/Sidebar.tsx
+++ b/src/components/sections/communities/overview/Sidebar.tsx
@@ -60,23 +60,19 @@ export default function Sidebar(): JSX.Element {
url={links.learningMaterialsLink}
title={t("communities.overview.learning-materials.title")}
description={t("communities.overview.learning-materials.description")}
- className={classNames("pt-6",
- {
- "text-tertiary": !isActive(links.learningMaterialsLink),
- }
- )}
+ className={classNames("pt-6", {
+ "text-tertiary": !isActive(links.learningMaterialsLink),
+ })}
/>
{hasCurrentCommunity && (
)}
diff --git a/src/components/sections/communities/overview/Wrapper.tsx b/src/components/sections/communities/overview/Wrapper.tsx
index b484dda99..9562fc500 100644
--- a/src/components/sections/communities/overview/Wrapper.tsx
+++ b/src/components/sections/communities/overview/Wrapper.tsx
@@ -17,7 +17,7 @@ interface WrapperProps {
/**
* Wrapper component to provide a layout for children and filter props.
* @param {WrapperProps} props - The properties to configure the Wrapper component.
- * @returns {JSX.Element} A styled Wrapper component containing a MainHeaderSection, CommunitySidebar,
+ * @returns {JSX.Element} A styled Wrapper component containing a MainHeaderSection, CommunitySidebar,
* optional filter component, and children content.
*/
export default function Wrapper({ children, filter, testId = "wrapperId" }: WrapperProps): JSX.Element {
@@ -35,4 +35,4 @@ export default function Wrapper({ children, filter, testId = "wrapperId" }: Wrap