Skip to content

Commit

Permalink
Merge pull request #4881 from Giveth/feat/allow_boost_own_project
Browse files Browse the repository at this point in the history
Fixing notification condition
  • Loading branch information
kkatusic authored Nov 28, 2024
2 parents 0083fd3 + b400190 commit 511b7f9
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 28 deletions.
1 change: 1 addition & 0 deletions lang/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@
"label.verified_status_for": "Elegibilitat per a GIVbacks per a",
"label.verify_email_address": "Verificar correu electrònic",
"label.verify_your_project": "Formulari d'Elegibilitat per a GIVbacks",
"label.resume_your_project": "Reprèn el formulari de GIVbacks",
"label.verify_your_project.modal.four": "requereix alguna informació addicional sobre el teu projecte i l'impacte previst de la teva organització.",
"label.verify_your_project.modal.one": "El programa GIVbacks és un concepte revolucionari que recompensa els donants de projectes elegibles per a GIVbacks amb tokens GIV. En sol·licitar que el teu projecte obtingui l'estat de 'Elegible per a GIVbacks', podràs fer que el teu projecte destaqui i fomentar més donacions. Fer que el teu projecte sigui elegible per a GIVbacks també construeix una relació de confiança amb els teus donants demostrant la legitimitat del teu projecte i mostrant que els fons s'estan utilitzant per crear un canvi positiu.",
"label.verify_your_project.modal.three": "procés de verificació ",
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@
"label.verified_status_for": "GIVbacks Eligibility for",
"label.verify_email_address": "Verify email address",
"label.verify_your_project": "GIVbacks Eligibility Form",
"label.resume_your_project": "Resume GIVbacks Form",
"label.verify_your_project.modal.four": "requires some additional information about your project and the intended impact of your organization.",
"label.verify_your_project.modal.one": "The GIVbacks program is a revolutionary concept that rewards donors to GIVbacks eligible projects with GIV tokens. By applying your project for 'GIVbacks Eligible' status, you will be able to make your project stand out and encourage more donations. Getting your project GIVbacks eligible also builds a relationship of trust with your donors by demonstrating your project's legitimacy and showing that the funds are being used to create positive change.",
"label.verify_your_project.modal.three": "GIVbacks eligibility process ",
Expand Down
1 change: 1 addition & 0 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@
"label.verified_status_for": "Elegibilidad para GIVbacks para",
"label.verify_email_address": "Verificar email",
"label.verify_your_project": "Formulario de Elegibilidad para GIVbacks",
"label.resume_your_project": "Reanudar el formulario de GIVbacks",
"label.verify_your_project.modal.four": "requiere un poco de información adicional sobre tu proyecto y el impacto previsto de tu organización.",
"label.verify_your_project.modal.one": "El programa GIVbacks es un concepto revolucionario que recompensa a los donantes de proyectos elegibles para GIVbacks con tokens GIV. Al aplicar para que tu proyecto obtenga el estado de 'Elegible para GIVbacks', podrás hacer que tu proyecto se destaque y fomentar más donaciones. Hacer que tu proyecto sea elegible para GIVbacks también construye una relación de confianza con tus donantes al demostrar la legitimidad de tu proyecto y mostrar que los fondos se están utilizando para crear un cambio positivo.",
"label.verify_your_project.modal.three": "proceso de verificación ",
Expand Down
53 changes: 29 additions & 24 deletions src/components/views/project/ProjectGIVbackToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ const ProjectGIVbackToast = () => {
const isPublicGivbackEligible = isGivbackEligible && !isAdmin;
const isPublicVerifiedNotEligible =
isVerified && !isAdmin && !isGivbackEligible;

// When project is VOUCHED (verified=true), not givbacks eligible AND has incomplete givbacks form we should show this notification
const isOwnerVerifiedNotEligible =
isVerified && isAdmin && !isGivbackEligible;
isVerified &&
isAdmin &&
!isGivbackEligible &&
projectData.verificationFormStatus !== EVerificationStatus.VERIFIED;

const isEmailVerifiedStatus = isAdmin ? isAdminEmailVerified : true;

Expand Down Expand Up @@ -181,6 +186,29 @@ const ProjectGIVbackToast = () => {
/>
</ExternalLink>
);
} else if (isOwnerVerifiedNotEligible) {
title = formatMessage(
{
id: `${useIntlTitle}verified_owner`,
},
{
percent: givbackFactorPercent,
value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD,
},
);
description = formatMessage({
id: `${useIntlDescription}verified_owner_not_eligible`,
});
color = semanticColors.golden[600];
icon = <IconGIVBack24 color={semanticColors.golden[600]} />;
link = links.GIVPOWER_DOC;
Button = (
<OutlineButton
onClick={handleBoostClick}
label='Boost'
icon={<IconRocketInSpace16 />}
/>
);
} else if (verStatus === EVerificationStatus.DRAFT) {
title = formatMessage({
id: `${useIntlTitle}non_verified_owner_incomplete`,
Expand Down Expand Up @@ -231,29 +259,6 @@ const ProjectGIVbackToast = () => {
});
icon = <IconDeactivated24 />;
link = links.CANCELLED_PROJECTS_DOCS;
} else if (isOwnerVerifiedNotEligible) {
title = formatMessage(
{
id: `${useIntlTitle}verified_owner`,
},
{
percent: givbackFactorPercent,
value: GIVBACKS_DONATION_QUALIFICATION_VALUE_USD,
},
);
description = formatMessage({
id: `${useIntlDescription}verified_owner_not_eligible`,
});
color = semanticColors.golden[600];
icon = <IconGIVBack24 color={semanticColors.golden[600]} />;
link = links.GIVPOWER_DOC;
Button = (
<OutlineButton
onClick={handleBoostClick}
label='Boost'
icon={<IconRocketInSpace16 />}
/>
);
} else {
title = formatMessage({
id: `${useIntlTitle}non_verified_owner`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ export const AdminActions = () => {
},
{
label: formatMessage({
id: 'label.verify_your_project',
id: formatMessage({
id:
verificationFormStatus === EVerificationStatus.DRAFT
? 'label.resume_your_project'
: 'label.verify_your_project',
}),
}),

type: EOptionType.ITEM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
IconAlertCircle16,
Flex,
} from '@giveth/ui-design-system';
import { EVerificationStatus } from '@/apollo/types/types';
import { useProjectContext } from '@/context/project.context';

export const ProjectCardNotification = () => {
Expand All @@ -15,10 +16,15 @@ export const ProjectCardNotification = () => {
const isVerified = projectData?.verified;
const isGivbackEligible = projectData?.isGivbackEligible;

const isOwnerVerifiedNotEligible =
isVerified && isAdmin && !isGivbackEligible;
// When project is VOUCHED (verified=true), not givbacks eligible AND has incomplete givbacks form we should show this notification
const isOwnerVerifiedNotEligibleIncompleteForm =
isVerified &&
isAdmin &&
!isGivbackEligible &&
projectData.verificationFormStatus !== EVerificationStatus.VERIFIED &&
projectData.verificationFormStatus !== EVerificationStatus.SUBMITTED;

if (!isOwnerVerifiedNotEligible) {
if (!isOwnerVerifiedNotEligibleIncompleteForm) {
return null;
}

Expand Down

0 comments on commit 511b7f9

Please sign in to comment.