Skip to content

Commit

Permalink
Merge pull request #4342 from Giveth/fix/merge_main_to_develop
Browse files Browse the repository at this point in the history
merge main into develop
  • Loading branch information
Meriem-BM authored Jun 25, 2024
2 parents e918b11 + 002b5d7 commit 884743d
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 41 deletions.
2 changes: 1 addition & 1 deletion lang/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@
"label.you_can_enter_a_new_address": "Pots introduir una nova adreça per rebre fons a",
"label.you_can_now_close_this_page_and_continue_verifying": "Ja pots tancar aquesta pàgina i continuar verificant el teu projecte.",
"label.you_can_review_and_manage_your_givpower": "Pots revisar i gestionar la distribució del teu GIVpower a",
"label.you_can_set_a_custom_ethereum_address": "Podeu establir una adreça personalitzada d'Ethereum o ENS per rebre donacions.",
"label.you_can_set_a_custom_ethereum_address": "Podeu configurar una adreça d'Ethereum personalitzada o ENS per rebre donacions. Com més cadenes pugui acceptar fons el vostre projecte, més probable és que rebi donacions.",
"label.you_can_still_access": "Pots accedir al teu projecte des del teu compte i compartir-lo amb els teus amics.",
"label.you_can_still_access_your_project_from_your_account": "Encara pots accedir al teu projecte des del teu compte i compartir-lo amb els teus amics mitjançant el link del projecte!",
"label.you_can_still_donate": "Encara podeu fer una donació a altres xarxes, però la vostra donació no es compensarà amb el finançament quadràtic.",
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@
"label.you_can_enter_a_new_address": "You can enter a new address to receive funds on",
"label.you_can_now_close_this_page_and_continue_verifying": "You can now close this page and continue verifying your project.",
"label.you_can_review_and_manage_your_givpower": "You can review and manage your GIVpower allocations in",
"label.you_can_set_a_custom_ethereum_address": "You can set a custom Ethereum address or ENS to receive donations.",
"label.you_can_set_a_custom_ethereum_address": "You can set a custom Ethereum address or ENS to receive donations. The more chains your project can accept funds on, the more likely it is to receive donations. ",
"label.you_can_still_access": "You can still access your project from your account and share it with your friends.",
"label.you_can_still_access_your_project_from_your_account": "You can still access your project from your account and share it with your friends via the project link!",
"label.you_can_still_donate": "You can still donate on other networks, but your donation won't be matched by quadratic funding.",
Expand Down
2 changes: 1 addition & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@
"label.you_can_enter_a_new_address": "Puedes ingresar una nueva dirección para recibir fondos en",
"label.you_can_now_close_this_page_and_continue_verifying": "Ahora puedes cerrar esta página y continuar con la verificación de tu proyecto.",
"label.you_can_review_and_manage_your_givpower": "Puedes revisar y administrar la distribución del GIVpower en",
"label.you_can_set_a_custom_ethereum_address": "Puedes definir una dirección de Ethereum o ENS para recibir donaciones.",
"label.you_can_set_a_custom_ethereum_address": "Puede configurar una dirección de Ethereum personalizada o ENS para recibir donaciones. Cuantas más cadenas pueda aceptar fondos su proyecto, más probable es que reciba donaciones.",
"label.you_can_still_access": "Sin embargo puedes acceder a tu proyecto desde tu cuenta y compartirlo con tus amigos.",
"label.you_can_still_access_your_project_from_your_account": "Puedes seguir accediendo a tu proyecto desde tu cuenta y compartirlo con tus amigos a través del link del proyecto!",
"label.you_can_still_donate": "Aún puedes donar en otras redes, pero tu donación no será igualada por fondos cuadráticos.",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "givethdapp",
"version": "2.28.0",
"version": "2.28.1",
"private": true,
"scripts": {
"build": "next build",
Expand Down
216 changes: 216 additions & 0 deletions public/images/banners/qf-round/publicNouns.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions src/components/project-card/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ import { slugToProjectDonate, slugToProjectView } from '@/lib/routeCreators';
import { ORGANIZATION } from '@/lib/constants/organizations';
import { mediaQueries } from '@/lib/constants/constants';
import { ProjectCardUserName } from './ProjectCardUserName';
import {
calculateTotalEstimatedMatching,
getActiveRound,
getEstimatedMatchingRange,
} from '@/helpers/qf';
import { calculateTotalEstimatedMatching, getActiveRound } from '@/helpers/qf';
import { formatDonation } from '@/helpers/number';
import { RoundNotStartedModal } from './RoundNotStartedModal';
import { TooltipContent } from '@/components/modals/HarvestAll.sc';
Expand Down Expand Up @@ -239,7 +235,7 @@ const ProjectCard = (props: IProjectCard) => {
{activeStartedRound && (
<Flex $flexDirection='column' gap='6px'>
<EstimatedMatchingPrice>
{getEstimatedMatchingRange(
{formatDonation(
calculateTotalEstimatedMatching(
projectDonationsSqrtRootSum,
allProjectsSum,
Expand All @@ -250,8 +246,11 @@ const ProjectCard = (props: IProjectCard) => {
),
allocatedFundUSDPreferred ? '$' : '',
locale,
allocatedTokenSymbol,
true,
)}
{allocatedFundUSDPreferred
? ''
: ` ${allocatedTokenSymbol}`}
</EstimatedMatchingPrice>
<EstimatedMatching>
<span>
Expand Down
9 changes: 5 additions & 4 deletions src/components/views/donate/EstimatedMatchingToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import { IProject } from '@/apollo/types/types';
import {
calculateEstimatedMatchingWithDonationAmount,
getActiveRound,
getEstimatedMatchingRange,
} from '@/helpers/qf';
import { IProjectAcceptedToken } from '@/apollo/types/gqlTypes';
import { useTokenPrice } from '@/hooks/useTokenPrice';
import { formatDonation } from '@/helpers/number';

interface IEstimatedMatchingToast {
projectData: IProject;
token?: IProjectAcceptedToken;
Expand Down Expand Up @@ -79,12 +80,12 @@ const EstimatedMatchingToast: React.FC<IEstimatedMatchingToast> = ({
);

const formattedDonation = isAboveMinValidUsdValue
? getEstimatedMatchingRange(
? `${formatDonation(
esMatching,
allocatedFundUSDPreferred ? '$' : '',
locale,
allocatedTokenSymbol,
)
true,
)} ${allocatedFundUSDPreferred ? '' : ` ${allocatedTokenSymbol}`}`
: '---';

const bottomText = isAboveMinValidUsdValue
Expand Down
13 changes: 8 additions & 5 deletions src/components/views/project/projectActionCard/QFSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
calculateEstimatedMatchingWithDonationAmount,
calculateTotalEstimatedMatching,
getActiveRound,
getEstimatedMatchingRange,
} from '@/helpers/qf';
import links from '@/lib/constants/links';
import { IconWithTooltip } from '@/components/IconWithToolTip';
Expand Down Expand Up @@ -83,12 +82,15 @@ const QFSection: FC<IQFSectionProps> = ({ projectData }) => {
totalEstimatedMatching !== 0 ? (
<Flex $flexDirection='column' gap='4px'>
<EstimatedMatchingPrice>
{getEstimatedMatchingRange(
{formatDonation(
totalEstimatedMatching,
allocatedFundUSDPreferred ? '$' : '',
locale,
allocatedTokenSymbol,
true,
)}
{allocatedFundUSDPreferred
? ''
: ` ${allocatedTokenSymbol}`}
</EstimatedMatchingPrice>
<Flex $alignItems='center' gap='4px'>
<LightCaption>
Expand Down Expand Up @@ -116,7 +118,7 @@ const QFSection: FC<IQFSectionProps> = ({ projectData }) => {
</Subline>
<IconArrowRight16 color={brandColors.cyan[500]} />
<EndAlignedSubline>
{getEstimatedMatchingRange(
{formatDonation(
calculateEstimatedMatchingWithDonationAmount(
amount,
projectDonationsSqrtRootSum,
Expand All @@ -128,8 +130,9 @@ const QFSection: FC<IQFSectionProps> = ({ projectData }) => {
),
allocatedFundUSDPreferred ? '$' : '',
locale,
allocatedTokenSymbol,
true,
)}
{allocatedFundUSDPreferred ? '' : ` ${allocatedTokenSymbol}`}
</EndAlignedSubline>
</FlexSameSize>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ export const ActiveQFProjectsBanner = () => {
};

const sponsors = [
{
title: '@publicNouns',
image: '/images/banners/qf-round/publicNouns.svg',
},
{
title: '@climate_program',
image: '/images/banners/qf-round/climate_program.svg',
Expand Down
3 changes: 3 additions & 0 deletions src/components/views/projects/qfBanner/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ export const MiddleSponsors = styled(Flex)`
:nth-child(2) {
margin-top: -12px;
}
:nth-child(3) {
margin-top: -12px;
}
`;

export const BottomSponsors = styled(Flex)`
Expand Down
42 changes: 21 additions & 21 deletions src/helpers/qf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IQFRound } from '@/apollo/types/types';
import { getNowUnixMS } from './time';
import { formatDonation } from '@/helpers/number';
// import { formatDonation } from '@/helpers/number';

export const hasActiveRound = (qfRounds: IQFRound[] | undefined) => {
if (!qfRounds) return false;
Expand Down Expand Up @@ -77,26 +77,26 @@ export const calculateEstimatedMatchingWithDonationAmount = (
);
};

export const getEstimatedMatchingRange = (
amount: number,
currency: string,
locale: string,
allocatedTokenSymbol: string | undefined,
): string => {
const formatWithCurrency = (amount: number) => {
const formattedAmount = formatDonation(amount, currency, locale, true);
return currency
? formattedAmount
: `${formattedAmount} ${allocatedTokenSymbol}`;
};
// export const getEstimatedMatchingRange = (
// amount: number,
// currency: string,
// locale: string,
// allocatedTokenSymbol: string | undefined,
// ): string => {
// const formatWithCurrency = (amount: number) => {
// const formattedAmount = formatDonation(amount, currency, locale, true);
// return currency
// ? formattedAmount
// : `${formattedAmount} ${allocatedTokenSymbol}`;
// };

if (amount >= 2) {
return `${formatWithCurrency((amount * 30) / 100)} - ${formatWithCurrency(amount)}`;
}
// if (amount >= 2) {
// return `${formatWithCurrency((amount * 30) / 100)} - ${formatWithCurrency(amount)}`;
// }

if (amount >= 1) {
return '< $2';
}
// if (amount >= 1) {
// return '< $2';
// }

return formatWithCurrency(amount);
};
// return formatWithCurrency(amount);
// };

0 comments on commit 884743d

Please sign in to comment.