Skip to content

Commit

Permalink
fix: description should use vault description as primary souce
Browse files Browse the repository at this point in the history
  • Loading branch information
Majorfi committed Nov 28, 2023
1 parent ffc3f99 commit 34de354
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 80 deletions.
8 changes: 8 additions & 0 deletions apps/common/schemas/yDaemonVaultsSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ export const yDaemonVaultSchema = z.object({
.catch('Legacy'),
symbol: z.string(),
name: z.string(),
description: z
.string()
.default(
'Sorry, we don\'t have a description for this asset right now. But did you know the correct word for a blob of toothpaste is a "nurdle". Fascinating! We\'ll work on updating the asset description, but at least you learnt something interesting. Catch ya later nurdles.'
)
.catch(
'Sorry, we don\'t have a description for this asset right now. But did you know the correct word for a blob of toothpaste is a "nurdle". Fascinating! We\'ll work on updating the asset description, but at least you learnt something interesting. Catch ya later nurdles.'
),
category: z
.literal('Curve')
.or(z.literal('Volatile'))
Expand Down
81 changes: 5 additions & 76 deletions apps/vaults-v3/components/details/tabs/VaultDetailsAbout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ export function VaultDetailsAbout({currentVault}: {currentVault: TYDaemonVault})
const {token, apr} = currentVault;

function getVaultDescription(): string {
if (currentVault.description) {
return parseMarkdown(currentVault.description.replaceAll('{{token}}', currentVault.token.symbol));
}
if (token.description) {
return parseMarkdown(token.description);
return parseMarkdown(token.description.replaceAll('{{token}}', currentVault.token.symbol));
}
return 'Sorry, we don\'t have a description for this asset right now. But did you know the correct word for a blob of toothpaste is a "nurdle". Fascinating! We\'ll work on updating the asset description, but at least you learnt something interesting. Catch ya later nurdles.';
return currentVault.description;
}

console.log(apr);

return (
<div className={'grid grid-cols-1 gap-4 p-4 md:grid-cols-12 md:gap-10 md:p-8'}>
<div className={'col-span-12 w-full pr-0 md:col-span-7 md:pr-28'}>
Expand Down Expand Up @@ -111,75 +112,3 @@ export function VaultDetailsAbout({currentVault}: {currentVault: TYDaemonVault})
</div>
);
}

export function VaultDetailsAboutCard({currentVault}: {currentVault: TYDaemonVault}): ReactElement {
const {token, apr} = currentVault;

function getVaultDescription(): string {
if (token.description) {
return parseMarkdown(token.description);
}
return 'Sorry, we don\'t have a description for this asset right now. But did you know the correct word for a blob of toothpaste is a "nurdle". Fascinating! We\'ll work on updating the asset description, but at least you learnt something interesting. Catch ya later nurdles.';
}
return (
<div className={'col-span-12 w-full rounded-3xl bg-neutral-100 p-6 md:col-span-7'}>
<strong className={'block pb-2 text-3xl font-black text-neutral-900 md:pb-4 md:text-4xl md:leading-[48px]'}>
{'About'}
</strong>
<div className={'flex flex-col gap-4 md:flex-col md:gap-10'}>
<div>
<p
className={'text-neutral-900/50'}
dangerouslySetInnerHTML={{
__html: getVaultDescription()
}}
/>
</div>
<div className={'col-span-12 mt-4 w-full md:col-span-5 md:mt-0'}>
<div className={'grid grid-cols-1 gap-x-12 md:grid-cols-5'}>
<b className={'col-span-3 text-neutral-900'}>{'APR'}</b>
<b className={'col-span-2 text-neutral-900'}>{'Fees'}</b>
</div>
<div className={'mt-2 grid grid-cols-1 gap-x-12 md:grid-cols-5'}>
<YearnFeesLineItem label={'Last 7 days'}>
<b className={'font-number text-xl text-neutral-900'}>
{formatPercent(apr.points.weekAgo * 100, 0)}
</b>
</YearnFeesLineItem>
<YearnFeesLineItem label={'Last 30 days'}>
<b className={'font-number text-xl text-neutral-900'}>
{formatPercent(apr.points.monthAgo * 100, 0)}
</b>
</YearnFeesLineItem>

<YearnFeesLineItem label={'Inception'}>
<b className={'font-number text-xl text-neutral-900'}>
{formatPercent(apr.points.inception * 100, 0)}
</b>
</YearnFeesLineItem>

<YearnFeesLineItem label={'Management'}>
<b className={'font-number text-xl text-neutral-900'}>
{formatPercent((apr.fees.management || 0) * 100, 0)}
</b>
</YearnFeesLineItem>
<YearnFeesLineItem label={'Performance'}>
<b className={'font-number text-xl text-neutral-900'}>
{formatPercent((apr.fees.performance || 0) * 100, 0)}
</b>
</YearnFeesLineItem>
{currentVault.category === 'Velodrome' || currentVault.category === 'Aerodrome' ? (
<YearnFeesLineItem
label={'keepVELO'}
tooltip={`Percentage of VELO locked in each harvest. This is used to boost ${currentVault.category} vault pools, and is offset via yvOP staking rewards.`}>
<b className={'font-number text-xl text-neutral-500'}>
{formatPercent(currentVault.apr.fees.keepVelo * 100, 0)}
</b>
</YearnFeesLineItem>
) : null}
</div>
</div>
</div>
</div>
);
}
7 changes: 5 additions & 2 deletions apps/vaults/components/details/tabs/VaultDetailsAbout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ export function VaultDetailsAbout({
const {token, apr} = currentVault;

function getVaultDescription(): string {
if (currentVault.description) {
return parseMarkdown(currentVault.description.replaceAll('{{token}}', currentVault.token.symbol));
}
if (token.description) {
return parseMarkdown(token.description);
return parseMarkdown(token.description.replaceAll('{{token}}', currentVault.token.symbol));
}
return 'Sorry, we don\'t have a description for this asset right now. But did you know the correct word for a blob of toothpaste is a "nurdle". Fascinating! We\'ll work on updating the asset description, but at least you learnt something interesting. Catch ya later nurdles.';
return currentVault.description;
}

return (
Expand Down
4 changes: 2 additions & 2 deletions pages/vaults-v3/[chainID]/[address].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function Index(): ReactElement | null {
}
refresh(tokensToRefresh);
}
}, [currentVault?.address, currentVault?.token.address, address, isActive, refresh, currentVault?.chainID]);
}, [currentVault?.address, currentVault?.token?.address, address, isActive, refresh, currentVault?.chainID]);

if (isLoadingVault || !router.query.address) {
return (
Expand Down Expand Up @@ -122,7 +122,7 @@ function Index(): ReactElement | null {
)}>
<ImageWithFallback
className={'h-10 w-10 md:h-12 md:w-12'}
src={`${process.env.BASE_YEARN_ASSETS_URI}/${currentVault.chainID}/${currentVault.address}/logo-128.png`}
src={`${process.env.BASE_YEARN_ASSETS_URI}/${currentVault.chainID}/${currentVault.token.address}/logo-128.png`}
alt={''}
smWidth={40}
smHeight={40}
Expand Down

0 comments on commit 34de354

Please sign in to comment.