diff --git a/src/components/PassportBanner.tsx b/src/components/PassportBanner.tsx
index e818aa544..63de3c9e4 100644
--- a/src/components/PassportBanner.tsx
+++ b/src/components/PassportBanner.tsx
@@ -113,167 +113,162 @@ export const PassportBannerData: IData = {
};
export const PassportBanner = () => {
- const { info, updateState, fetchUserMBDScore, handleSign, refreshScore } =
- usePassport();
- const { currentRound, passportState, passportScore, qfEligibilityState } =
- info;
-
+ const { info, updateState, fetchUserMBDScore, handleSign, refreshScore } = usePassport();
+ const { currentRound, passportState, passportScore, qfEligibilityState } = info;
const { formatMessage, locale } = useIntl();
const { connector } = useAccount();
const { isOnSolana, handleSingOutAndSignInWithEVM } = useGeneralWallet();
const [showModal, setShowModal] = useState(false);
const [signWithWallet, setSignWithWallet] = useState(false);
-
+
const isGSafeConnector = connector?.id === 'safe';
-
+
+ // Check if the eligibility state or current round is not loaded yet
+ const isLoading = !qfEligibilityState || !currentRound;
+
+ // Only render the banner when the data is available
+ if (isLoading) {
+ return null; // Or return a spinner or loading message if you'd like
+ }
+
return !isOnSolana ? (
- <>
-
-
-
- {PassportBannerData[qfEligibilityState].icon}
-
-
- {formatMessage(
- {
- id: PassportBannerData[qfEligibilityState]
- .content,
- },
- {
- data:
- qfEligibilityState ===
- EQFElegibilityState.NOT_STARTED &&
- currentRound
- ? smallFormatDate(
- new Date(
- currentRound?.beginDate,
- ),
- )
- : undefined,
- },
- )}
- {currentRound &&
- qfEligibilityState ===
- EQFElegibilityState.RECHECK_ELIGIBILITY && (
- <>
- {' '}
-
- {new Date(currentRound.endDate)
- .toLocaleString(locale || 'en-US', {
- day: 'numeric',
- month: 'short',
- })
- .replace(/,/g, '')}
-
- >
- )}
-
-
- {qfEligibilityState ===
- EQFElegibilityState.CHECK_ELIGIBILITY && (
- fetchUserMBDScore()}>
-
- {formatMessage({
- id: 'qf_donor_eligibility.banner.link.check_eligibility',
- })}
-
-
- )}
- {qfEligibilityState ===
- EQFElegibilityState.RECHECK_ELIGIBILITY && (
- setShowModal(true)}>
-
- {formatMessage({
- id: 'qf_donor_eligibility.banner.link.recheck_eligibility',
- })}
-
-
- )}
- {qfEligibilityState === EQFElegibilityState.PROCESSING && (
-
- {formatMessage({
- id: 'label.processing',
- })}
-
-
- )}
- {qfEligibilityState ===
- EQFElegibilityState.MORE_INFO_NEEDED && (
- setShowModal(true)}>
-
- {formatMessage({
- id: 'label.add_more_info',
- })}
-
-
- )}
- {qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
- setSignWithWallet(true)}>
-
- {formatMessage({
- id: 'label.sign_message',
- })}
-
-
-
- )}
-
- {showModal && (
-
- )}
- {signWithWallet && (
- {
- setSignWithWallet(false);
- }}
- />
- )}
- >
- ) : (
+ <>
+
+
+ {PassportBannerData[qfEligibilityState].icon}
+
+ {formatMessage(
+ {
+ id: PassportBannerData[qfEligibilityState].content,
+ },
+ {
+ data:
+ qfEligibilityState === EQFElegibilityState.NOT_STARTED &&
+ currentRound
+ ? smallFormatDate(new Date(currentRound?.beginDate))
+ : undefined,
+ }
+ )}
+ {currentRound && qfEligibilityState === EQFElegibilityState.RECHECK_ELIGIBILITY && (
+ <>
+ {' '}
+
+ {new Date(currentRound.endDate)
+ .toLocaleString(locale || 'en-US', {
+ day: 'numeric',
+ month: 'short',
+ })
+ .replace(/,/g, '')}
+
+ >
+ )}
+
+
+ {qfEligibilityState === EQFElegibilityState.CHECK_ELIGIBILITY && (
+ fetchUserMBDScore()}>
+
{formatMessage({
- id: 'label.to_activate_your_gitcoin_passport',
+ id: 'qf_donor_eligibility.banner.link.check_eligibility',
})}
-
-
+
+
+ )}
+ {qfEligibilityState === EQFElegibilityState.RECHECK_ELIGIBILITY && (
+ setShowModal(true)}>
+
{formatMessage({
- id: 'label.switch_to_evm',
+ id: 'qf_donor_eligibility.banner.link.recheck_eligibility',
})}
-
+
+
+ )}
+ {qfEligibilityState === EQFElegibilityState.PROCESSING && (
+
+ {formatMessage({
+ id: 'label.processing',
+ })}
+
+
+ )}
+ {qfEligibilityState === EQFElegibilityState.MORE_INFO_NEEDED && (
+ setShowModal(true)}>
+
+ {formatMessage({
+ id: 'label.add_more_info',
+ })}
+
+
+ )}
+ {qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
+ setSignWithWallet(true)}>
+
+ {formatMessage({
+ id: 'label.sign_message',
+ })}
+
+
+
+ )}
+ {showModal && (
+
+ )}
+ {signWithWallet && (
+ {
+ setSignWithWallet(false);
+ }}
+ />
+ )}
+ >
+ ) : (
+
+
+ {formatMessage({
+ id: 'label.to_activate_your_gitcoin_passport',
+ })}
+
+
+ {formatMessage({
+ id: 'label.switch_to_evm',
+ })}
+
+
);
-};
+ };
+
interface IPassportBannerWrapperProps {
$bgColor: EPBGState;
}
export const PassportBannerWrapper = styled(Flex)`
- flex-direction: column;
- background-color: ${props => bgColor[props.$bgColor]};
- padding: 16px;
- align-items: center;
- justify-content: center;
- gap: 8px;
- position: relative;
- ${mediaQueries.tablet} {
- flex-direction: row;
- }
+ flex-direction: column;
+ background-color: ${props => bgColor[props.$bgColor]};
+ padding: 16px;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ position: sticky; /* Change this to sticky */
+ top: 0; /* This keeps it at the top as the user scrolls */
+ z-index: 1000; /* Ensure it stays above other content */
+ ${mediaQueries.tablet} {
+ flex-direction: row;
+ }
`;
const IconWrapper = styled.div`