From d1ae4e81d374844f67c89ca5d3f76a9c94be5019 Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Thu, 12 Sep 2024 13:42:52 +0330 Subject: [PATCH 01/19] Modify givbacks page to be compatible with givback v2 related to #4679 --- lang/en.json | 8 +-- src/apollo/gql/gqlGivbacks.ts | 12 ++++ src/components/GIVeconomyPages/GIVbacks.tsx | 66 +++------------------ src/content/metatags.ts | 2 +- 4 files changed, 25 insertions(+), 63 deletions(-) create mode 100644 src/apollo/gql/gqlGivbacks.ts diff --git a/lang/en.json b/lang/en.json index 2610fd80ab..8ddb60853f 100644 --- a/lang/en.json +++ b/lang/en.json @@ -355,7 +355,7 @@ "label.drag_and_drop_an_image_or": "Drag & drop an image here or,", "label.drag_to_allocate": "Drag to allocate", "label.duration_ago": "{duration} ago", - "label.each_givbacks_round_lasts_two_weeks": "Each GIVbacks round lasts two weeks. After the End Date, the GIV Allocated to that round is distributed to Givers who donated to verified projects during the round. Projects must apply for verification at least 1 week prior to the Start Date in order to be included in the round.", + "label.each_givbacks_round_lasts_two_weeks": "Each GIVbacks round lasts two weeks. The GIVbacks Rewards available depends on the amount donated at in the round, to a maximum amount of 1 million GIV. After the End Date, the GIVbacks Rewards for the round go to the eligible donors.", "label.earn": "Earn", "label.earn_a_yield": "Earn a Yield", "label.earn_giv_tokens_for_each_donation_made_through_your_link": "Earn GIV tokens for each donation made through your link", @@ -436,7 +436,7 @@ "label.givbacks_program": "GIVbacks program", "label.givbacks_rewards": "GIVbacks Rewards", "label.givbacks_rewards_corresponding_to_the_current_round": "GIVbacks rewards corresponding to the current round become available after the round ends. If you donated to a verified project and do not yet have rewards to claim, it is likely that GIVbacks have not yet been distributed for that round, or that you claimed your GIVbacks rewards already.", - "label.givbacks_rewards_donors_to_verified_projects": "GIVbacks rewards donors to verified projects with GIV, super-charging Giveth as a donor-driven force for good.", + "label.givbacks_rewards_donors_to_verified_projects": "When you make a donation of $5 or more to a GIVbacks eligible project you qualify to get GIV!", "label.givback_distributed_after_round": "GIV rewards from the GIVbacks program will be distributed after the end of the current round.", "label.give": "Give", "label.giveconomy": "GIVeconomy", @@ -481,7 +481,7 @@ "label.givstream_rewards": "GIVstream Rewards", "label.givstream_source": "GIVstream Source", "label.givtoken_holders_influence_the_treasyry": "GIV token holders influence the treasury, roadmap and mission of the Giveth ecosystem. By voting in the GIVgarden you earn rewards on your staked GIV!", - "label.giv_allocated_to_round": "GIV Allocated to Round", + "label.giv_allocated_to_round": "GIVbacks Rewards", "label.giv_fuels_and_directs": "GIV fuels and directs the Future of Giving, inspiring people to become Givers and participate in an ecosystem of collective support, abundance, and value-creation.", "label.giv_staking_is_available_on_gnosis_chain": "GIV staking is available on Gnosis Chain. Please bridge your GIV to Gnosis Chain, then switch network and stake to earn rewards.", "label.global_impact": "Global Impact", @@ -1153,7 +1153,7 @@ "label.when_someone_donates_using_your_link": "When someone donates to a verified project via your link, you’ll earn GIV!", "label.when_you_allocate_a_percentage_of_your_total_givpower": "When you allocate a percentage of your total GIVpower to this project, the GIVpower you have on other projects will decrease proportionally.", "label.when_you_donate_to_Verified_projects": "When you donate to verified projects you qualify to receive GIV tokens. Through GIVbacks, GIV empowers donors with governance rights via the GIVgarden.", - "label.when_you_giv_you_get_giv_back": "When you give you get GIV back!", + "label.when_you_giv_you_get_giv_back": "Give and get GIV back!", "label.when_you_harvest": "When you harvest {tokenSymbol} rewards, all liquid {tokenSymbol} allocated to you on that chain is sent to your wallet. Your {tokenSymbol}stream flowrate may also increase. Below is the breakdown of rewards you will get when you harvest.", "label.when_you_lock_your_tokens_midround": "When you lock your tokens mid-round, they will be locked for the remainder of the current round + the numbers of rounds you select.", "label.where?": "Where?", diff --git a/src/apollo/gql/gqlGivbacks.ts b/src/apollo/gql/gqlGivbacks.ts new file mode 100644 index 0000000000..2545452087 --- /dev/null +++ b/src/apollo/gql/gqlGivbacks.ts @@ -0,0 +1,12 @@ +import { gql } from '@apollo/client'; + +export const FETCH_ALLOCATED_GIVBACKS = gql` + query allocatedGivbacks($refreshCache: Boolean) { + allocatedGivbacks(refreshCache: $refreshCache) { + usdValueSentAmountInPowerRound + allocatedGivTokens + givPrice + date + } + } +`; diff --git a/src/components/GIVeconomyPages/GIVbacks.tsx b/src/components/GIVeconomyPages/GIVbacks.tsx index d4ad6e8475..1390825d07 100644 --- a/src/components/GIVeconomyPages/GIVbacks.tsx +++ b/src/components/GIVeconomyPages/GIVbacks.tsx @@ -19,8 +19,6 @@ import { GIVbackRewardCard, GBSubtitle, GBTitle, - GbDataBlock, - GbButton, GIVBackCard, RoundSection, RoundTitle, @@ -46,6 +44,7 @@ import links from '@/lib/constants/links'; import Routes from '@/lib/constants/Routes'; import { SubgraphDataHelper } from '@/lib/subgraph/subgraphDataHelper'; import { fetchSubgraphData } from '@/services/subgraph.service'; +import { FETCH_ALLOCATED_GIVBACKS } from '@/apollo/gql/gqlGivbacks'; export const TabGIVbacksTop = () => { const { formatMessage } = useIntl(); @@ -107,14 +106,6 @@ export const TabGIVbacksTop = () => { actionCb={() => { setShowHarvestModal(true); }} - subButtonLabel={ - givbackLiquidPart === 0n - ? formatMessage({ - id: 'label.why_dont_i_have_givbacks', - }) - : undefined - } - subButtonCb={() => setShowGivBackExplain(true)} network={chain?.id} targetNetworks={[ { @@ -157,6 +148,7 @@ export const TabGIVbacksBottom = () => { const [round, setRound] = useState(0); const [roundStarTime, setRoundStarTime] = useState(new Date()); const [roundEndTime, setRoundEndTime] = useState(new Date()); + const { data } = useQuery(FETCH_ALLOCATED_GIVBACKS); const { givTokenDistroHelper, isLoaded } = useGIVTokenDistroHelper(); useEffect(() => { if ( @@ -185,51 +177,6 @@ export const TabGIVbacksBottom = () => { return ( - - - - - - } - > - {formatMessage({ - id: 'label.when_you_donate_to_Verified_projects', - })} - - - - - } - > - {formatMessage({ - id: 'label.great_projects_make_the_giveconomy_thrive', - })} - - - @@ -303,9 +250,12 @@ export const TabGIVbacksBottom = () => {

