Skip to content

Commit

Permalink
Merge pull request #4850 from Giveth/feature-addStickyStyle
Browse files Browse the repository at this point in the history
Feature add sticky style
  • Loading branch information
MohammadPCh authored Oct 24, 2024
2 parents 50f71a8 + 6aa1880 commit 4c6bd33
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/PassportBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,11 @@ export const PassportBannerData: IData = {
icon: <IconInfoOutline24 color={semanticColors.golden[700]} />,
},
};

export const PassportBanner = () => {
const { info, updateState, fetchUserMBDScore, handleSign, refreshScore } =
usePassport();
const { currentRound, passportState, passportScore, qfEligibilityState } =
info;

const { formatMessage, locale } = useIntl();
const { connector } = useAccount();
const { isOnSolana, handleSingOutAndSignInWithEVM } = useGeneralWallet();
Expand All @@ -126,6 +124,14 @@ export const PassportBanner = () => {

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 ? (
<>
<PassportBannerWrapper
Expand Down Expand Up @@ -209,7 +215,8 @@ export const PassportBanner = () => {
</GLink>
</StyledLink>
)}
{qfEligibilityState === EQFElegibilityState.NOT_SIGNED && (
{qfEligibilityState ===
(EQFElegibilityState as any).NOT_SIGNED && (
<StyledLink onClick={() => setSignWithWallet(true)}>
<GLink>
{formatMessage({
Expand Down Expand Up @@ -270,7 +277,9 @@ export const PassportBannerWrapper = styled(Flex)<IPassportBannerWrapperProps>`
align-items: center;
justify-content: center;
gap: 8px;
position: relative;
position: sticky; /* Change this to sticky */
top: 0; /* This keeps it at the top as the user scrolls */
z-index: 5; /* Ensure it stays above other content */
${mediaQueries.tablet} {
flex-direction: row;
}
Expand Down

0 comments on commit 4c6bd33

Please sign in to comment.