Skip to content

Commit

Permalink
Undo passport banner changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadranjbarz committed Sep 15, 2024
1 parent 1c52ecf commit 99f22bb
Showing 1 changed file with 106 additions and 122 deletions.
228 changes: 106 additions & 122 deletions src/components/PassportBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,115 +123,104 @@ export const PassportBanner = () => {
const { isOnSolana, handleSingOutAndSignInWithEVM } = useGeneralWallet();
const [showModal, setShowModal] = useState<boolean>(false);
const [signWithWallet, setSignWithWallet] = useState<boolean>(false);
const router = useRouter();
const [isQRDonation, _setIsQRDonation] = useState(
router.query.chain === ChainType.STELLAR.toLowerCase(),
);

const isGSafeConnector = connector?.id === 'safe';

return !isOnSolana ? (
<>
{!isQRDonation && (
<PassportBannerWrapper
$bgColor={PassportBannerData[qfEligibilityState].bg}
>
<Flex gap='8px' $alignItems='center'>
<IconWrapper>
{PassportBannerData[qfEligibilityState].icon}
</IconWrapper>
<P>
{formatMessage(
{
id: PassportBannerData[qfEligibilityState]
.content,
},
{
data:
qfEligibilityState ===
EQFElegibilityState.NOT_STARTED &&
currentRound
? smallFormatDate(
new Date(
currentRound?.beginDate,
),
)
: undefined,
},
)}
{currentRound &&
qfEligibilityState ===
EQFElegibilityState.RECHECK_ELIGIBILITY && (
<>
{' '}
<strong>
{new Date(currentRound.endDate)
.toLocaleString(
locale || 'en-US',
{
day: 'numeric',
month: 'short',
},
)
.replace(/,/g, '')}
</strong>
</>
)}
</P>
</Flex>
{qfEligibilityState ===
EQFElegibilityState.CHECK_ELIGIBILITY && (
<StyledLink onClick={() => fetchUserMBDScore()}>
<GLink>
{formatMessage({
id: 'qf_donor_eligibility.banner.link.check_eligibility',
})}
</GLink>
</StyledLink>
)}
{qfEligibilityState ===
<PassportBannerWrapper
$bgColor={PassportBannerData[qfEligibilityState].bg}
>
<Flex gap='8px' $alignItems='center'>
<IconWrapper>
{PassportBannerData[qfEligibilityState].icon}
</IconWrapper>
<P>
{formatMessage(
{
id: PassportBannerData[qfEligibilityState]
.content,
},
{
data:
qfEligibilityState ===
EQFElegibilityState.NOT_STARTED &&

Check failure on line 147 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
currentRound
? smallFormatDate(
new Date(

Check failure on line 150 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
currentRound?.beginDate,

Check failure on line 151 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
),

Check failure on line 152 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
)

Check failure on line 153 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
: undefined,
},
)}
{currentRound &&
qfEligibilityState ===

Check failure on line 158 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
EQFElegibilityState.RECHECK_ELIGIBILITY && (

Check failure on line 159 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹↹`
<StyledLink onClick={() => setShowModal(true)}>
<GLink>
{formatMessage({
id: 'qf_donor_eligibility.banner.link.recheck_eligibility',
})}
</GLink>
</StyledLink>
)}
{qfEligibilityState === EQFElegibilityState.PROCESSING && (
<StyledStatus>
<>

Check failure on line 160 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
{' '}

Check failure on line 161 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
<strong>

Check failure on line 162 in src/components/PassportBanner.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `↹`
{new Date(currentRound.endDate)
.toLocaleString(locale || 'en-US', {
day: 'numeric',
month: 'short',
})
.replace(/,/g, '')}
</strong>
</>
)}
</P>
</Flex>
{qfEligibilityState ===
EQFElegibilityState.CHECK_ELIGIBILITY && (
<StyledLink onClick={() => fetchUserMBDScore()}>
<GLink>
{formatMessage({
id: 'label.processing',
id: 'qf_donor_eligibility.banner.link.check_eligibility',
})}
<Spinner
color={brandColors.mustard[600]}
size={25}
/>
</StyledStatus>
)}
{qfEligibilityState ===
EQFElegibilityState.MORE_INFO_NEEDED && (
<StyledLink onClick={() => setShowModal(true)}>
<GLink>
{formatMessage({
id: 'label.add_more_info',
})}
</GLink>
</StyledLink>
)}
{qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
<StyledLink onClick={() => setSignWithWallet(true)}>
<GLink>
{formatMessage({
id: 'label.sign_message',
})}
</GLink>
<IconWalletOutline16 />
</StyledLink>
)}
</PassportBannerWrapper>
)}
{!isQRDonation && showModal && (
</GLink>
</StyledLink>
)}
{qfEligibilityState ===
EQFElegibilityState.RECHECK_ELIGIBILITY && (
<StyledLink onClick={() => setShowModal(true)}>
<GLink>
{formatMessage({
id: 'qf_donor_eligibility.banner.link.recheck_eligibility',
})}
</GLink>
</StyledLink>
)}
{qfEligibilityState === EQFElegibilityState.PROCESSING && (
<StyledStatus>
{formatMessage({
id: 'label.processing',
})}
<Spinner color={brandColors.mustard[600]} size={25} />
</StyledStatus>
)}
{qfEligibilityState ===
EQFElegibilityState.MORE_INFO_NEEDED && (
<StyledLink onClick={() => setShowModal(true)}>
<GLink>
{formatMessage({
id: 'label.add_more_info',
})}
</GLink>
</StyledLink>
)}
{qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
<StyledLink onClick={() => setSignWithWallet(true)}>
<GLink>
{formatMessage({
id: 'label.sign_message',
})}
</GLink>
<IconWalletOutline16 />
</StyledLink>
)}
</PassportBannerWrapper>
{showModal && (
<PassportModal
qfEligibilityState={qfEligibilityState}
passportState={passportState}
Expand All @@ -243,7 +232,7 @@ export const PassportBanner = () => {
handleSign={handleSign}
/>
)}
{!isQRDonation && signWithWallet && (
{signWithWallet && (
<SignWithWalletModal
isGSafeConnector={isGSafeConnector}
setShowModal={() => {
Expand All @@ -253,24 +242,20 @@ export const PassportBanner = () => {
)}
</>
) : (
<>
{!isQRDonation && (
<PassportBannerWrapper
$bgColor={PassportBannerData[qfEligibilityState].bg}
>
<P>
{formatMessage({
id: 'label.to_activate_your_gitcoin_passport',
})}
</P>
<StyledP onClick={handleSingOutAndSignInWithEVM}>
{formatMessage({
id: 'label.switch_to_evm',
})}
</StyledP>
</PassportBannerWrapper>
)}
</>
<PassportBannerWrapper
$bgColor={PassportBannerData[qfEligibilityState].bg}
>
<P>
{formatMessage({
id: 'label.to_activate_your_gitcoin_passport',
})}
</P>
<StyledP onClick={handleSingOutAndSignInWithEVM}>
{formatMessage({
id: 'label.switch_to_evm',
})}
</StyledP>
</PassportBannerWrapper>
);
};

Expand All @@ -286,7 +271,6 @@ export const PassportBannerWrapper = styled(Flex)<IPassportBannerWrapperProps>`
justify-content: center;
gap: 8px;
position: relative;
${mediaQueries.tablet} {
flex-direction: row;
}
Expand Down

0 comments on commit 99f22bb

Please sign in to comment.