- {formatMessage({ - id: 'label.one_million_giv', - })} + {data && + data.allocatedGivbacks && + data.allocatedGivbacks + .allocatedGivTokens + ? `${data.allocatedGivbacks.allocatedGivTokens} GIV` + : '?'} diff --git a/src/content/metatags.ts b/src/content/metatags.ts index f598fcc272..2a327c0efe 100644 --- a/src/content/metatags.ts +++ b/src/content/metatags.ts @@ -42,7 +42,7 @@ export const projectsMetatags = { export const givbacksMetatags = { title: 'GIVbacks: Get rewarded for donating to verified projects', - desc: 'GIVbacks rewards donors to verified projects with GIV, super-charging Giveth as a donor-driven force for good. GIVbacks is only available on Gnosis Chain.', + desc: 'When you make a donation of $5 or more to a GIVbacks eligible project you qualify to get GIV!', image: 'https://i.ibb.co/HTbdCdd/Thumbnail.png', url: 'https://giveth.io/givbacks', }; From 98eae3b5ecee203b8228ecd5f227a9d277fb618d Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Sat, 14 Sep 2024 01:08:55 +0330 Subject: [PATCH 02/19] Show allocatedGivTokens in givbacks page related #4679 --- src/components/GIVeconomyPages/GIVbacks.tsx | 27 ++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/GIVeconomyPages/GIVbacks.tsx b/src/components/GIVeconomyPages/GIVbacks.tsx index 1390825d07..e2fda4d463 100644 --- a/src/components/GIVeconomyPages/GIVbacks.tsx +++ b/src/components/GIVeconomyPages/GIVbacks.tsx @@ -45,6 +45,7 @@ import Routes from '@/lib/constants/Routes'; import { SubgraphDataHelper } from '@/lib/subgraph/subgraphDataHelper'; import { fetchSubgraphData } from '@/services/subgraph.service'; import { FETCH_ALLOCATED_GIVBACKS } from '@/apollo/gql/gqlGivbacks'; +import { client } from '@/apollo/apolloClient'; export const TabGIVbacksTop = () => { const { formatMessage } = useIntl(); @@ -148,7 +149,23 @@ export const TabGIVbacksBottom = () => { const [round, setRound] = useState(0); const [roundStarTime, setRoundStarTime] = useState(new Date()); const [roundEndTime, setRoundEndTime] = useState(new Date()); - const { data } = useQuery(FETCH_ALLOCATED_GIVBACKS); + const [givbackAllocations, setGivbackAllocations] = useState(null); + + useEffect(() => { + async function fetchAllocatedGivbacks() { + const { data } = await client.query({ + query: FETCH_ALLOCATED_GIVBACKS, + fetchPolicy: 'no-cache', + }); + setGivbackAllocations(data?.allocatedGivbacks); + console.log( + 'fetchAllocatedGivbacks** ', + JSON.stringify(data?.allocatedGivbacks, null, 2), + ); + } + fetchAllocatedGivbacks(); + }, []); + const { givTokenDistroHelper, isLoaded } = useGIVTokenDistroHelper(); useEffect(() => { if ( @@ -250,11 +267,9 @@ export const TabGIVbacksBottom = () => {

- {data && - data.allocatedGivbacks && - data.allocatedGivbacks - .allocatedGivTokens - ? `${data.allocatedGivbacks.allocatedGivTokens} GIV` + {givbackAllocations && + givbackAllocations.allocatedGivTokens + ? `${givbackAllocations.allocatedGivTokens} GIV` : '?'} From 69a43c9a74089e628e8f4baddb24d031e37ff9be Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Sat, 14 Sep 2024 01:17:21 +0330 Subject: [PATCH 03/19] Fix build error --- src/components/GIVeconomyPages/GIVbacks.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/GIVeconomyPages/GIVbacks.tsx b/src/components/GIVeconomyPages/GIVbacks.tsx index e2fda4d463..4e56a5f7b7 100644 --- a/src/components/GIVeconomyPages/GIVbacks.tsx +++ b/src/components/GIVeconomyPages/GIVbacks.tsx @@ -149,7 +149,15 @@ export const TabGIVbacksBottom = () => { const [round, setRound] = useState(0); const [roundStarTime, setRoundStarTime] = useState(new Date()); const [roundEndTime, setRoundEndTime] = useState(new Date()); - const [givbackAllocations, setGivbackAllocations] = useState(null); + // Define an interface for the type of givbackAllocations + interface GivbackAllocations { + usdValueSentAmountInPowerRound: number; + allocatedGivTokens: number; + givPrice: number; + date: string; + } + const [givbackAllocations, setGivbackAllocations] = + useState(null); useEffect(() => { async function fetchAllocatedGivbacks() { From 6e9ec169d8ca86a7861263267583cead83e8719a Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Sat, 14 Sep 2024 01:35:07 +0330 Subject: [PATCH 04/19] Remove console.log --- src/components/GIVeconomyPages/GIVbacks.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/GIVeconomyPages/GIVbacks.tsx b/src/components/GIVeconomyPages/GIVbacks.tsx index 4e56a5f7b7..3d9df06ddd 100644 --- a/src/components/GIVeconomyPages/GIVbacks.tsx +++ b/src/components/GIVeconomyPages/GIVbacks.tsx @@ -166,10 +166,6 @@ export const TabGIVbacksBottom = () => { fetchPolicy: 'no-cache', }); setGivbackAllocations(data?.allocatedGivbacks); - console.log( - 'fetchAllocatedGivbacks** ', - JSON.stringify(data?.allocatedGivbacks, null, 2), - ); } fetchAllocatedGivbacks(); }, []); From 6295e1b3d2c7c7191f7da1cc62cfdd13c51c76ca Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Tue, 17 Sep 2024 09:45:03 +0330 Subject: [PATCH 05/19] Add minimum value usd for givback eligible related to https://github.com/Giveth/giveth-dapps-v2/issues/4682 --- .../views/donate/OnTime/OneTimeDonationCard.tsx | 12 ++++++++++-- src/components/views/donate/helpers.tsx | 6 ++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx index f977521755..0a094de416 100644 --- a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx +++ b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx @@ -60,6 +60,7 @@ import { Spinner } from '@/components/Spinner'; import { useSolanaBalance } from '@/hooks/useSolanaBalance'; import { isWalletSanctioned } from '@/services/donation'; import SanctionModal from '@/components/modals/SanctionedModal'; +import { useTokenPrice } from '@/hooks/useTokenPrice'; const CryptoDonation: FC<{ setIsQRDonation: (isQRDonation: boolean) => void; @@ -148,6 +149,8 @@ const CryptoDonation: FC<{ const hasStellarAddress = addresses?.some( address => address.chainType === ChainType.STELLAR, ); + const tokenPrice = useTokenPrice(selectedOneTimeToken); + console.log('*** tokenPrice', tokenPrice); useEffect(() => { validateSanctions(); @@ -355,7 +358,10 @@ const CryptoDonation: FC<{ // We need givethDonationAmount here because we need to calculate the donation share // for Giveth. If user want to donate minimal amount to projecct, the donation share for Giveth // has to be 0, disabled in UI and DonationModal - const { givethDonation: givethDonationAmount } = calcDonationShare( + const { + givethDonation: givethDonationAmount, + projectDonation: projectDonationAmount, + } = calcDonationShare( amount, donationToGiveth, selectedOneTimeToken?.decimals ?? 18, @@ -399,7 +405,9 @@ const CryptoDonation: FC<{ anonymous={anonymous} givBackEligible={ projectIsGivBackEligible && - selectedOneTimeToken.isGivbackEligible + selectedOneTimeToken.isGivbackEligible && + tokenPrice && + tokenPrice * projectDonationAmount >= 4 } /> )} diff --git a/src/components/views/donate/helpers.tsx b/src/components/views/donate/helpers.tsx index 84be6cab74..53d4606a38 100644 --- a/src/components/views/donate/helpers.tsx +++ b/src/components/views/donate/helpers.tsx @@ -62,7 +62,10 @@ export const calcDonationShare = ( totalDonation: bigint, givethDonationPercent: number, decimals = 18, -) => { +): { + projectDonation: number; + givethDonation: number; +} => { let givethDonation = (totalDonation * BigInt(givethDonationPercent)) / 100n; const minDonationAmount = parseUnits('1', decimals - decimals / 3); if (givethDonation < minDonationAmount && givethDonationPercent !== 0) { @@ -80,7 +83,6 @@ export const calcDonationShare = ( } return { projectDonation: formatCrypto(projectDonation, decimals), - givethDonation: formatCrypto(givethDonation, decimals), }; }; From 7fac31656a215b7b35da3889ecdfe4a44f796920 Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Tue, 17 Sep 2024 09:50:21 +0330 Subject: [PATCH 06/19] Fix lint error --- src/components/views/donate/OnTime/OneTimeDonationCard.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx index 0a094de416..c781a879b8 100644 --- a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx +++ b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx @@ -150,7 +150,6 @@ const CryptoDonation: FC<{ address => address.chainType === ChainType.STELLAR, ); const tokenPrice = useTokenPrice(selectedOneTimeToken); - console.log('*** tokenPrice', tokenPrice); useEffect(() => { validateSanctions(); @@ -406,7 +405,7 @@ const CryptoDonation: FC<{ givBackEligible={ projectIsGivBackEligible && selectedOneTimeToken.isGivbackEligible && - tokenPrice && + Boolean(tokenPrice) && tokenPrice * projectDonationAmount >= 4 } /> From 47314e5cc8174f2c6471d334426052af04a81e2e Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Tue, 17 Sep 2024 09:58:53 +0330 Subject: [PATCH 07/19] Fix lint error --- src/components/views/donate/OnTime/OneTimeDonationCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx index c781a879b8..2632c64bb4 100644 --- a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx +++ b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx @@ -405,7 +405,7 @@ const CryptoDonation: FC<{ givBackEligible={ projectIsGivBackEligible && selectedOneTimeToken.isGivbackEligible && - Boolean(tokenPrice) && + tokenPrice !== undefined && tokenPrice * projectDonationAmount >= 4 } /> From 55977777cd1d7c2bcb9e02dbaa41c49daef0ef6b Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Tue, 17 Sep 2024 10:39:55 +0330 Subject: [PATCH 08/19] Change givPower page text adjustments related to #4382 --- lang/en.json | 18 ++++++++--------- src/components/GIVeconomyPages/GIVpower.tsx | 21 +------------------- src/components/GIVeconomyPages/GIVstream.tsx | 13 ------------ 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/lang/en.json b/lang/en.json index 8ddb60853f..e38e6731a8 100644 --- a/lang/en.json +++ b/lang/en.json @@ -322,7 +322,7 @@ "label.donate_to_empower_changemakers": "Donate to empower change-makers that are working hard to make a difference. Get GIVbacks when you donate to verified projects.", "label.donate_to_projects": "Donate to projects", "label.donate_to_this_project": "Donate to this project", - "label.donate_to_top_ranked_projects_and_get_more_giv_back": "Donate to top-ranked projects and get more GIV back!", + "label.donate_to_top_ranked_projects_and_get_more_giv_back": "Donate to top-ranked projects to maximize your GIVbacks", "label.donate_to_verified_projects": "donate to verified projects", "label.donate_to_verified_projects.desc": " Donate to verified projects and get rewarded with GIV", "label.donate_to_verified_projects_and_get_giv": "Donate to verified projects and get GIV - a token that grants you access to our community as a voting member, as well as opportunities to earn additional rewards.", @@ -399,7 +399,7 @@ "label.filters": "Filters", "label.find_awesome_projects_on_giveth": "Find awesome projects on Giveth", "label.finish": "Finish", - "label.fireup_your_community_to_use_givpower": "Fire up your community to use GIVpower to improve your rank.", + "label.fireup_your_community_to_use_givpower": "Ask your community to boost your project", "label.first_name": "First name", "label.flowrate_change": "Flowrate Change", "label.flow_rate": "Stream Rate", @@ -514,7 +514,7 @@ "label.home": "Home", "label.how?": "How?", "label.how_can_we_help_you": "How can we help you?", - "label.how_does_givpower_work": "How does GIVpower work?", + "label.how_does_givpower_work": "How does boosting work?", "label.how_does_this_work": "How does this work?", "label.how_do_you_want_to_donate": "How do you want to donate?", "label.how_it_works": "HOW IT WORKS", @@ -536,7 +536,7 @@ "label.if_you_wrap_for_one_month": "If you wrap for 1 month:", "label.ill_raise_and_receive_funds_on_all_chains": "I’ll raise & receive funds on Mainnet, Gnosis Chain, Polygon, Celo and Optimism networks with the same address.", "label.ill_receive_funds_on_this_address": "I’ll receive fund on this address", - "label.imagine_a_world_where": "Imagine a world where you could support public goods and get rewarded", + "label.imagine_a_world_where": "Discover decentralized project curation with GIVpower boosting", "label.impact": "Impact", "label.in": "in", "label.include_media_such_as_videos_and_photos_to_show_off_the_work": "Include media such as videos and photos to show off the work you’re doing.", @@ -1006,7 +1006,7 @@ "label.the_givers_are": "The Givers are a limited collection of 1,250 artworks inspired by the Giveth Galaxy. Each NFT tells a unique story of Giveth, in its own fun and vibrant style.", "label.the_givgarden_is_the_descentralized_gov_platform": "The GIVgarden is the decentralized governance platform for the GIVeconomy. Increase your GIVstream when you wrap GIV to vote.", "label.the_giv_garden_empowers_the_giv_community": "The GIVgarden empowers the Giveth community to coordinate around shared resources from the bottom up.", - "label.the_higher_your_rank_the_more_givback": "The higher your rank, the more GIVbacks your donors will receive.", + "label.the_higher_your_rank_the_more_givback": "The higher your rank, the better the GIVbacks rewards for donors.", "label.the_launch_of_the": "The launch of the", "label.the_longer_you_lock_the_greater_your_reward": "The longer you lock, the greater your rewards.", "label.the_min_apr_for_staked_not_locked_giv": "The minimum APR for staked (not locked) GIV. Lock your GIV to increase your rewards.", @@ -1054,7 +1054,7 @@ "label.tokens": "Tokens", "label.token_list": "Token List", "label.token_stream_rewards": "{rewardTokenSymbol} stream rewards", - "label.topranked_projects_will_eventually_get_funding": "Top-ranked projects will eventually get funding from the Giveth Matching Pool.", + "label.topranked_projects_will_eventually_get_funding": "Don't forget to boost your own project too!", "label.top_up_before": "Top-up before", "label.top_up_stream_balance": "Top-up stream balance", "label.top_up_your_stream_balance_within": "Top-up your Stream balance within", @@ -1100,7 +1100,7 @@ "label.user_your_givpower_to_support_verified_projects": "Use your GIVpower to support verified projects on Giveth while earning rewards.", "label.use_as_profile_picture": "Use as profile picture", "label.use_a_bank_transfer_or_credit_Card": "Use a bank transfer or credit card to purchase crypto and deposit it directly into your web3 wallet.", - "label.use_giv_to_boost_projects": "Use GIV to boost projects to new heights!", + "label.use_giv_to_boost_projects": "GIVpower is your Giveth governance power! Use it to boost projects or vote on Giveth DAO proposals.", "label.use_giv_to_vote": "Use GIV to vote on funding proposals in the GIVgarden.", "label.use_relevant_keywords_that_describe_your_project": "Use relevant keywords that describe your project.", "label.use_your_bank_account_or_credit_card_to_send_crypto_to_your_wallet": "Use your bank account or credit card to send crypto to your web3 wallet, then donate to support projects!", @@ -1163,7 +1163,7 @@ "label.why_dont_i_have_givbacks": "Why don't I have GIVbacks?", "label.why_giveth": "Why Giveth?", "label.will_be_unlisted_until": "will be 'unlisted' until reviewed by our team", - "label.winwin_for_givers_and_projects": "Win-win for GIVers & Projects", + "label.winwin_for_givers_and_projects": "Win-win for Givers & Projects", "label.withdraw": "Withdraw", "label.withdrawal_confirmed": "Withdrawal confirmed", "label.withdrawing": "Withdrawing", @@ -1709,4 +1709,4 @@ "label.devouch.if_you_are_eligible": "If you are an eligible Giveth Verifier you can vouch for this project's legitimacy, potentially increasing the benefits it receives on Giveth.", "label.devouch.learn_more_about_devouch": "Learn more about DeVouch & Decentralized Verification", "label.devouch.attest_on_devouch": "Attest on Devouch" -} \ No newline at end of file +} diff --git a/src/components/GIVeconomyPages/GIVpower.tsx b/src/components/GIVeconomyPages/GIVpower.tsx index d28e106e81..6fe30cb51e 100644 --- a/src/components/GIVeconomyPages/GIVpower.tsx +++ b/src/components/GIVeconomyPages/GIVpower.tsx @@ -22,9 +22,6 @@ import { GIVpowerTopContainer, Title, Subtitle, - LearnMoreButton, - HeadingSectionContainer, - HeadingTextContainer, FeaturesCardContainer, FeaturesCardHeading, FeaturesCardSubheading, @@ -62,7 +59,6 @@ import GivStake from '../../../public/images/giv_stake.svg'; import Routes from '@/lib/constants/Routes'; import config from '@/configuration'; import { formatWeiHelper } from '@/helpers/number'; -import links from '@/lib/constants/links'; import { getTotalGIVpower } from '@/helpers/givpower'; import { useGeneralWallet } from '@/providers/generalWalletProvider'; import { ChainType } from '@/types/config'; @@ -224,22 +220,6 @@ export function TabPowerBottom() { })}
- - - - {formatMessage({ - id: 'label.use_your_givpower_to_boost_verified_projects', - })} - - - - {formatMessage({ id: 'label.how_does_givpower_work' })} @@ -374,6 +354,7 @@ export function TabPowerBottom() { {formatMessage({ id: 'label.for_projects' })} +
{/* Adding a line break here */} {formatMessage({ diff --git a/src/components/GIVeconomyPages/GIVstream.tsx b/src/components/GIVeconomyPages/GIVstream.tsx index b775a7d4cd..7b20734b56 100644 --- a/src/components/GIVeconomyPages/GIVstream.tsx +++ b/src/components/GIVeconomyPages/GIVstream.tsx @@ -10,7 +10,6 @@ import { IconGIVStream, IconHelpFilled16, IconPraise24, - IconSpark, P, Container, Row, @@ -45,8 +44,6 @@ import { HistoryTitle, HistoryTitleRow, HistoryTooltip, - IncreaseSection, - IncreaseSectionTitle, NoData, PercentageRow, TxHash, @@ -66,7 +63,6 @@ import { ITokenAllocation } from '@/types/subgraph'; import { IconGIV } from '../Icons/GIV'; import { givEconomySupportedNetworks } from '@/lib/constants/constants'; import Pagination from '../Pagination'; -import GivEconomyProjectCards from '../cards/GivEconomyProjectCards'; import { SubgraphDataHelper } from '@/lib/subgraph/subgraphDataHelper'; export const TabGIVstreamTop = () => { @@ -291,15 +287,6 @@ export const TabGIVstreamBottom = () => {
- - - - {formatMessage({ id: 'label.increase_your_givstream' })} - - - - - ); }; From cd04f3af5173e78ddacbe394a0d2a86d03886e16 Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z Date: Tue, 17 Sep 2024 10:47:46 +0330 Subject: [PATCH 09/19] Change text of allocated GIV tokens so far related to https://github.com/Giveth/giveth-dapps-v2/issues/4679#issuecomment-2351300561 --- src/components/GIVeconomyPages/GIVbacks.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/GIVeconomyPages/GIVbacks.tsx b/src/components/GIVeconomyPages/GIVbacks.tsx index 3d9df06ddd..43603aab6d 100644 --- a/src/components/GIVeconomyPages/GIVbacks.tsx +++ b/src/components/GIVeconomyPages/GIVbacks.tsx @@ -163,7 +163,7 @@ export const TabGIVbacksBottom = () => { async function fetchAllocatedGivbacks() { const { data } = await client.query({ query: FETCH_ALLOCATED_GIVBACKS, - fetchPolicy: 'no-cache', + fetchPolicy: 'network-only', }); setGivbackAllocations(data?.allocatedGivbacks); } @@ -274,7 +274,7 @@ export const TabGIVbacksBottom = () => { {givbackAllocations && givbackAllocations.allocatedGivTokens ? `${givbackAllocations.allocatedGivTokens} GIV` - : '?'} + : 'TBD'} From c8078ba403f9185d6e49fc0ad0712cf64c8faac0 Mon Sep 17 00:00:00 2001 From: Ramin Date: Tue, 17 Sep 2024 11:16:42 +0330 Subject: [PATCH 10/19] donate page new design --- lang/ca.json | 2 +- lang/en.json | 2 +- lang/es.json | 2 +- public/images/logo/stellar.svg | 4 + .../views/donate/DonateToGiveth.tsx | 13 +- src/components/views/donate/DonationCard.tsx | 65 +++++++++- .../donate/OnTime/OneTimeDonationCard.tsx | 118 ++++++++++-------- .../Recurring/RecurringDonationCard.tsx | 10 +- 8 files changed, 148 insertions(+), 68 deletions(-) create mode 100644 public/images/logo/stellar.svg diff --git a/lang/ca.json b/lang/ca.json index 896d035358..6da6567a41 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -1238,7 +1238,7 @@ "page.project.we_are_supporting_stellar": "Aquest projecte admet donacions en Stellar", "page.project.you_can_try_donating": "Prova de fer donacions utilitzant la Xarxa Stellar.", "page.project.donate_with_stellar": "Dona amb Stellar", - "label.try_donating_wuth_stellar": "Prova de donar amb Stellar.", + "label.try_donating_with_stellar": "Prova de donar amb Stellar. No cal que connecteu la vostra cartera.", "label.check_donations": "Comprova les donacions", "label.check_donation": "Comprova la donació", "error.enter_amount": "La quantitat ha de ser superior a 0", diff --git a/lang/en.json b/lang/en.json index 2610fd80ab..dccd80e828 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1242,7 +1242,7 @@ "page.project.we_are_supporting_stellar": "This Project supports Donations on Stellar", "page.project.you_can_try_donating": "Try out making donations using the Stellar Network.", "page.project.donate_with_stellar": "Donate with Stellar", - "label.try_donating_wuth_stellar": "Try donating with Stellar.", + "label.try_donating_with_stellar": "Try donating with Stellar. You don’t need to connect your wallet.", "label.check_donations": "View Donation Receipt", "label.check_donation": "View Donation", "error.enter_amount": "Amount must be greater than 0", diff --git a/lang/es.json b/lang/es.json index bfc3da2b80..43b7f42f0b 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1237,7 +1237,7 @@ "page.project.we_are_supporting_stellar": "Este proyecto admite donaciones en Stellar", "page.project.you_can_try_donating": "Prueba a hacer donaciones usando la Red Stellar.", "page.project.donate_with_stellar": "Dona con Stellar", - "label.try_donating_wuth_stellar": "Intenta donar con Stellar.", + "label.try_donating_with_stellar": "Intenta donar con Stellar. No necesitas conectar tu billetera.", "label.check_donations": "Verificar donaciones", "label.check_donation": "Verificar donación", "error.enter_amount": "La cantidad debe ser mayor que 0", diff --git a/public/images/logo/stellar.svg b/public/images/logo/stellar.svg new file mode 100644 index 0000000000..36d82c0595 --- /dev/null +++ b/public/images/logo/stellar.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/components/views/donate/DonateToGiveth.tsx b/src/components/views/donate/DonateToGiveth.tsx index c055c8b132..84569dcf04 100644 --- a/src/components/views/donate/DonateToGiveth.tsx +++ b/src/components/views/donate/DonateToGiveth.tsx @@ -15,6 +15,8 @@ import { IconWithTooltip } from '@/components/IconWithToolTip'; import Input, { InputSize } from '@/components/Input'; import { InputSuffix } from '@/components/styled-components/Input'; import CheckBox from '@/components/Checkbox'; +import { useGeneralWallet } from '@/providers/generalWalletProvider'; +import { useDonateData } from '@/context/donate.context'; interface IDonateToGiveth { donationToGiveth: number; @@ -33,6 +35,10 @@ const DonateToGiveth: FC = ({ }) => { const { formatMessage } = useIntl(); + const { selectedOneTimeToken } = useDonateData(); + + const { isConnected } = useGeneralWallet(); + const handleChange = (e: ChangeEvent) => { const newPercentage = +e.target.value; if (isNaN(newPercentage) || newPercentage < 0 || newPercentage > 90) @@ -45,13 +51,13 @@ const DonateToGiveth: FC = ({ }; // If givethDonationAmount props provided check if it's 0 and set donationToGiveth to 0 - // because we disabled percetange amount for minimal allowed main donation amount + // because we disabled percentage amount for minimal allowed main donation amount if (givethDonationAmount !== undefined) { donationToGiveth = givethDonationAmount === 0 ? 0 : donationToGiveth; } return ( - + {title} } direction='top'> @@ -137,8 +143,9 @@ const Options = styled(Flex)` gap: 8px; `; -const Container = styled.div` +const Container = styled.div<{ disabled?: boolean }>` margin: 16px 0 13px; + opacity: ${props => (props.disabled ? 0.4 : 1)}; `; export default DonateToGiveth; diff --git a/src/components/views/donate/DonationCard.tsx b/src/components/views/donate/DonationCard.tsx index 9e526045e7..0948f30b4a 100644 --- a/src/components/views/donate/DonationCard.tsx +++ b/src/components/views/donate/DonationCard.tsx @@ -1,10 +1,18 @@ -import { B, P, neutralColors, Flex } from '@giveth/ui-design-system'; -import { FC, useState, useEffect } from 'react'; +import { + B, + P, + neutralColors, + Flex, + SublineBold, + brandColors, +} from '@giveth/ui-design-system'; +import React, { FC, useState, useEffect } from 'react'; import styled, { css } from 'styled-components'; import { useIntl } from 'react-intl'; import { useRouter } from 'next/router'; import { isAddress } from 'viem'; import { captureException } from '@sentry/nextjs'; +import Image from 'next/image'; import { Shadow } from '@/components/styled-components/Shadow'; import { RecurringDonationCard } from './Recurring/RecurringDonationCard'; import OneTimeDonationCard from './OnTime/OneTimeDonationCard'; @@ -66,6 +74,24 @@ export const DonationCard: FC = ({ const disableRecurringDonations = organization?.disableRecurringDonations; + const hasStellarAddress = addresses?.some( + address => address.chainType === ChainType.STELLAR, + ); + + const handleQRDonation = () => { + setIsQRDonation(true); + router.push( + { + query: { + ...router.query, + chain: ChainType.STELLAR.toLowerCase(), + }, + }, + undefined, + { shallow: true }, + ); + }; + useEffect(() => { client .query({ @@ -106,6 +132,19 @@ export const DonationCard: FC = ({ {!isQRDonation ? ( <> + {hasStellarAddress && ( + + stellar + {formatMessage({ + id: 'label.try_donating_with_stellar', + })} + + )} {formatMessage({ id: 'label.how_do_you_want_to_donate', @@ -180,7 +219,6 @@ export const DonationCard: FC<IDonationCardProps> = ({ <TabWrapper> {tab === ETabs.ONE_TIME && ( <OneTimeDonationCard - setIsQRDonation={setIsQRDonation} acceptedTokens={acceptedTokens} /> )} @@ -199,12 +237,28 @@ export const DonationCard: FC<IDonationCardProps> = ({ ); }; +const QRToastLink = styled(SublineBold)` + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + gap: 12px; + padding-block: 8px; + padding-left: 16px; + margin-block: 16px; + margin-top: 0; + background-color: transparent; + border: 1px solid ${neutralColors.gray[400]}; + color: ${brandColors.giv[500]} !important; + border-radius: 8px; + font-weight: 500 !important; +`; + export const DonationCardWrapper = styled(Flex)` flex-direction: column; gap: 16px; padding: 24px; border-radius: 16px; - align-items: flex-start; background: ${neutralColors.gray[100]}; box-shadow: ${Shadow.Neutral[400]}; align-items: stretch; @@ -212,7 +266,7 @@ export const DonationCardWrapper = styled(Flex)` `; const Title = styled(B)` - color: ${neutralColors.gray[800]}; + color: ${neutralColors.gray[800]} !important; text-align: left; `; @@ -230,6 +284,7 @@ interface ITab { } const Tab = styled(BaseTab)<ITab>` + font-weight: 500 !important; cursor: pointer; ${props => props.$selected && diff --git a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx index f977521755..d89af2921a 100644 --- a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx +++ b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx @@ -1,14 +1,15 @@ import styled from 'styled-components'; import React, { FC, useEffect, useMemo, useState } from 'react'; import { useIntl } from 'react-intl'; -import { useRouter } from 'next/router'; import { B, brandColors, Button, Flex, + FlexCenter, IconCaretDown16, IconRefresh16, + IconWalletOutline24, neutralColors, semanticColors, } from '@giveth/ui-design-system'; @@ -62,9 +63,8 @@ import { isWalletSanctioned } from '@/services/donation'; import SanctionModal from '@/components/modals/SanctionedModal'; const CryptoDonation: FC<{ - setIsQRDonation: (isQRDonation: boolean) => void; acceptedTokens: IProjectAcceptedToken[] | undefined; -}> = ({ acceptedTokens, setIsQRDonation }) => { +}> = ({ acceptedTokens }) => { const { chain, walletChainType, @@ -73,7 +73,6 @@ const CryptoDonation: FC<{ } = useGeneralWallet(); const { formatMessage } = useIntl(); - const router = useRouter(); const { isSignedIn } = useAppSelector(state => state.user); const { project, hasActiveQFRound, selectedOneTimeToken } = useDonateData(); @@ -145,9 +144,6 @@ const CryptoDonation: FC<{ const isOnEligibleNetworks = networkId && activeStartedRound?.eligibleNetworks?.includes(networkId); - const hasStellarAddress = addresses?.some( - address => address.chainType === ChainType.STELLAR, - ); useEffect(() => { validateSanctions(); @@ -300,20 +296,6 @@ const CryptoDonation: FC<{ selectedOneTimeToken?.address, ]); - const handleQRDonation = () => { - setIsQRDonation(true); - router.push( - { - query: { - ...router.query, - chain: ChainType.STELLAR.toLowerCase(), - }, - }, - undefined, - { shallow: true }, - ); - }; - useEffect(() => { if ( amount > selectedTokenBalance - gasfee && @@ -410,20 +392,27 @@ const CryptoDonation: FC<{ /> )} <SaveGasFees acceptedChains={acceptedChains} /> - {hasStellarAddress && ( - <QRToastLink onClick={handleQRDonation}> - {config.NETWORKS_CONFIG[ChainType.STELLAR]?.chainLogo(32)} + {!isConnected && ( + <ConnectWallet> + <IconWalletOutline24 color={neutralColors.gray[700]} /> {formatMessage({ - id: 'label.try_donating_wuth_stellar', + id: 'label.please_connect_your_wallet', })} - </QRToastLink> + </ConnectWallet> )} - <Flex $flexDirection='column' gap='8px'> + <FlexStyled + $flexDirection='column' + gap='8px' + disabled={!isConnected} + > <InputWrapper> <SelectTokenWrapper $alignItems='center' $justifyContent='space-between' - onClick={() => setShowSelectTokenModal(true)} + onClick={() => + isConnected && setShowSelectTokenModal(true) + } + disabled={!isConnected} > {selectedOneTimeToken ? ( <Flex gap='8px' $alignItems='center'> @@ -451,7 +440,11 @@ const CryptoDonation: FC<{ decimals={selectedOneTimeToken?.decimals} /> </InputWrapper> - <Flex gap='4px' $alignItems='center'> + <FlexStyled + gap='4px' + $alignItems='center' + disabled={!selectedOneTimeToken} + > <GLinkStyled size='Small' onClick={() => setAmount(selectedTokenBalance - gasfee)} @@ -480,18 +473,20 @@ const CryptoDonation: FC<{ {insufficientGasFee && ( <WarnError>{amountErrorText}</WarnError> )} - </Flex> - </Flex> + </FlexStyled> + </FlexStyled> {hasActiveQFRound && !isOnEligibleNetworks && walletChainType && ( <DonateQFEligibleNetworks /> )} - {hasActiveQFRound && isOnEligibleNetworks && ( - <EstimatedMatchingToast - projectData={project} - token={selectedOneTimeToken} - amount={amount} - /> - )} + {hasActiveQFRound && + isOnEligibleNetworks && + selectedTokenBalance && ( + <EstimatedMatchingToast + projectData={project} + token={selectedOneTimeToken} + amount={amount} + /> + )} {!noDonationSplit ? ( <DonateToGiveth setDonationToGiveth={setDonationToGiveth} @@ -554,12 +549,15 @@ const CryptoDonation: FC<{ checked={anonymous} onChange={() => setAnonymous(!anonymous)} size={14} + disabled={!isConnected || !selectedOneTimeToken} /> - <div> + <DonateAnonymously + disabled={!isConnected || !selectedOneTimeToken} + > {formatMessage({ id: 'component.tooltip.donate_anonymously', })} - </div> + </DonateAnonymously> </CheckBoxContainer> {showSelectTokenModal && ( <SelectTokenModal @@ -574,6 +572,32 @@ const CryptoDonation: FC<{ ); }; +const FlexStyled = styled(Flex)<{ disabled: boolean }>` + ${props => + props.disabled && + ` + opacity: 0.5; + pointer-events: none; + `} +`; + +const DonateAnonymously = styled.div<{ disabled: boolean }>` + color: ${props => + props.disabled ? neutralColors.gray[600] + ' !important' : 'inherit'}; +`; + +const ConnectWallet = styled(FlexCenter)` + background: ${neutralColors.gray[200]}; + color: ${neutralColors.gray[700]}; + border-radius: 8px; + gap: 8px; + border: 1px solid ${neutralColors.gray[400]}; + padding: 4px; + margin: 12px 0 24px; + font-size: 12px; + font-weight: 500; +`; + const WarnError = styled.div` color: ${semanticColors.punch[500]}; font-size: 11px; @@ -614,18 +638,4 @@ export const CheckBoxContainer = styled.div` } `; -const QRToastLink = styled(Flex)` - cursor: pointer; - align-items: center; - gap: 12px; - padding-block: 8px; - padding-left: 16px; - margin-block: 16px; - background-color: ${semanticColors.blueSky[100]}; - color: ${semanticColors.blueSky[700]}; - border-radius: 8px; - border: 1px solid ${semanticColors.blueSky[300]}; - font-weight: 500; -`; - export default CryptoDonation; diff --git a/src/components/views/donate/Recurring/RecurringDonationCard.tsx b/src/components/views/donate/Recurring/RecurringDonationCard.tsx index a98ae21d56..2821f8a036 100644 --- a/src/components/views/donate/Recurring/RecurringDonationCard.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationCard.tsx @@ -55,8 +55,9 @@ import { useModalCallback } from '@/hooks/useModalCallback'; import { useAppSelector } from '@/features/hooks'; import { findAnchorContractAddress } from '@/helpers/superfluid'; import GIVBackToast from '../GIVBackToast'; +import { useGeneralWallet } from '@/providers/generalWalletProvider'; -// These two functions are used to make the slider more user friendly by mapping the slider's value to a new range. +// These two functions are used to make the slider more user-friendly by mapping the slider's value to a new range. /** * The mapValue function takes a value from the slider (0 to 100) and maps it to a new range. * If the slider value is between 0 and 90, it maps it to a range of 0 to 50. @@ -115,6 +116,8 @@ export const RecurringDonationCard = () => { setShowAlloProtocolModal(true), ); + const { isConnected } = useGeneralWallet(); + const { data: balance, refetch, @@ -278,6 +281,7 @@ export const RecurringDonationCard = () => { $alignItems='center' $justifyContent='space-between' onClick={() => setShowSelectTokenModal(true)} + disabled={!isConnected} > {selectedRecurringToken ? ( <Flex gap='8px' $alignItems='center'> @@ -809,8 +813,8 @@ const RecurringSection = styled(Flex)` text-align: left; `; -export const SelectTokenWrapper = styled(Flex)` - cursor: pointer; +export const SelectTokenWrapper = styled(Flex)<{ disabled?: boolean }>` + cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')}; gap: 16px; `; From 6f91c80152446dd7b6133f9fdcb6e7cb0422caea Mon Sep 17 00:00:00 2001 From: Ramin <raminramazanpour@gmail.com> Date: Tue, 17 Sep 2024 11:33:47 +0330 Subject: [PATCH 11/19] fix eslint error --- src/components/views/donate/OnTime/OneTimeDonationCard.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx index 3128d14c53..695b5b7c06 100644 --- a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx +++ b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx @@ -146,9 +146,9 @@ const CryptoDonation: FC<{ const isOnEligibleNetworks = networkId && activeStartedRound?.eligibleNetworks?.includes(networkId); - const tokenPrice = useTokenPrice(selectedOneTimeToken); + const tokenPrice = useTokenPrice(selectedOneTimeToken); - useEffect(() => { + useEffect(() => { validateSanctions(); }, [project, address]); From 7bf5df37bcd9539656b457b6aa1a65bdd91755c8 Mon Sep 17 00:00:00 2001 From: Mohammad Ranjbar Z <mranjbar.z2993@gmail.com> Date: Tue, 17 Sep 2024 11:55:27 +0330 Subject: [PATCH 12/19] Remove title of giv power boosting --- src/components/GIVeconomyPages/GIVpower.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/components/GIVeconomyPages/GIVpower.tsx b/src/components/GIVeconomyPages/GIVpower.tsx index 6fe30cb51e..39fd6ca78c 100644 --- a/src/components/GIVeconomyPages/GIVpower.tsx +++ b/src/components/GIVeconomyPages/GIVpower.tsx @@ -1,7 +1,6 @@ import Image from 'next/image'; import { brandColors, - H3, H4, IconRocketInSpace32, QuoteText, @@ -214,12 +213,6 @@ export function TabPowerBottom() { return ( <> <GIVpowerContainer> - <H3 weight={700}> - {formatMessage({ - id: 'label.boost_projects_with_givpower', - })} - </H3> - <br /> <FeaturesCardContainer> <FeaturesCardHeading weight={700}> {formatMessage({ id: 'label.how_does_givpower_work' })} From 4bcffdd1dfe41cf3abe27af0acbbe0df43c95d13 Mon Sep 17 00:00:00 2001 From: Ramin <raminramazanpour@gmail.com> Date: Tue, 17 Sep 2024 13:22:50 +0330 Subject: [PATCH 13/19] change givback verified_owner copy --- lang/ca.json | 6 +-- lang/en.json | 6 +-- lang/es.json | 6 +-- lang/t_ca.json | 2 - lang/t_es.json | 2 - .../views/project/ProjectGIVbackToast.tsx | 52 ++++++------------- 6 files changed, 22 insertions(+), 52 deletions(-) diff --git a/lang/ca.json b/lang/ca.json index 6da6567a41..4756056703 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -1627,8 +1627,7 @@ "project.givback_toast.description.non_verified_owner_rejected_2": " o al suport de Discord per a més instruccions.", "project.givback_toast.description.non_verified_owner_submitted": "Notícies emocionants! La teva sol·licitud ha estat enviada i està a la cua per ser revisada pel nostre equip de revisió d'elegibilitat per a GIVbacks. Et respondrem en un termini d'1-2 setmanes.", "project.givback_toast.description.non_verified_public": "Actualment, els GIVbacks només s'atorguen per donacions fetes a projectes elegibles per a GIVbacks a Ethereum. La teva contribució segueix sent important, fins i tot si no genera GIVbacks!", - "project.givback_toast.description.verified_owner": "Impulsa el teu projecte per augmentar la quantitat de GIVbacks que reben els teus donants a Ethereum i augmentar la seva visibilitat entre altres projectes.", - "project.givback_toast.description.verified_owner.note": "Com a propietari d'aquest projecte, no rebràs GIVbacks per donar-hi.", + "project.givback_toast.description.verified_owner": "Potencia el teu projecte per augmentar el seu percentatge de GIVbacks i ajudar-lo a aparèixer més amunt a la pàgina de projectes!", "project.givback_toast.description.verified_public": "Les donacions a Ethereum a projectes elegibles per a GIVbacks són recompensades amb GIV. Impulsa aquest projecte per augmentar el seu percentatge de recompenses i fer-lo més visible a la pàgina de projectes!", "project.givback_toast.title.non_verified_owner": "El teu projecte està creant o donant suport a béns públics?", "project.givback_toast.title.non_verified_owner_cancelled": "Estat Cancel·lat", @@ -1638,8 +1637,7 @@ "project.givback_toast.title.non_verified_owner_rejected": "No vam poder verificar el teu projecte com a bé públic", "project.givback_toast.title.non_verified_owner_submitted": "Sol·licitud enviada", "project.givback_toast.title.non_verified_public": "Per què no hi ha GIVbacks?", - "project.givback_toast.title.verified_owner_1": "Els donants són recompensats amb fins a ", - "project.givback_toast.title.verified_owner_2": " del valor de la donació!", + "project.givback_toast.title.verified_owner": "Les donacions de {value}$ o més són elegibles per a reemborsaments de fins a un {percent}%!", "project.givback_toast.title.verified_public_1": "Rep recompenses de fins a ", "project.givback_toast.title.verified_public_2": " del valor de la teva donació!", "projects_all": "Tots els Projectes", diff --git a/lang/en.json b/lang/en.json index 5a70c907d8..1d05e41a79 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1632,8 +1632,7 @@ "project.givback_toast.description.non_verified_owner_rejected_2": " or Discord support for more instructions.", "project.givback_toast.description.non_verified_owner_submitted": "Exciting news! Your application has been submitted and is in the queue for review by our GIVbacks Eligibility review team. We will get back to you with a response within 1-2 weeks.", "project.givback_toast.description.non_verified_public": "GIVbacks are currently only awarded for donations made to GIVbacks Eligible projects on Ethereum. Your contribution still matters, even if it doesn't generate GIVbacks!", - "project.givback_toast.description.verified_owner": "Boost your project to increase the amount of GIVbacks your donors on Ethereum receive and increase its visibility among other projects!", - "project.givback_toast.description.verified_owner.note": "As the owner of this project, you won’t get GIVbacks for donating to it.", + "project.givback_toast.description.verified_owner": "Boost your project to increase its GIVbacks percentage and help it appear higher on the projects page!", "project.givback_toast.description.verified_public": "Ethereum donations to GIVbacks Eligible projects are rewarded with GIV. Boost this project to increase its rewards percentage and make it more visible on the projects page!", "project.givback_toast.title.non_verified_owner": "Is your project creating or supporting public goods?", "project.givback_toast.title.non_verified_owner_cancelled": "Project Cancelled", @@ -1643,8 +1642,7 @@ "project.givback_toast.title.non_verified_owner_rejected": "We couldn't verify your project as a public good", "project.givback_toast.title.non_verified_owner_submitted": "Application submitted", "project.givback_toast.title.non_verified_public": "Why no GIVbacks?", - "project.givback_toast.title.verified_owner_1": "Donors get rewarded with up to ", - "project.givback_toast.title.verified_owner_2": " of the donation value!", + "project.givback_toast.title.verified_owner": "Donations of ${value} or more qualify for GIVbacks with up to {percent}%!", "project.givback_toast.title.verified_public_1": "Get rewarded with up to ", "project.givback_toast.title.verified_public_2": " of your donation value!", "projects_all": "All Projects", diff --git a/lang/es.json b/lang/es.json index 43b7f42f0b..07499c878c 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1627,8 +1627,7 @@ "project.givback_toast.description.non_verified_owner_rejected_2": " o al soporte de Discord para más instrucciones.", "project.givback_toast.description.non_verified_owner_submitted": "¡Noticias emocionantes! Tu solicitud ha sido enviada y está en la cola para ser revisada por nuestro equipo de revisión de elegibilidad para GIVbacks. Te responderemos en un plazo de 1-2 semanas.", "project.givback_toast.description.non_verified_public": "Actualmente, los GIVbacks solo se otorgan por donaciones hechas a proyectos elegibles para GIVbacks en Ethereum. ¡Tu contribución sigue siendo importante, incluso si no genera GIVbacks!", - "project.givback_toast.description.verified_owner": "Impulsa tu proyecto para aumentar la cantidad de GIVbacks que reciben tus donantes en Ethereum y aumentar su visibilidad entre otros proyectos.", - "project.givback_toast.description.verified_owner.note": "Como propietario de este proyecto, no recibirás GIVbacks por donar a él.", + "project.givback_toast.description.verified_owner": "¡Impulsa tu proyecto para aumentar su porcentaje de GIVbacks y ayúdalo a aparecer más arriba en la página de proyectos!", "project.givback_toast.description.verified_public": "Las donaciones en Ethereum a proyectos elegibles para GIVbacks son recompensadas con GIV. ¡Impulsa este proyecto para aumentar su porcentaje de recompensas y hacerlo más visible en la página de proyectos!", "project.givback_toast.title.non_verified_owner": "¿Tu proyecto está creando o apoyando bienes públicos?", "project.givback_toast.title.non_verified_owner_cancelled": "Estado Cancelado", @@ -1638,8 +1637,7 @@ "project.givback_toast.title.non_verified_owner_rejected": "No pudimos verificar tu proyecto como un bien público", "project.givback_toast.title.non_verified_owner_submitted": "Solicitud enviada", "project.givback_toast.title.non_verified_public": "¿Por qué no GIVbacks?", - "project.givback_toast.title.verified_owner_1": "Los donantes reciben recompensas de hasta ", - "project.givback_toast.title.verified_owner_2": " del valor de la donación.", + "project.givback_toast.title.verified_owner": "¡Las donaciones de ${value} o más califican para GIVbacks con hasta un {percent}%!", "project.givback_toast.title.verified_public_1": "¡Recibe recompensas de hasta ", "project.givback_toast.title.verified_public_2": " del valor de tu donación!", "projects_all": "Todos los proyectos", diff --git a/lang/t_ca.json b/lang/t_ca.json index 035a6ceb9a..c20e5645dd 100644 --- a/lang/t_ca.json +++ b/lang/t_ca.json @@ -153,12 +153,10 @@ "project.givback_toast.description.non_verified_owner": "Pots demostrar que el teu projecte està proporcionant un bé públic? La verificació et dóna accés a una gran quantitat de beneficis com recompenses per a donants, major visibilitat i formes addicionals d'obtenir fons!", "project.givback_toast.description.non_verified_public": "Actualment, els GIVbacks només es concedeixen per donacions fetes a projectes verificats. La teva contribució encara és important, encara que no generi GIVbacks!", "project.givback_toast.description.verified_owner": "Impulsa el teu projecte per augmentar el seu percentatge de recompenses i fer-lo més visible a la pàgina de projectes!", - "project.givback_toast.description.verified_owner.note": "Com a propietari d'aquest projecte, no obtindràs GIV per donar-hi.", "project.givback_toast.description.verified_public": "Els donants de projectes verificats són recompensats amb GIV. Impulsa aquest projecte per augmentar el seu percentatge de recompenses i fer-lo més visible a la pàgina de projectes!", "project.givback_toast.title.non_verified_owner": "Porta el teu projecte al següent nivell amb la Verificació!", "project.givback_toast.title.non_verified_public": "Per què no hi ha GIVbacks?", "project.givback_toast.title.verified_owner_1": "Els donants són recompensats amb fins a ", - "project.givback_toast.title.verified_owner_2": " del valor de la donació!", "project.givback_toast.title.verified_public_1": "Obtén recompenses amb fins a ", "project.givback_toast.title.verified_public_2": " del valor de la teva donació!", "refi": "Refi", diff --git a/lang/t_es.json b/lang/t_es.json index ed8b276ea4..b0c5cec0e8 100644 --- a/lang/t_es.json +++ b/lang/t_es.json @@ -119,12 +119,10 @@ "project.givback_toast.description.non_verified_owner": "¿Puedes demostrar que tu proyecto está proporcionando un bien público? ¡La verificación te da acceso a una gran cantidad de beneficios como recompensas para los donantes, mayor visibilidad y formas adicionales de recaudar fondos!", "project.givback_toast.description.non_verified_public": "Los GIVbacks se otorgan actualmente solo por donaciones realizadas a proyectos verificados. ¡Tu contribución sigue siendo importante, incluso si no genera GIVbacks!", "project.givback_toast.description.verified_owner": "¡Impulsa tu proyecto para aumentar su porcentaje de recompensas y hacerlo más visible en la página de proyectos!", - "project.givback_toast.description.verified_owner.note": "Como propietario de este proyecto, no obtendrás GIV por donar a él.", "project.givback_toast.description.verified_public": "Los donantes a proyectos verificados son recompensados con GIV. ¡Impulsa este proyecto para aumentar su porcentaje de recompensas y hacerlo más visible en la página de proyectos!", "project.givback_toast.title.non_verified_owner": "¡Lleva tu proyecto al siguiente nivel con la Verificación!", "project.givback_toast.title.non_verified_public": "¿Por qué no hay GIVbacks?", "project.givback_toast.title.verified_owner_1": "Los donantes son recompensados con hasta ", - "project.givback_toast.title.verified_owner_2": " del valor de la donación!", "project.givback_toast.title.verified_public_1": "Obtén recompensas de hasta ", "project.givback_toast.title.verified_public_2": " del valor de tu donación!", "refi": "Refi", diff --git a/src/components/views/project/ProjectGIVbackToast.tsx b/src/components/views/project/ProjectGIVbackToast.tsx index d26439f290..5f6dafa0eb 100644 --- a/src/components/views/project/ProjectGIVbackToast.tsx +++ b/src/components/views/project/ProjectGIVbackToast.tsx @@ -1,3 +1,4 @@ +import * as process from 'node:process'; import styled from 'styled-components'; import { B, @@ -29,7 +30,6 @@ import { useModalCallback } from '@/hooks/useModalCallback'; import { isSSRMode } from '@/lib/helpers'; import BoostModal from '@/components/modals/Boost/BoostModal'; import { useAppSelector } from '@/features/hooks'; -import { formatDonation } from '@/helpers/number'; import { EProjectStatus } from '@/apollo/types/gqlEnums'; import { EVerificationStatus } from '@/apollo/types/types'; import Routes from '@/lib/constants/Routes'; @@ -49,7 +49,7 @@ const ProjectGIVbackToast = () => { const color = isOwnerVerified ? semanticColors.golden[600] : neutralColors.gray[900]; - const { formatMessage, locale } = useIntl(); + const { formatMessage } = useIntl(); const { open: openConnectModal } = useWeb3Modal(); const { isEnabled, @@ -84,22 +84,21 @@ const ProjectGIVbackToast = () => { let title = ''; let description, Button; + const givbackFactorPercent = ((givbackFactor || 0) * 100).toFixed(); + const NEXT_PUBLIC_GIVBACKS_DONATION_QUALIFICATION_VALUE_USD = + process.env.NEXT_PUBLIC_GIVBACKS_DONATION_QUALIFICATION_VALUE_USD; + if (isOwnerVerified) { if (givbackFactor !== 0) { - title = - formatMessage({ - id: `${useIntlTitle}verified_owner_1`, - }) + - formatDonation( - (givbackFactor || 0) * 100, - undefined, - locale, - true, - ) + - '%' + - formatMessage({ - id: `${useIntlTitle}verified_owner_2`, - }); + title = formatMessage( + { + id: `${useIntlTitle}verified_owner`, + }, + { + percent: givbackFactorPercent, + value: NEXT_PUBLIC_GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, + }, + ); } description = formatMessage({ id: `${useIntlDescription}verified_owner`, @@ -259,18 +258,6 @@ const ProjectGIVbackToast = () => { <div> <Title color={color}>{title} {description} - {isOwnerVerified && ( - - - {formatMessage({ - id: 'label.note', - }) + ' '} - - {formatMessage({ - id: 'project.givback_toast.description.verified_owner.note', - })} - - )} {link && ( @@ -296,17 +283,10 @@ const ProjectGIVbackToast = () => { ); }; -const Note = styled(P)` - color: ${neutralColors.gray[800]}; - > span { - font-weight: 500; - } -`; - const LearnMore = styled(Caption)` display: flex; gap: 2px; - color: ${brandColors.pinky[500]}; + color: ${brandColors.pinky[500]} !important; `; const Description = styled(P)` From c333566c3432bc6d3789d54bfba1eb423e3dba7d Mon Sep 17 00:00:00 2001 From: Ramin Date: Tue, 17 Sep 2024 13:34:44 +0330 Subject: [PATCH 14/19] add GIVBACKS_DONATION_QUALIFICATION_VALUE_USD constant --- src/components/views/project/ProjectGIVbackToast.tsx | 8 +++----- src/lib/constants/constants.ts | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/views/project/ProjectGIVbackToast.tsx b/src/components/views/project/ProjectGIVbackToast.tsx index 5f6dafa0eb..1e76c08eb2 100644 --- a/src/components/views/project/ProjectGIVbackToast.tsx +++ b/src/components/views/project/ProjectGIVbackToast.tsx @@ -1,4 +1,3 @@ -import * as process from 'node:process'; import styled from 'styled-components'; import { B, @@ -34,6 +33,7 @@ import { EProjectStatus } from '@/apollo/types/gqlEnums'; import { EVerificationStatus } from '@/apollo/types/types'; import Routes from '@/lib/constants/Routes'; import { VerificationModal } from '@/components/modals/VerificationModal'; +import { GIVBACKS_DONATION_QUALIFICATION_VALUE_USD } from '@/lib/constants/constants'; const ProjectGIVbackToast = () => { const [showBoost, setShowBoost] = useState(false); @@ -49,7 +49,7 @@ const ProjectGIVbackToast = () => { const color = isOwnerVerified ? semanticColors.golden[600] : neutralColors.gray[900]; - const { formatMessage } = useIntl(); + const { formatMessage, locale } = useIntl(); const { open: openConnectModal } = useWeb3Modal(); const { isEnabled, @@ -85,8 +85,6 @@ const ProjectGIVbackToast = () => { let description, Button; const givbackFactorPercent = ((givbackFactor || 0) * 100).toFixed(); - const NEXT_PUBLIC_GIVBACKS_DONATION_QUALIFICATION_VALUE_USD = - process.env.NEXT_PUBLIC_GIVBACKS_DONATION_QUALIFICATION_VALUE_USD; if (isOwnerVerified) { if (givbackFactor !== 0) { @@ -96,7 +94,7 @@ const ProjectGIVbackToast = () => { }, { percent: givbackFactorPercent, - value: NEXT_PUBLIC_GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, + value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, }, ); } diff --git a/src/lib/constants/constants.ts b/src/lib/constants/constants.ts index 01a09b637b..788408a55e 100644 --- a/src/lib/constants/constants.ts +++ b/src/lib/constants/constants.ts @@ -125,3 +125,5 @@ export const WeiPerEther = 1e18; export const PROFILE_PHOTO_PLACEHOLDER = '/images/placeholders/profile.svg'; export const solanaNativeAddress = '11111111111111111111111111111111'; + +export const GIVBACKS_DONATION_QUALIFICATION_VALUE_USD = 5; From 70fe9f305ff67aed73a6fe3cfdce37353176a479 Mon Sep 17 00:00:00 2001 From: Ramin Date: Tue, 17 Sep 2024 13:51:30 +0330 Subject: [PATCH 15/19] update verified_public givback copy --- lang/ca.json | 2 +- lang/en.json | 2 +- lang/es.json | 2 +- .../views/project/ProjectGIVbackToast.tsx | 15 ++++++++++----- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lang/ca.json b/lang/ca.json index 4756056703..5badef90a1 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -1628,7 +1628,7 @@ "project.givback_toast.description.non_verified_owner_submitted": "Notícies emocionants! La teva sol·licitud ha estat enviada i està a la cua per ser revisada pel nostre equip de revisió d'elegibilitat per a GIVbacks. Et respondrem en un termini d'1-2 setmanes.", "project.givback_toast.description.non_verified_public": "Actualment, els GIVbacks només s'atorguen per donacions fetes a projectes elegibles per a GIVbacks a Ethereum. La teva contribució segueix sent important, fins i tot si no genera GIVbacks!", "project.givback_toast.description.verified_owner": "Potencia el teu projecte per augmentar el seu percentatge de GIVbacks i ajudar-lo a aparèixer més amunt a la pàgina de projectes!", - "project.givback_toast.description.verified_public": "Les donacions a Ethereum a projectes elegibles per a GIVbacks són recompensades amb GIV. Impulsa aquest projecte per augmentar el seu percentatge de recompenses i fer-lo més visible a la pàgina de projectes!", + "project.givback_toast.description.verified_public": "Les donacions de ${value} o més són elegibles per a GIVback. Potencia aquest projecte per augmentar el seu percentatge de recompenses i la seva visibilitat a la pàgina de projectes!", "project.givback_toast.title.non_verified_owner": "El teu projecte està creant o donant suport a béns públics?", "project.givback_toast.title.non_verified_owner_cancelled": "Estat Cancel·lat", "project.givback_toast.title.non_verified_owner_deactive": "Mode Desactivat", diff --git a/lang/en.json b/lang/en.json index 1d05e41a79..03278c539f 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1633,7 +1633,7 @@ "project.givback_toast.description.non_verified_owner_submitted": "Exciting news! Your application has been submitted and is in the queue for review by our GIVbacks Eligibility review team. We will get back to you with a response within 1-2 weeks.", "project.givback_toast.description.non_verified_public": "GIVbacks are currently only awarded for donations made to GIVbacks Eligible projects on Ethereum. Your contribution still matters, even if it doesn't generate GIVbacks!", "project.givback_toast.description.verified_owner": "Boost your project to increase its GIVbacks percentage and help it appear higher on the projects page!", - "project.givback_toast.description.verified_public": "Ethereum donations to GIVbacks Eligible projects are rewarded with GIV. Boost this project to increase its rewards percentage and make it more visible on the projects page!", + "project.givback_toast.description.verified_public": "Donations of ${value} or more are eligible for GIVbacks. Boost this project to increase its rewards percentage and visibility on the projects page!", "project.givback_toast.title.non_verified_owner": "Is your project creating or supporting public goods?", "project.givback_toast.title.non_verified_owner_cancelled": "Project Cancelled", "project.givback_toast.title.non_verified_owner_deactive": "Project Deactivated", diff --git a/lang/es.json b/lang/es.json index 07499c878c..8a2375011b 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1628,7 +1628,7 @@ "project.givback_toast.description.non_verified_owner_submitted": "¡Noticias emocionantes! Tu solicitud ha sido enviada y está en la cola para ser revisada por nuestro equipo de revisión de elegibilidad para GIVbacks. Te responderemos en un plazo de 1-2 semanas.", "project.givback_toast.description.non_verified_public": "Actualmente, los GIVbacks solo se otorgan por donaciones hechas a proyectos elegibles para GIVbacks en Ethereum. ¡Tu contribución sigue siendo importante, incluso si no genera GIVbacks!", "project.givback_toast.description.verified_owner": "¡Impulsa tu proyecto para aumentar su porcentaje de GIVbacks y ayúdalo a aparecer más arriba en la página de proyectos!", - "project.givback_toast.description.verified_public": "Las donaciones en Ethereum a proyectos elegibles para GIVbacks son recompensadas con GIV. ¡Impulsa este proyecto para aumentar su porcentaje de recompensas y hacerlo más visible en la página de proyectos!", + "project.givback_toast.description.verified_public": "Las donaciones de ${value} o más son elegibles para recibir GIVbacks. ¡Impulsa este proyecto para aumentar su porcentaje de recompensas y su visibilidad en la página de proyectos!", "project.givback_toast.title.non_verified_owner": "¿Tu proyecto está creando o apoyando bienes públicos?", "project.givback_toast.title.non_verified_owner_cancelled": "Estado Cancelado", "project.givback_toast.title.non_verified_owner_deactive": "Modo Desactivado", diff --git a/src/components/views/project/ProjectGIVbackToast.tsx b/src/components/views/project/ProjectGIVbackToast.tsx index 1e76c08eb2..8e040876b9 100644 --- a/src/components/views/project/ProjectGIVbackToast.tsx +++ b/src/components/views/project/ProjectGIVbackToast.tsx @@ -49,7 +49,7 @@ const ProjectGIVbackToast = () => { const color = isOwnerVerified ? semanticColors.golden[600] : neutralColors.gray[900]; - const { formatMessage, locale } = useIntl(); + const { formatMessage } = useIntl(); const { open: openConnectModal } = useWeb3Modal(); const { isEnabled, @@ -220,9 +220,14 @@ const ProjectGIVbackToast = () => { id: `${useIntlTitle}verified_public_2`, }); } - description = formatMessage({ - id: `${useIntlDescription}verified_public`, - }); + description = formatMessage( + { + id: `${useIntlDescription}verified_public`, + }, + { + value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, + }, + ); Button = ( Date: Tue, 17 Sep 2024 15:36:50 +0330 Subject: [PATCH 16/19] Fix WALLET_ADDRESS_IS_VALID query params --- src/apollo/gql/gqlProjects.ts | 2 +- src/components/GIVeconomyPages/GIVpower.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apollo/gql/gqlProjects.ts b/src/apollo/gql/gqlProjects.ts index 2b59212024..3704ad2ce0 100644 --- a/src/apollo/gql/gqlProjects.ts +++ b/src/apollo/gql/gqlProjects.ts @@ -493,7 +493,7 @@ export const UPLOAD_IMAGE = gql` export const WALLET_ADDRESS_IS_VALID = gql` query WalletAddressIsValid( $address: String! - $chainType: String + $chainType: ChainType $memo: String ) { walletAddressIsValid( diff --git a/src/components/GIVeconomyPages/GIVpower.tsx b/src/components/GIVeconomyPages/GIVpower.tsx index 39fd6ca78c..9d1720f2cc 100644 --- a/src/components/GIVeconomyPages/GIVpower.tsx +++ b/src/components/GIVeconomyPages/GIVpower.tsx @@ -315,6 +315,7 @@ export function TabPowerBottom() { {formatMessage({ id: 'label.for_givers' })} +
{/* Adding a line break here */} From d99b7947eda1925a5590fd412864ceea4611fcab Mon Sep 17 00:00:00 2001 From: Ramin Date: Tue, 17 Sep 2024 15:46:22 +0330 Subject: [PATCH 17/19] add min givbacks badge --- lang/ca.json | 2 + lang/en.json | 2 + lang/es.json | 2 + package.json | 2 +- .../donate/OnTime/OneTimeDonationCard.tsx | 64 ++++++++++++++++--- .../views/project/ProjectGIVbackToast.tsx | 2 +- yarn.lock | 8 +-- 7 files changed, 67 insertions(+), 15 deletions(-) diff --git a/lang/ca.json b/lang/ca.json index 5badef90a1..777c9f3694 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -1345,6 +1345,8 @@ "page.donate.passport_toast.title.non_eligible": "No et perdis l'emparellament!", "page.donate.title": "Donar", "page.donate.zero_fees": "Sense Comissions", + "page.donate.donate_$_to_be_eligible": "Fes una donació de ${value} per ser elegible per a GIVbacks", + "page.donate.donate_$_to_get_matched": "Dona ${value} per igualar la teva donació", "page.engage.discord.desc": "Uneix-te a la conversa! Discord és on el nostre equip es comunica. Presenta't, dóna'ns comentaris, descobreix com contribuir o simplement saluda!", "page.engage.discourse.desc": "El fòrum de Giveth és on creem discursos sobre propostes noves i existents. Compartim idees sobre desenvolupament i governança, cultivant discussions sobre temes importants al voltant del nostre equip i la comunitat.", "page.engage.github.desc": "Tens habilitats de desenvolupament? Comprova el nostre Github! Sempre benvingut a nous col·laboradors. Si us plau, uneix-te a un dels nostres canals de dev a Discord per saludar-nos!", diff --git a/lang/en.json b/lang/en.json index 03278c539f..3b95d87036 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1350,6 +1350,8 @@ "page.donate.passport_toast.title.non_eligible": "Don’t miss out on matching!", "page.donate.title": "Donate", "page.donate.zero_fees": "Zero Fees", + "page.donate.donate_$_to_be_eligible": "Donate ${value} to be eligible for GIVbacks", + "page.donate.donate_$_to_get_matched": "Donate ${value} to get your donation matched", "page.engage.discord.desc": "Join the conversation! Discord is where our team communicates. Introduce yourself, give us feedback, find out how to contribute or just say hello!", "page.engage.discourse.desc": "The Giveth forum is where we create discourse around new and existing proposals. We share ideas involving development and governance, cultivating discussions about important topics around our team and community.", "page.engage.github.desc": "Got some developer skills? Check out our Github! We always welcome new contributors. Please also join one of our dev channels in Discord to say hello!", diff --git a/lang/es.json b/lang/es.json index 8a2375011b..a27a04a20b 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1345,6 +1345,8 @@ "page.donate.passport_toast.title.non_eligible": "¡No te pierdas la oportunidad!", "page.donate.title": "Donar", "page.donate.zero_fees": "Sin Comisiones", + "page.donate.donate_$_to_be_eligible": "Dona ${value} para ser elegible para GIVbacks", + "page.donate.donate_$_to_get_matched": "Dona ${value} para que tu donación sea igualada", "page.engage.discord.desc": "¡Únete a la conversación! Nuestro equipo se comunica en Discord. Preséntate, danos retroalimentación, descubre cómo contribuir o ¡sólo saluda!", "page.engage.discourse.desc": "El foro de Giveth es donde creamos debates alrededor de propuestas existentes y nuevas. Compartimos ideas sobre el desarrollo y la gobernanza, desarrollando debates sobre temas importantes en torno a nuestro equipo y comunidad.", "page.engage.github.desc": "¿Sabes de desarrollo? ¡Entra a nuestro Github! Las puertas siempre están abiertas para nuevos colaboradores. ¡También te invitamos a unirte a nuestro canal de devs en Discord!", diff --git a/package.json b/package.json index 304acf1ae4..bf592bb43e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@apollo/client": "^3.10.4", - "@giveth/ui-design-system": "^1.11.34", + "@giveth/ui-design-system": "^1.11.35", "@next/third-parties": "^14.2.5", "@react-google-maps/api": "^2.19.3", "@reduxjs/toolkit": "^2.2.4", diff --git a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx index 695b5b7c06..b6238dcdfe 100644 --- a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx +++ b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx @@ -8,6 +8,8 @@ import { Flex, FlexCenter, IconCaretDown16, + IconGIVBack24, + IconQFNew, IconRefresh16, IconWalletOutline24, neutralColors, @@ -62,6 +64,7 @@ import { useSolanaBalance } from '@/hooks/useSolanaBalance'; import { isWalletSanctioned } from '@/services/donation'; import SanctionModal from '@/components/modals/SanctionedModal'; import { useTokenPrice } from '@/hooks/useTokenPrice'; +import { GIVBACKS_DONATION_QUALIFICATION_VALUE_USD } from '@/lib/constants/constants'; const CryptoDonation: FC<{ acceptedTokens: IProjectAcceptedToken[] | undefined; @@ -408,6 +411,32 @@ const CryptoDonation: FC<{ })} )} + {isConnected && ( + + + + {formatMessage( + { + id: 'page.donate.donate_$_to_get_matched', + }, + { + value: activeStartedRound?.minimumValidUsdValue, + }, + )} + + + + {formatMessage( + { + id: 'page.donate.donate_$_to_be_eligible', + }, + { + value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, + }, + )} + + + )} div { + height: 36px; + } +`; + +const GivbacksEligibilityBadge = styled(BadgesBase)``; + +const QFEligibilityBadge = styled(BadgesBase)``; + const FlexStyled = styled(Flex)<{ disabled: boolean }>` ${props => props.disabled && @@ -594,16 +648,8 @@ const DonateAnonymously = styled.div<{ disabled: boolean }>` props.disabled ? neutralColors.gray[600] + ' !important' : 'inherit'}; `; -const ConnectWallet = styled(FlexCenter)` - background: ${neutralColors.gray[200]}; - color: ${neutralColors.gray[700]}; - border-radius: 8px; - gap: 8px; - border: 1px solid ${neutralColors.gray[400]}; - padding: 4px; +const ConnectWallet = styled(BadgesBase)` margin: 12px 0 24px; - font-size: 12px; - font-weight: 500; `; const WarnError = styled.div` diff --git a/src/components/views/project/ProjectGIVbackToast.tsx b/src/components/views/project/ProjectGIVbackToast.tsx index 8e040876b9..721eb2a3a1 100644 --- a/src/components/views/project/ProjectGIVbackToast.tsx +++ b/src/components/views/project/ProjectGIVbackToast.tsx @@ -310,7 +310,7 @@ const ButtonWrapper = styled.div` flex-direction: row-reverse; color: ${brandColors.giv[500]}; gap: 0; - width: 180px; + min-width: 180px; svg { margin-right: 8px; flex-shrink: 0; diff --git a/yarn.lock b/yarn.lock index 14e51e8bbd..d090716860 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1329,10 +1329,10 @@ "@solana/wallet-adapter-base" "^0.9.17" bs58 "^5.0.0" -"@giveth/ui-design-system@^1.11.34": - version "1.11.34" - resolved "https://registry.npmjs.org/@giveth/ui-design-system/-/ui-design-system-1.11.34.tgz" - integrity sha512-gt28LwEcZ7KBIkqonCkiPkVLNBfxyq/3YDfFQTl8V0zqW3RzfOvIAex4XV10DTu+wJUiizN1AiQSy6h5CJgVgw== +"@giveth/ui-design-system@^1.11.35": + version "1.11.35" + resolved "https://registry.yarnpkg.com/@giveth/ui-design-system/-/ui-design-system-1.11.35.tgz#4b00527656bedbbb1db7c071d7e7e88390b930e5" + integrity sha512-kMPRNR476KUEA9aCJ9PTQiKz5Q+xTgwrHvrNB1prFE10/gfx5efdvutLW76GcPgarjPgQQ0UhthvYaifPP7bFA== dependencies: next "14.1.0" react "^18" From 768d37f94ce9f3ba54fcd10abd0fd27496edc942 Mon Sep 17 00:00:00 2001 From: Ramin Date: Tue, 17 Sep 2024 16:49:25 +0330 Subject: [PATCH 18/19] add min givbacks badge active color --- lang/ca.json | 2 + lang/en.json | 2 + lang/es.json | 2 + .../donate/OnTime/EstimatedMatchingToast.tsx | 5 +- .../donate/OnTime/OneTimeDonationCard.tsx | 66 ++++++++++++++----- 5 files changed, 57 insertions(+), 20 deletions(-) diff --git a/lang/ca.json b/lang/ca.json index 777c9f3694..23e72f6c78 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -1347,6 +1347,8 @@ "page.donate.zero_fees": "Sense Comissions", "page.donate.donate_$_to_be_eligible": "Fes una donació de ${value} per ser elegible per a GIVbacks", "page.donate.donate_$_to_get_matched": "Dona ${value} per igualar la teva donació", + "page.donate.donations_will_be_matched": "La donació serà igualada", + "page.donate.givbacks_eligible": "GIVbacks elegibles", "page.engage.discord.desc": "Uneix-te a la conversa! Discord és on el nostre equip es comunica. Presenta't, dóna'ns comentaris, descobreix com contribuir o simplement saluda!", "page.engage.discourse.desc": "El fòrum de Giveth és on creem discursos sobre propostes noves i existents. Compartim idees sobre desenvolupament i governança, cultivant discussions sobre temes importants al voltant del nostre equip i la comunitat.", "page.engage.github.desc": "Tens habilitats de desenvolupament? Comprova el nostre Github! Sempre benvingut a nous col·laboradors. Si us plau, uneix-te a un dels nostres canals de dev a Discord per saludar-nos!", diff --git a/lang/en.json b/lang/en.json index 3b95d87036..85ff94c8bd 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1352,6 +1352,8 @@ "page.donate.zero_fees": "Zero Fees", "page.donate.donate_$_to_be_eligible": "Donate ${value} to be eligible for GIVbacks", "page.donate.donate_$_to_get_matched": "Donate ${value} to get your donation matched", + "page.donate.donations_will_be_matched": "Donation will be matched", + "page.donate.givbacks_eligible": "GIVbacks eligible", "page.engage.discord.desc": "Join the conversation! Discord is where our team communicates. Introduce yourself, give us feedback, find out how to contribute or just say hello!", "page.engage.discourse.desc": "The Giveth forum is where we create discourse around new and existing proposals. We share ideas involving development and governance, cultivating discussions about important topics around our team and community.", "page.engage.github.desc": "Got some developer skills? Check out our Github! We always welcome new contributors. Please also join one of our dev channels in Discord to say hello!", diff --git a/lang/es.json b/lang/es.json index a27a04a20b..40b132b67e 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1347,6 +1347,8 @@ "page.donate.zero_fees": "Sin Comisiones", "page.donate.donate_$_to_be_eligible": "Dona ${value} para ser elegible para GIVbacks", "page.donate.donate_$_to_get_matched": "Dona ${value} para que tu donación sea igualada", + "page.donate.donations_will_be_matched": "La donación será igualada", + "page.donate.givbacks_eligible": "Elegibles para GIVbacks", "page.engage.discord.desc": "¡Únete a la conversación! Nuestro equipo se comunica en Discord. Preséntate, danos retroalimentación, descubre cómo contribuir o ¡sólo saluda!", "page.engage.discourse.desc": "El foro de Giveth es donde creamos debates alrededor de propuestas existentes y nuevas. Compartimos ideas sobre el desarrollo y la gobernanza, desarrollando debates sobre temas importantes en torno a nuestro equipo y comunidad.", "page.engage.github.desc": "¿Sabes de desarrollo? ¡Entra a nuestro Github! Las puertas siempre están abiertas para nuevos colaboradores. ¡También te invitamos a unirte a nuestro canal de devs en Discord!", diff --git a/src/components/views/donate/OnTime/EstimatedMatchingToast.tsx b/src/components/views/donate/OnTime/EstimatedMatchingToast.tsx index 6c39277075..3b62dec1cf 100644 --- a/src/components/views/donate/OnTime/EstimatedMatchingToast.tsx +++ b/src/components/views/donate/OnTime/EstimatedMatchingToast.tsx @@ -21,7 +21,6 @@ import { getActiveRound, } from '@/helpers/qf'; import { IProjectAcceptedToken } from '@/apollo/types/gqlTypes'; -import { useTokenPrice } from '@/hooks/useTokenPrice'; import { formatDonation } from '@/helpers/number'; import { formatBalance, truncateToDecimalPlaces } from '@/lib/helpers'; @@ -29,20 +28,20 @@ interface IEstimatedMatchingToast { projectData: IProject; amount: bigint; token?: IProjectAcceptedToken; + tokenPrice?: number; } const EstimatedMatchingToast: React.FC = ({ projectData, token, amount, + tokenPrice, }) => { const { formatMessage, locale } = useIntl(); const { estimatedMatching, qfRounds } = projectData || {}; const { allProjectsSum, matchingPool, projectDonationsSqrtRootSum } = estimatedMatching || {}; - const tokenPrice = useTokenPrice(token); - const { activeStartedRound } = getActiveRound(qfRounds); const { allocatedFundUSDPreferred, diff --git a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx index b6238dcdfe..410548b0d1 100644 --- a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx +++ b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx @@ -12,12 +12,14 @@ import { IconQFNew, IconRefresh16, IconWalletOutline24, + mediaQueries, neutralColors, semanticColors, } from '@giveth/ui-design-system'; // @ts-ignore import { Address, Chain, formatUnits, zeroAddress } from 'viem'; import { useBalance, useEstimateFeesPerGas, useEstimateGas } from 'wagmi'; +import { ethers } from 'ethers'; import { setShowWelcomeModal } from '@/features/modal/modal.slice'; import CheckBox from '@/components/Checkbox'; @@ -352,6 +354,16 @@ const CryptoDonation: FC<{ selectedOneTimeToken?.decimals ?? 18, ); + const donationUsdValue = + (tokenPrice || 0) * Number(ethers.utils.formatEther(amount)); + + const isDonationMatched = + !!activeStartedRound && + donationUsdValue >= (activeStartedRound?.minimumValidUsdValue || 0); + + const isGiveBacksEligible = + donationUsdValue >= GIVBACKS_DONATION_QUALIFICATION_VALUE_USD; + return ( {isSanctioned && ( @@ -413,22 +425,34 @@ const CryptoDonation: FC<{ )} {isConnected && ( - - - {formatMessage( - { - id: 'page.donate.donate_$_to_get_matched', - }, - { - value: activeStartedRound?.minimumValidUsdValue, - }, - )} - - - + {activeStartedRound && ( + + + {formatMessage( + { + id: isDonationMatched + ? 'page.donate.donations_will_be_matched' + : 'page.donate.donate_$_to_get_matched', + }, + { + value: activeStartedRound?.minimumValidUsdValue, + }, + )} + + )} + + {formatMessage( { - id: 'page.donate.donate_$_to_be_eligible', + id: isGiveBacksEligible + ? 'page.donate.givbacks_eligible' + : 'page.donate.donate_$_to_be_eligible', }, { value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, @@ -522,6 +546,7 @@ const CryptoDonation: FC<{ projectData={project} token={selectedOneTimeToken} amount={amount} + tokenPrice={tokenPrice} /> )} {!noDonationSplit ? ( @@ -609,14 +634,17 @@ const CryptoDonation: FC<{ ); }; -const BadgesBase = styled(FlexCenter)` +const BadgesBase = styled(FlexCenter)<{ active?: boolean }>` gap: 8px; font-size: 12px; font-weight: 500; background: ${neutralColors.gray[200]}; - color: ${neutralColors.gray[700]}; + color: ${props => + props.active ? semanticColors.jade[500] : neutralColors.gray[700]}; border-radius: 8px; - border: 1px solid ${neutralColors.gray[400]}; + border: 1px solid + ${props => + props.active ? semanticColors.jade[400] : neutralColors.gray[400]}; padding: 4px; `; @@ -628,6 +656,10 @@ const EligibilityBadgeWrapper = styled(Flex)` > div { height: 36px; } + ${mediaQueries.tablet} { + flex-direction: row; + justify-content: flex-start; + } `; const GivbacksEligibilityBadge = styled(BadgesBase)``; From 90872b05010d67486ef543944acf7874c6ed2c2f Mon Sep 17 00:00:00 2001 From: Ramin Date: Tue, 17 Sep 2024 17:31:29 +0330 Subject: [PATCH 19/19] add givbacks badge conditions --- lang/ca.json | 2 + lang/en.json | 2 + lang/es.json | 2 + .../donate/OnTime/OneTimeDonationCard.tsx | 37 ++++++++++++------- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/lang/ca.json b/lang/ca.json index 23e72f6c78..7063a4dd13 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -1349,6 +1349,8 @@ "page.donate.donate_$_to_get_matched": "Dona ${value} per igualar la teva donació", "page.donate.donations_will_be_matched": "La donació serà igualada", "page.donate.givbacks_eligible": "GIVbacks elegibles", + "page.donate.project_not_givbacks_eligible": "El projecte no és elegible per a GIVbacks", + "page.donate.token_not_givbacks_eligible": "{token} no és apte per a GIVbacks", "page.engage.discord.desc": "Uneix-te a la conversa! Discord és on el nostre equip es comunica. Presenta't, dóna'ns comentaris, descobreix com contribuir o simplement saluda!", "page.engage.discourse.desc": "El fòrum de Giveth és on creem discursos sobre propostes noves i existents. Compartim idees sobre desenvolupament i governança, cultivant discussions sobre temes importants al voltant del nostre equip i la comunitat.", "page.engage.github.desc": "Tens habilitats de desenvolupament? Comprova el nostre Github! Sempre benvingut a nous col·laboradors. Si us plau, uneix-te a un dels nostres canals de dev a Discord per saludar-nos!", diff --git a/lang/en.json b/lang/en.json index 85ff94c8bd..8b2ecee34c 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1354,6 +1354,8 @@ "page.donate.donate_$_to_get_matched": "Donate ${value} to get your donation matched", "page.donate.donations_will_be_matched": "Donation will be matched", "page.donate.givbacks_eligible": "GIVbacks eligible", + "page.donate.project_not_givbacks_eligible": "Project is not GIVbacks eligible", + "page.donate.token_not_givbacks_eligible": "{token} is not eligible for GIVbacks", "page.engage.discord.desc": "Join the conversation! Discord is where our team communicates. Introduce yourself, give us feedback, find out how to contribute or just say hello!", "page.engage.discourse.desc": "The Giveth forum is where we create discourse around new and existing proposals. We share ideas involving development and governance, cultivating discussions about important topics around our team and community.", "page.engage.github.desc": "Got some developer skills? Check out our Github! We always welcome new contributors. Please also join one of our dev channels in Discord to say hello!", diff --git a/lang/es.json b/lang/es.json index 40b132b67e..029ab115e3 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1349,6 +1349,8 @@ "page.donate.donate_$_to_get_matched": "Dona ${value} para que tu donación sea igualada", "page.donate.donations_will_be_matched": "La donación será igualada", "page.donate.givbacks_eligible": "Elegibles para GIVbacks", + "page.donate.project_not_givbacks_eligible": "El proyecto no es elegible para GIVbacks", + "page.donate.token_not_givbacks_eligible": "{token} no es elegible para GIVbacks", "page.engage.discord.desc": "¡Únete a la conversación! Nuestro equipo se comunica en Discord. Preséntate, danos retroalimentación, descubre cómo contribuir o ¡sólo saluda!", "page.engage.discourse.desc": "El foro de Giveth es donde creamos debates alrededor de propuestas existentes y nuevas. Compartimos ideas sobre el desarrollo y la gobernanza, desarrollando debates sobre temas importantes en torno a nuestro equipo y comunidad.", "page.engage.github.desc": "¿Sabes de desarrollo? ¡Entra a nuestro Github! Las puertas siempre están abiertas para nuevos colaboradores. ¡También te invitamos a unirte a nuestro canal de devs en Discord!", diff --git a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx index 410548b0d1..0f8bb1443e 100644 --- a/src/components/views/donate/OnTime/OneTimeDonationCard.tsx +++ b/src/components/views/donate/OnTime/OneTimeDonationCard.tsx @@ -144,11 +144,10 @@ const CryptoDonation: FC<{ }); const tokenDecimals = selectedOneTimeToken?.decimals || 18; - const projectIsGivBackEligible = !!verified; const { activeStartedRound } = getActiveRound(project.qfRounds); const networkId = (chain as Chain)?.id; - const isOnEligibleNetworks = + const isOnQFEligibleNetworks = networkId && activeStartedRound?.eligibleNetworks?.includes(networkId); const tokenPrice = useTokenPrice(selectedOneTimeToken); @@ -253,7 +252,7 @@ const CryptoDonation: FC<{ } if ( hasActiveQFRound && - !isOnEligibleNetworks && + !isOnQFEligibleNetworks && selectedOneTimeToken?.chainType === ChainType.EVM ) { setShowQFModal(true); @@ -361,7 +360,11 @@ const CryptoDonation: FC<{ !!activeStartedRound && donationUsdValue >= (activeStartedRound?.minimumValidUsdValue || 0); - const isGiveBacksEligible = + const isTokenGivbacksEligible = selectedOneTimeToken?.isGivbackEligible; + const isProjectGivbacksEligible = !!verified; + const isGivbacksEligible = + isTokenGivbacksEligible && + isProjectGivbacksEligible && donationUsdValue >= GIVBACKS_DONATION_QUALIFICATION_VALUE_USD; return ( @@ -401,7 +404,7 @@ const CryptoDonation: FC<{ givethDonationAmount={givethDonationAmount} anonymous={anonymous} givBackEligible={ - projectIsGivBackEligible && + isProjectGivbacksEligible && selectedOneTimeToken.isGivbackEligible && tokenPrice !== undefined && tokenPrice * projectDonationAmount >= 4 @@ -425,7 +428,7 @@ const CryptoDonation: FC<{ )} {isConnected && ( - {activeStartedRound && ( + {activeStartedRound && isOnQFEligibleNetworks && ( {formatMessage( @@ -440,22 +443,28 @@ const CryptoDonation: FC<{ )} )} - + {formatMessage( { - id: isGiveBacksEligible + id: isGivbacksEligible ? 'page.donate.givbacks_eligible' - : 'page.donate.donate_$_to_be_eligible', + : !isProjectGivbacksEligible + ? 'page.donate.project_not_givbacks_eligible' + : selectedOneTimeToken && + !isTokenGivbacksEligible + ? 'page.donate.token_not_givbacks_eligible' + : 'page.donate.donate_$_to_be_eligible', }, { value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, + token: selectedOneTimeToken?.symbol, }, )} @@ -536,11 +545,11 @@ const CryptoDonation: FC<{ )} - {hasActiveQFRound && !isOnEligibleNetworks && walletChainType && ( + {hasActiveQFRound && !isOnQFEligibleNetworks && walletChainType && ( )} {hasActiveQFRound && - isOnEligibleNetworks && + isOnQFEligibleNetworks && selectedTokenBalance && ( )} {!noDonationSplit ? (