From 2bcbfe0f90530e006f29467b8a701145d3c73ec3 Mon Sep 17 00:00:00 2001 From: Kilter Date: Fri, 27 Sep 2024 11:47:24 -0500 Subject: [PATCH] final touches on logic mess --- lang/ca.json | 7 +-- lang/en.json | 8 +-- lang/es.json | 8 +-- src/components/VerificationBadge.tsx | 9 ++- .../views/project/ProjectBadges.tsx | 16 ++++- .../views/project/ProjectGIVbackToast.tsx | 59 ++++++++++--------- .../projectActionCard/ProjectStats.tsx | 2 +- .../userProfile/projectsTab/ProjectItem.tsx | 2 +- 8 files changed, 62 insertions(+), 49 deletions(-) diff --git a/lang/ca.json b/lang/ca.json index e02fb9fb8f..e1c8506fe6 100644 --- a/lang/ca.json +++ b/lang/ca.json @@ -1661,12 +1661,11 @@ "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": "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 de ${value} o més són elegibles per a GIVbacks. Impulsa aquest projecte per augmentar el seu percentatge de recompenses i visibilitat a la pàgina de projectes!", + "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.description.verified_public_not_eligible": "{stakeLock} els teus tokens GIV per obtenir GIVpower. Impulsa aquest projecte per fer-lo més visible a la pàgina de projectes. Nota: Tot i que aquest projecte és elegible per ser impulsat amb GIVpower, no generarà GIVbacks per als seus donants.", "project.givback_toast.description.verified_owner_not_eligible": "El teu projecte ha estat avalat pels Verificadors de Giveth i ara pot beneficiar-se de GIVpower. Fes stake i bloqueja els teus tokens GIV per impulsar aquest projecte i fer-lo més visible a la pàgina de projectes. No obstant això, donar a aquest projecte no generarà GIVbacks per als donants.", - "project.givback_toast.title.non_verified_owner_cancelled": "Estat Cancel·lat", + "project.givback_toast.title.non_verified_owner_cancelled": "Estat Cancel·lat", "project.givback_toast.title.non_verified_owner_deactive": "Mode Desactivat", "project.givback_toast.title.non_verified_owner_draft": "Publica el teu projecte avui!", "project.givback_toast.title.non_verified_owner_incomplete": "Sol·licitud Incompleta", diff --git a/lang/en.json b/lang/en.json index 94823bb508..558fd0e87d 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1661,11 +1661,11 @@ "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_not_eligible": "Your project has been vouched for by Giveth Verifiers and can now benefit from GIVpower! {stakeLock} to get GIVpower and boost this project's position on the projects page! Note: This project can be boosted, but does not yield GIVbacks.", - "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.description.verified_public_not_eligible": "{stakeLock} to get GIVpower and boost this project's position on the projects page! Note: This project can be boosted, but does not yield GIVbacks.", - "project.givback_toast.title.non_verified_owner": "Is your project creating or supporting public goods?", "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": "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.description.verified_owner_not_eligible": "Your project has been vouched for by Giveth Verifiers and can now benefit from GIVpower! Stake and lock your GIV tokens to boost this project and make it more visible on the projects page. However, donating to this project won't yield GIVbacks to donors.", + "project.givback_toast.title.non_verified_owner": "Is your project creating or supporting public goods?", + "project.givback_toast.description.verified_public_not_eligible": "{stakeLock} your GIV tokens to get GIVpower. Boost this project make it more visible on the projects page! Note that while this project is eligible to be boosted with GIVpower, it will not yield GIVbacks to it's donors.", "project.givback_toast.title.non_verified_owner_cancelled": "Project Cancelled", "project.givback_toast.title.non_verified_owner_deactive": "Project Deactivated", "project.givback_toast.title.non_verified_owner_draft": "Publish your project today!", diff --git a/lang/es.json b/lang/es.json index ba3f463fba..e05839517b 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1661,11 +1661,11 @@ "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_not_eligible": "Tu proyecto ha sido avalado por los Verificadores de Giveth y ahora puede beneficiarse de GIVpower. {stakeLock} para obtener GIVpower y mejorar la posición de este proyecto en la página de proyectos. Nota: Este proyecto puede ser impulsado, pero no genera GIVbacks.", - "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.description.verified_public_not_eligible": "{stakeLock} para obtener GIVpower y mejorar la posición de este proyecto en la página de proyectos. Nota: Este proyecto puede ser impulsado, pero 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_not_eligible": "Tu proyecto ha sido avalado por los Verificadores de Giveth y ahora puede beneficiarse de GIVpower. Haz stake y bloquea tus tokens GIV para impulsar este proyecto y hacerlo más visible en la página de proyectos. Sin embargo, donar a este proyecto no generará GIVbacks para los donantes.", + "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.description.verified_public_not_eligible": "{stakeLock} tus GIV tokens para obtener GIVpower. ¡Impulsa este proyecto para hacerlo más visible en la página de proyectos! Ten en cuenta que aunque este proyecto es elegible para ser impulsado con GIVpower, no generará GIVbacks para sus donantes.", "project.givback_toast.title.non_verified_owner": "¿Tu proyecto está creando o apoyando bienes públicos?", - "project.givback_toast.description.verified_owner": "Impulsa tu proyecto para aumentar su porcentaje de GIVbacks y ayudarlo a aparecer más alto en la página de proyectos.", "project.givback_toast.title.non_verified_owner_cancelled": "Estado Cancelado", "project.givback_toast.title.non_verified_owner_deactive": "Modo Desactivado", "project.givback_toast.title.non_verified_owner_draft": "¡Publica tu proyecto hoy!", diff --git a/src/components/VerificationBadge.tsx b/src/components/VerificationBadge.tsx index 3a1d001596..b741d8701c 100644 --- a/src/components/VerificationBadge.tsx +++ b/src/components/VerificationBadge.tsx @@ -3,12 +3,15 @@ import { EVerificationStatus } from '@/apollo/types/types'; import { Badge, EBadgeStatus } from './Badge'; interface IProps { - isVerified?: boolean; + isGivbackEligible?: boolean; verificationStatus?: EVerificationStatus; } -const VerificationBadge: FC = ({ isVerified, verificationStatus }) => { - const verStatus = isVerified +const VerificationBadge: FC = ({ + isGivbackEligible, + verificationStatus, +}) => { + const verStatus = isGivbackEligible ? EVerificationStatus.VERIFIED : verificationStatus !== EVerificationStatus.VERIFIED ? verificationStatus diff --git a/src/components/views/project/ProjectBadges.tsx b/src/components/views/project/ProjectBadges.tsx index 7b31bcbf35..bd2ff72ef5 100644 --- a/src/components/views/project/ProjectBadges.tsx +++ b/src/components/views/project/ProjectBadges.tsx @@ -17,12 +17,22 @@ import { IconWithTooltip } from '@/components/IconWithToolTip'; const ProjectBadges = () => { const { projectData } = useProjectContext(); - const { verified, isGivbackEligible, qfRounds, campaigns } = - projectData || {}; + const { + verified: projectVerified, + isGivbackEligible, + qfRounds, + campaigns, + } = projectData || {}; const { formatMessage } = useIntl(); const isQF = hasActiveRound(qfRounds); + const verified = projectVerified || isGivbackEligible; - if (!verified && !isQF && (!campaigns || campaigns.length === 0)) { + if ( + !verified && + !isGivbackEligible && + !isQF && + (!campaigns || campaigns.length === 0) + ) { return null; } diff --git a/src/components/views/project/ProjectGIVbackToast.tsx b/src/components/views/project/ProjectGIVbackToast.tsx index c4cfb73587..678fd567d7 100644 --- a/src/components/views/project/ProjectGIVbackToast.tsx +++ b/src/components/views/project/ProjectGIVbackToast.tsx @@ -45,7 +45,7 @@ const ProjectGIVbackToast = () => { const isGivbackEligible = projectData?.isGivbackEligible; const { givbackFactor } = projectData || {}; const isOwnerGivbackEligible = isGivbackEligible && isAdmin; - const isOwnerNotVerified = !isVerified && isAdmin; + const isOwnerNotVerified = !isGivbackEligible && isAdmin; const isPublicGivbackEligible = isGivbackEligible && !isAdmin; const isPublicVerifiedNotEligible = isVerified && !isAdmin && !isGivbackEligible; @@ -92,7 +92,35 @@ const ProjectGIVbackToast = () => { const givbackFactorPercent = ((givbackFactor || 0) * 100).toFixed(); - if (isOwnerGivbackEligible) { + if (isPublicGivbackEligible) { + if (givbackFactor !== 0) { + title = formatMessage( + { + id: `${useIntlTitle}verified_public_3`, + }, + { + percent: givbackFactorPercent, + // value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, + }, + ); + } + description = formatMessage( + { + id: `${useIntlDescription}verified_public`, + }, + { + value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, + }, + ); + link = links.GIVPOWER_DOC; + Button = ( + } + /> + ); + } else if (isOwnerGivbackEligible) { if (givbackFactor !== 0) { title = formatMessage( { @@ -262,33 +290,6 @@ const ProjectGIVbackToast = () => { icon={} /> ); - } else if (isPublicGivbackEligible) { - if (givbackFactor !== 0) { - title = - formatMessage({ - id: `${useIntlTitle}verified_public_1`, - }) + - Math.round(+(givbackFactor || 0) * 100) + - '%' + - formatMessage({ - id: `${useIntlTitle}verified_public_2`, - }); - } - description = formatMessage( - { - id: `${useIntlDescription}verified_public`, - }, - { - value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD, - }, - ); - Button = ( - } - /> - ); } else { title = formatMessage({ id: `${useIntlTitle}non_verified_public`, diff --git a/src/components/views/project/projectActionCard/ProjectStats.tsx b/src/components/views/project/projectActionCard/ProjectStats.tsx index 1ceb6644e2..bbdd203fad 100644 --- a/src/components/views/project/projectActionCard/ProjectStats.tsx +++ b/src/components/views/project/projectActionCard/ProjectStats.tsx @@ -68,7 +68,7 @@ export const ProjectStats = () => { diff --git a/src/components/views/userProfile/projectsTab/ProjectItem.tsx b/src/components/views/userProfile/projectsTab/ProjectItem.tsx index 81881a6280..48dddbae82 100644 --- a/src/components/views/userProfile/projectsTab/ProjectItem.tsx +++ b/src/components/views/userProfile/projectsTab/ProjectItem.tsx @@ -92,7 +92,7 @@ const ProjectItem: FC = props => {