diff --git a/src/components/Projects/ProjectCard/VestingProgress.tsx b/src/components/Projects/ProjectCard/VestingProgress.tsx index ada0bd497..559b12821 100644 --- a/src/components/Projects/ProjectCard/VestingProgress.tsx +++ b/src/components/Projects/ProjectCard/VestingProgress.tsx @@ -19,15 +19,17 @@ const getRoundedPercentage = (value: number, total: number) => Math.min(Math.rou const VestingProgress = ({ project, basic }: Props) => { const t = useFormatMessage() - const { contract, enacting_tx, tx_amount, token, enacted_at } = project + const { contract, enacting_tx, token, enacted_at } = project if (!enacted_at) return null const total = contract?.vesting_total_amount || 100 const vestedPercentage = contract ? getRoundedPercentage(contract.vestedAmount, total) : 100 const releasedPercentage = contract ? getRoundedPercentage(contract.released, total) : null - const vestedAmountText = `${t(`general.number`, { - value: contract ? contract.vestedAmount : tx_amount || 0, - })} ${token}` + const vestedAmountText = contract + ? `${t(`general.number`, { + value: contract.vestedAmount || 0, + })} ${token}` + : null const releasedText = contract ? `${t(`general.number`, { value: contract.released })} ${token} ${t('page.grants.released')}` : t('page.grants.one_time_payment') @@ -38,7 +40,9 @@ const VestingProgress = ({ project, basic }: Props) => { {!basic && (
- {vestedAmountText} + {vestedAmountText && ( + {vestedAmountText} + )} {enacting_tx ? t('page.grants.transferred') : t('page.grants.vested')} diff --git a/src/intl/en.json b/src/intl/en.json index 2e18fbce5..7b9e4c422 100644 --- a/src/intl/en.json +++ b/src/intl/en.json @@ -1235,7 +1235,7 @@ "button": "View all Projects" }, "vested": "vested", - "transferred": "transferred", + "transferred": "Transferred", "one_time_payment": "One-time payment", "one_month_cliff": "1-month Cliff Period", "cliff_remaining": "{count} {count, plural, one {day} other {days}} to go", diff --git a/src/services/ProjectService.ts b/src/services/ProjectService.ts index 24d1f1a7b..524d206c1 100644 --- a/src/services/ProjectService.ts +++ b/src/services/ProjectService.ts @@ -31,7 +31,6 @@ import { ProposalInCreation } from './ProposalService' export class ProjectService { public static async getProjects() { const data = await ProposalModel.getProjectList() - const vestings = await DclData.get().getVestings() const projects: ProjectWithUpdate[] = [] @@ -58,7 +57,8 @@ export class ProjectService { category: proposal.configuration.category || proposal.type, tier: proposal.configuration.tier, }, - ...this.getProjectVestingData(latestVesting), + + ...this.getProjectVestingData(proposal, latestVesting), } try { @@ -85,7 +85,15 @@ export class ProjectService { } } - private static getProjectVestingData(vesting: TransparencyVesting) { + private static getProjectVestingData(proposal: ProposalAttributes, vesting: TransparencyVesting) { + if (proposal.enacting_tx) { + return { + status: ProjectStatus.Finished, + enacting_tx: proposal.enacting_tx, + enacted_at: Time(proposal.updated_at).unix(), + } + } + if (!vesting) { return { status: ProjectStatus.Pending, @@ -104,7 +112,7 @@ export class ProjectService { return { status: vesting_status, - token: token, + token, enacted_at: Time(vesting_start_at).unix(), contract: { vesting_total_amount: Math.round(vesting_total_amount),