From d9870553ea40f6e02167d9f30e25499857668071 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 30 Jan 2025 14:10:34 +0100 Subject: [PATCH 1/2] Remove estimated matching from staging --- src/apollo/gql/gqlProjects.ts | 9 --- src/apollo/types/types.ts | 7 -- src/components/modals/HarvestAll.sc.tsx | 2 +- src/components/project-card/ProjectCard.tsx | 41 ------------ .../donate/DonatePageProjectDescription.tsx | 3 - .../donate/OneTime/EstimatedMatchingToast.tsx | 36 ---------- .../project/projectActionCard/QFSection.tsx | 65 +------------------ .../projectDonations/ProjectTotalFundCard.tsx | 33 ---------- src/helpers/qf.ts | 9 +-- 9 files changed, 5 insertions(+), 200 deletions(-) diff --git a/src/apollo/gql/gqlProjects.ts b/src/apollo/gql/gqlProjects.ts index 60da212836..edcf834f83 100644 --- a/src/apollo/gql/gqlProjects.ts +++ b/src/apollo/gql/gqlProjects.ts @@ -20,8 +20,6 @@ export const PROJECT_CORE_FIELDS = gql` allocatedTokenSymbol allocatedFundUSDPreferred allocatedFundUSD - qfStrategy - clusterMatchingSyncAt } } `; @@ -53,7 +51,6 @@ export const PROJECT_CARD_FIELDS = gql` projectDonationsSqrtRootSum allProjectsSum matchingPool - matching } anchorContracts { address @@ -183,7 +180,6 @@ export const FETCH_PROJECT_BY_SLUG_DONATION = gql` projectDonationsSqrtRootSum allProjectsSum matchingPool - matching } qfRounds { id @@ -197,8 +193,6 @@ export const FETCH_PROJECT_BY_SLUG_DONATION = gql` allocatedFundUSDPreferred allocatedFundUSD minimumValidUsdValue - qfStrategy - clusterMatchingSyncAt } anchorContracts { address @@ -282,7 +276,6 @@ export const FETCH_PROJECT_BY_SLUG_SINGLE_PROJECT = gql` projectDonationsSqrtRootSum allProjectsSum matchingPool - matching } qfRounds { id @@ -295,8 +288,6 @@ export const FETCH_PROJECT_BY_SLUG_SINGLE_PROJECT = gql` allocatedTokenSymbol allocatedFundUSDPreferred allocatedFundUSD - qfStrategy - clusterMatchingSyncAt } campaigns { id diff --git a/src/apollo/types/types.ts b/src/apollo/types/types.ts index bd407312ad..17e036a35e 100644 --- a/src/apollo/types/types.ts +++ b/src/apollo/types/types.ts @@ -489,11 +489,6 @@ export interface IUsersPFPTokens { [key: string]: IGiverPFPToken[]; } -export enum QfStrategyEnum { - Cocm = 'Cocm', - Regular = 'Regular', -} - export interface IQFRound { slug: string; id: string; @@ -515,8 +510,6 @@ export interface IQFRound { allocatedTokenChainId: number; minimumValidUsdValue?: number; minMBDScore: number; - qfStrategy: QfStrategyEnum; - clusterMatchingSyncAt: string; } export interface IArchivedQFRound extends IQFRound { diff --git a/src/components/modals/HarvestAll.sc.tsx b/src/components/modals/HarvestAll.sc.tsx index 371648d099..ca9faa94b5 100644 --- a/src/components/modals/HarvestAll.sc.tsx +++ b/src/components/modals/HarvestAll.sc.tsx @@ -87,7 +87,7 @@ export const HarvestAllPending = styled(Pending)` export const TooltipContent = styled(Subline)` ${mediaQueries.tablet} { - width: 250px; + width: 200px; text-align: left; } `; diff --git a/src/components/project-card/ProjectCard.tsx b/src/components/project-card/ProjectCard.tsx index 43468eb0ec..b30c4a12fa 100644 --- a/src/components/project-card/ProjectCard.tsx +++ b/src/components/project-card/ProjectCard.tsx @@ -1,6 +1,5 @@ import { useEffect, useState } from 'react'; import styled from 'styled-components'; -import Image from 'next/image'; import { P, H6, @@ -37,7 +36,6 @@ import { TooltipContent } from '@/components/modals/HarvestAll.sc'; import { IconWithTooltip } from '@/components/IconWithToolTip'; import { FETCH_RECURRING_DONATIONS_BY_DATE } from '@/apollo/gql/gqlProjects'; import { client } from '@/apollo/apolloClient'; -import { calculateQFTimeDifferences } from '@/helpers/time'; const cardRadius = '12px'; const imgHeight = '226px'; @@ -107,14 +105,8 @@ const ProjectCard = (props: IProjectCard) => { allocatedFundUSDPreferred, allocatedFundUSD, allocatedTokenSymbol, - qfStrategy, - clusterMatchingSyncAt, } = activeQFRound || {}; - const clusterMatchingSyncAtDiff = calculateQFTimeDifferences( - clusterMatchingSyncAt || '', - ); - const projectLink = slugToProjectView(slug); const donateLink = slugToProjectDonate(slug); @@ -312,8 +304,6 @@ const ProjectCard = (props: IProjectCard) => { ? allocatedFundUSD : matchingPool, activeStartedRound?.maximumReward, - matching, - qfStrategy, ), allocatedFundUSDPreferred ? '$' : '', locale, @@ -337,24 +327,6 @@ const ProjectCard = (props: IProjectCard) => { {formatMessage({ id: 'component.qf-section.tooltip_polygon', })} - - score - {formatMessage( - { - id: 'component.qf-section.estimated_time', - }, - { - time: clusterMatchingSyncAtDiff, - }, - )} - @@ -618,17 +590,4 @@ const QFBadge = styled(Subline)` align-items: center; `; -const ToolTipBellow = styled.div` - display: flex; - align-items: center; - justify-content: flex-start; - border-top: 1px solid #121848; - margin: 7px 0; - padding: 7px 0 0 0; - line-height: 16px; - & img { - margin: 0 6px 0 0; - } -`; - export default ProjectCard; diff --git a/src/components/views/donate/DonatePageProjectDescription.tsx b/src/components/views/donate/DonatePageProjectDescription.tsx index 154b159e51..80cdc100d5 100644 --- a/src/components/views/donate/DonatePageProjectDescription.tsx +++ b/src/components/views/donate/DonatePageProjectDescription.tsx @@ -76,7 +76,6 @@ export const DonatePageProjectDescription: FC< allocatedFundUSDPreferred, allocatedFundUSD, allocatedTokenSymbol, - qfStrategy, } = activeQFRound || {}; return ( @@ -152,8 +151,6 @@ export const DonatePageProjectDescription: FC< ? allocatedFundUSD : matchingPool, activeStartedRound?.maximumReward, - matching, - qfStrategy, ), allocatedFundUSDPreferred ? '$' : '', locale, diff --git a/src/components/views/donate/OneTime/EstimatedMatchingToast.tsx b/src/components/views/donate/OneTime/EstimatedMatchingToast.tsx index 5a84ba2e4a..a373d30627 100644 --- a/src/components/views/donate/OneTime/EstimatedMatchingToast.tsx +++ b/src/components/views/donate/OneTime/EstimatedMatchingToast.tsx @@ -1,5 +1,4 @@ import styled from 'styled-components'; -import Image from 'next/image'; import { B, Caption, @@ -21,7 +20,6 @@ import { import { IProjectAcceptedToken } from '@/apollo/types/gqlTypes'; import { formatDonation } from '@/helpers/number'; import { truncateToDecimalPlaces } from '@/lib/helpers'; -import { calculateQFTimeDifferences } from '@/helpers/time'; interface IEstimatedMatchingToast { projectData: IProject; @@ -52,13 +50,8 @@ const EstimatedMatchingToast: FC = ({ allocatedFundUSD, allocatedTokenSymbol, maximumReward, - clusterMatchingSyncAt, } = activeStartedRound || {}; - const clusterMatchingSyncAtDiff = calculateQFTimeDifferences( - clusterMatchingSyncAt || '', - ); - const decimals = isStellar ? 18 : token?.decimals || 18; const amountInUsd = (tokenPrice || 0) * @@ -94,22 +87,6 @@ const EstimatedMatchingToast: FC = ({ {formatMessage({ id: 'component.qf-section.tooltip_polygon', })} - - score - {formatMessage( - { - id: 'component.qf-section.estimated_time', - }, - { - time: clusterMatchingSyncAtDiff, - }, - )} - @@ -130,17 +107,4 @@ const Wrapper = styled.div<{ show?: boolean }>` opacity: ${({ show }) => (show ? 1 : 0)}; `; -const ToolTipBellow = styled.div` - display: flex; - align-items: center; - justify-content: flex-start; - border-top: 1px solid #121848; - margin: 7px 0; - padding: 7px 0 0 0; - line-height: 16px; - & img { - margin: 0 6px 0 0; - } -`; - export default EstimatedMatchingToast; diff --git a/src/components/views/project/projectActionCard/QFSection.tsx b/src/components/views/project/projectActionCard/QFSection.tsx index 09e19a99a4..6b70e0c7df 100644 --- a/src/components/views/project/projectActionCard/QFSection.tsx +++ b/src/components/views/project/projectActionCard/QFSection.tsx @@ -15,7 +15,6 @@ import { } from '@giveth/ui-design-system'; import { useIntl } from 'react-intl'; import styled from 'styled-components'; -import Image from 'next/image'; import { type FC } from 'react'; import { useRouter } from 'next/router'; import Link from 'next/link'; @@ -36,7 +35,6 @@ import { ProjectCardUserName } from '@/components/project-card/ProjectCardUserNa import { CustomH5 } from '@/components/setProfilePic/SetProfilePic'; import { ORGANIZATION } from '@/lib/constants/organizations'; import { slugToProjectView } from '@/lib/routeCreators'; -import { calculateQFTimeDifferences } from '@/helpers/time'; interface IQFSectionProps { projectData?: IProject; @@ -58,32 +56,21 @@ const QFSection: FC = ({ projectData }) => { const router = useRouter(); const isOnDonatePage = router.pathname.includes('/donate'); - const { - projectDonationsSqrtRootSum, - matchingPool, - allProjectsSum, - matching, - } = estimatedMatching ?? {}; + const { projectDonationsSqrtRootSum, matchingPool, allProjectsSum } = + estimatedMatching ?? {}; const { activeStartedRound } = getActiveRound(qfRounds); const { allocatedFundUSD, allocatedTokenSymbol, allocatedFundUSDPreferred, - clusterMatchingSyncAt, - qfStrategy, } = activeStartedRound || {}; + const totalEstimatedMatching = calculateTotalEstimatedMatching( projectDonationsSqrtRootSum, allProjectsSum, allocatedFundUSDPreferred ? allocatedFundUSD : matchingPool, activeStartedRound?.maximumReward, - matching, - qfStrategy, - ); - - const clusterMatchingSyncAtDiff = calculateQFTimeDifferences( - clusterMatchingSyncAt || '', ); const projectLink = slugToProjectView(slug!); @@ -118,22 +105,6 @@ const QFSection: FC = ({ projectData }) => { {formatMessage({ id: 'component.qf-section.tooltip_polygon', })} - - score - {formatMessage( - { - id: 'component.qf-section.estimated_time', - }, - { - time: clusterMatchingSyncAtDiff, - }, - )} - @@ -291,16 +262,6 @@ const QFSection: FC = ({ projectData }) => { | Next update in: 3 min */} - - {formatMessage( - { - id: 'label.last_updated_ago', - }, - { - time: clusterMatchingSyncAtDiff, - }, - )} - { allocatedFundUSDPreferred, allocatedFundUSD, allocatedTokenSymbol, - clusterMatchingSyncAt, } = selectedQF || {}; - const clusterMatchingSyncAtDiff = calculateQFTimeDifferences( - clusterMatchingSyncAt || '', - ); - const selectedQFData = qfRounds?.find(round => round.id === selectedQF?.id); const notDistributedFund = @@ -126,8 +120,6 @@ const ProjectTotalFundCard = ({ selectedQF }: IProjectTotalFundCardProps) => { allProjectsSum, allocatedFundUSDPreferred ? allocatedFundUSD : matchingPool, selectedQF.maximumReward, - projectData?.estimatedMatching.matching, - selectedQF.qfStrategy, ) : qfRoundHistory ? qfRoundHistory.matchingFund !== null @@ -138,8 +130,6 @@ const ProjectTotalFundCard = ({ selectedQF }: IProjectTotalFundCardProps) => { qfRoundHistory.estimatedMatching.allProjectsSum, qfRoundHistory.estimatedMatching.matchingPool, selectedQF.maximumReward, - projectData?.estimatedMatching.matching, - selectedQF.qfStrategy, ) : 0 : 0; @@ -247,16 +237,6 @@ const ProjectTotalFundCard = ({ selectedQF }: IProjectTotalFundCardProps) => { ? 'Estimated Matching' : 'Matching Funds'} - - {formatMessage( - { - id: 'label.last_updated_ago', - }, - { - time: clusterMatchingSyncAtDiff, - }, - )} - {qfRoundHistory?.distributedFundTxHash && @@ -371,10 +351,8 @@ const EstimatedMatchingTransaction = styled.div` `; const EstimatedMatchingPrice = styled(H5)` - align-self: center; color: ${semanticColors.jade[600]}; font-weight: 700; - line-height: 1.1; `; const EstimatedMatchingText = styled(SublineBold)` @@ -423,15 +401,4 @@ const BlockExplorerLink = styled(GLink)` } `; -const LastUpdate = styled.div` - width: 100%; - margin-top: 8px; - font-size: 12px; - line-height: 18px; - color: ${neutralColors.gray[700]}; - padding: 8px 0px 0px; - border-top: 1px solid rgba(0, 0, 0, 0.08); - align-self: stretch; -`; - export default ProjectTotalFundCard; diff --git a/src/helpers/qf.ts b/src/helpers/qf.ts index 4ce5b40ca6..f858e1b3de 100644 --- a/src/helpers/qf.ts +++ b/src/helpers/qf.ts @@ -1,4 +1,4 @@ -import { IQFRound, QfStrategyEnum } from '@/apollo/types/types'; +import { IQFRound } from '@/apollo/types/types'; import { getNowUnixMS } from './time'; // import { formatDonation } from '@/helpers/number'; @@ -32,8 +32,6 @@ export const calculateTotalEstimatedMatching = ( allProjectsSum?: number, matchingPool?: number, matchingCapPercentage?: number, - matching: number = 0, - qfStrategy?: string, ) => { if ( !matchingCapPercentage || @@ -43,11 +41,6 @@ export const calculateTotalEstimatedMatching = ( ) return 0; - // For al new round return "matching" value - if (qfStrategy && qfStrategy === QfStrategyEnum.Cocm) { - return matching; - } - const result = Math.min( (Math.pow(projectDonationsSqrtRootSum, 2) / allProjectsSum) * matchingPool, From 3f5d5688d3b8de1ff9a64eb7581f7663fb6a9d44 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 30 Jan 2025 14:12:11 +0100 Subject: [PATCH 2/2] remove matching from rounds --- src/apollo/gql/gqlDonations.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/apollo/gql/gqlDonations.ts b/src/apollo/gql/gqlDonations.ts index 24fea60bf7..9be80cbc75 100644 --- a/src/apollo/gql/gqlDonations.ts +++ b/src/apollo/gql/gqlDonations.ts @@ -170,7 +170,6 @@ export const FETCH_QF_ROUND_HISTORY = gql` projectDonationsSqrtRootSum allProjectsSum matchingPool - matching } } }