Skip to content

Commit

Permalink
Fix/QF round project enabled networks
Browse files Browse the repository at this point in the history
  • Loading branch information
kkatusic committed Feb 18, 2025
1 parent 00db009 commit cd4eba5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 56 deletions.
58 changes: 30 additions & 28 deletions src/components/views/donate/QFEligibleNetworks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const QFEligibleNetworks = () => {
const [showModal, setShowModal] = useState(false);
const { isConnected } = useGeneralWallet();
const { formatMessage } = useIntl();
const { activeStartedRound } = useDonateData();
const { activeStartedRound, project } = useDonateData();
console.log('project', project);
const router = useRouter();
const isQRDonation = router.query.chain === ChainType.STELLAR.toLowerCase();
const eligibleNetworksWithoutStellar = activeStartedRound?.eligibleNetworks
Expand All @@ -42,24 +43,34 @@ const QFEligibleNetworks = () => {
{formatMessage({ id: 'label.eligible_networks_for_matching' })}
</Caption>
<IconsWrapper>
{activeStartedRound?.eligibleNetworks?.map(network => (
<IconWithTooltip
icon={
<TooltipIconWrapper>
{config.NETWORKS_CONFIG_WITH_ID[
network
]?.chainLogo(24)}
</TooltipIconWrapper>
}
direction='top'
align='top'
key={network}
>
<SublineBold>
{config.NETWORKS_CONFIG_WITH_ID[network]?.name}
</SublineBold>
</IconWithTooltip>
))}
{activeStartedRound?.eligibleNetworks?.map(network => {
// Check if project has an address for this network
const hasProjectAddress = project?.addresses?.some(
address =>
address.networkId === network &&
address.isRecipient,
);

// Only render if project has an address for this network
return hasProjectAddress ? (
<IconWithTooltip
icon={
<TooltipIconWrapper>
{config.NETWORKS_CONFIG_WITH_ID[
network
]?.chainLogo(24)}
</TooltipIconWrapper>
}
direction='top'
align='top'
key={network}
>
<SublineBold>
{config.NETWORKS_CONFIG_WITH_ID[network]?.name}
</SublineBold>
</IconWithTooltip>
) : null;
})}
</IconsWrapper>
{!isQRDonation && isConnected && (
<ButtonsWrapper>
Expand Down Expand Up @@ -99,15 +110,6 @@ const IconsWrapper = styled.div`
max-width: 100%; /* Ensure the content does not exceed the width of the parent */
max-height: 100%; /* Ensure the content does not exceed the height of the parent */
gap: 4px;
img {
filter: grayscale(100%);
opacity: 0.4;
transition: all 0.3s;
&:hover {
filter: grayscale(0);
opacity: 1;
}
}
`;

const ButtonsWrapper = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ProjectEligibleQFChains = () => {
const { formatMessage } = useIntl();

const { activeStartedRound } = getActiveRound(projectData?.qfRounds);

return (
<Container>
<Wrapper>
Expand All @@ -21,24 +22,37 @@ const ProjectEligibleQFChains = () => {
})}
</Caption>
<IconsWrapper>
{activeStartedRound?.eligibleNetworks?.map(network => (
<IconWithTooltip
icon={
<TooltipIconWrapper>
{config.NETWORKS_CONFIG_WITH_ID[
network
]?.chainLogo(24)}
</TooltipIconWrapper>
}
direction='top'
align='top'
key={network}
>
<SublineBold>
{config.NETWORKS_CONFIG_WITH_ID[network]?.name}
</SublineBold>
</IconWithTooltip>
))}
{activeStartedRound?.eligibleNetworks?.map(network => {
// Check if project has an address for this network
const hasProjectAddress = projectData?.addresses?.some(
address =>
address.networkId === network &&
address.isRecipient,
);

// Only render if project has an address for this network
return hasProjectAddress ? (
<IconWithTooltip
icon={
<TooltipIconWrapper>
{config.NETWORKS_CONFIG_WITH_ID[
network
]?.chainLogo(24)}
</TooltipIconWrapper>
}
direction='top'
align='top'
key={network}
>
<SublineBold>
{
config.NETWORKS_CONFIG_WITH_ID[network]
?.name
}
</SublineBold>
</IconWithTooltip>
) : null;
})}
</IconsWrapper>
</Wrapper>
</Container>
Expand All @@ -60,17 +74,7 @@ const IconsWrapper = styled.div`
flex-wrap: wrap; /* Allow content to wrap to the next line */
max-width: 100%; /* Ensure the content does not exceed the width of the parent */
max-height: 100%; /* Ensure the content does not exceed the height of the parent */
gap: 8px;
img {
filter: grayscale(100%);
opacity: 0.4;
transition: all 0.3s;
&:hover {
filter: grayscale(0);
opacity: 1;
}
}
`;

const Wrapper = styled.div`
Expand Down

0 comments on commit cd4eba5

Please sign in to comment.