Skip to content

Commit

Permalink
Merge pull request #246 from ferminrp/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ferminrp authored Apr 25, 2024
2 parents 3a359d3 + 7518222 commit 48d5b08
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/client/yields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export interface FormattedYield {
const generateUrl = (path: YieldPath) =>
`https://crypto-defi-yields.adriel-ignacio.workers.dev/api/${path}`;

export const getBestYields = async (): Promise<Yield[]> => {
interface EnrichedYield extends Yield {
altLogo: string;
logo: string;
}

export const getBestYields = async (): Promise<EnrichedYield[]> => {
const response = await fetch(generateUrl('best-yields'));
const yields = await response.json();

Expand Down
7 changes: 6 additions & 1 deletion src/components/Sections/Defi/SelectCoinDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { type Dispatch, type SetStateAction } from 'react';
import { Dialog, DialogContent } from '../../SimularInvestment/ui/dialog';

import ChartLineUp from '../../../assets/ChartLineUp';
import { cn } from '../../../lib/utils';
import type { BestCoin } from '../../../model/business';
import { formatPercentage } from '../../../utils/formats';
import { MAPPING_RETURNS } from '../../../utils/returnsMapping';
Expand Down Expand Up @@ -47,14 +48,18 @@ const ContentDialog = ({
options: BestCoin[];
onClick: (x: BestCoin) => void;
}) => {
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
return (
<div>
<h4 className='py-3 text-2xl text-gray-800 dark:text-gray-300'>
Elegí tu moneda
</h4>
<ul
style={{ scrollbarWidth: 'none' }}
className='pocketShadow h-[440px] overflow-y-scroll pb-4'
className={cn(' h-[440px] overflow-y-scroll pb-4', {
pocketShadowDark: isDarkMode,
pocketShadowLight: !isDarkMode,
})}
>
{options
.sort((a, b) => b.apy - a.apy)
Expand Down
26 changes: 25 additions & 1 deletion src/components/SimularInvestment/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ input[type='number'] {
-moz-appearance: textfield;
appearance: textfield;
}
.pocketShadow {
.pocketShadowDark {
background:
linear-gradient(rgba(17, 24, 39, 1) 1%, rgba(255, 255, 255, 0)),
linear-gradient(rgba(255, 255, 255, 0), rgba(17, 24, 39, 1) 99%) 0 100%,
Expand All @@ -101,3 +101,27 @@ input[type='number'] {
100% 10px;
background-attachment: local, local, scroll, scroll;
}

.pocketShadowLight {
background:
linear-gradient(rgba(255, 255, 255, 1) 1%, rgba(255, 255, 255, 1)),
linear-gradient(rgba(255, 255, 255, 1), rgba(255, 255, 255, 1) 99%) 0 100%,
radial-gradient(
farthest-side at 50% 0,
rgba(99, 102, 241, 1),
rgba(99, 102, 241, 0)
),
radial-gradient(
farthest-side at 50% 100%,
rgba(99, 102, 241, 1),
rgba(99, 102, 241, 0)
)
0 100%;
background-repeat: no-repeat;
background-size:
100% 40px,
100% 40px,
100% 10px,
100% 10px;
background-attachment: local, local, scroll, scroll;
}
2 changes: 1 addition & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ for (const [exchange, values] of Object.entries(dataReturns)) {
return (
<Row
key={index}
logo={EXCHANGES['buenbit'].logo}
logo={item.logo}
apy={item.apy}
moneda={item.coin}
className={` bg-white px-4 dark:border-gray-600 dark:bg-gray-900 ${isLastItem ? 'rounded-b-lg' : 'border-b-1 border-b border-gray-100'} `}
Expand Down
35 changes: 35 additions & 0 deletions src/utils/returnsMapping.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Logo from '../assets/Logo';

export const MAPPING_RETURNS = {
NCOP: {
logo: 'https://ik.imagekit.io/ferminrp/colombia.png?updatedAt=1708978808950',
Expand All @@ -14,15 +16,39 @@ export const MAPPING_RETURNS = {
BTC: {
logo: 'https://ik.imagekit.io/ferminrp/Bitcoin.svg.png?updatedAt=1703766672941',
},
WBTC: {
logo: 'https://ik.imagekit.io/ferminrp/Bitcoin.svg.png?updatedAt=1703766672941',
},
ETH: {
logo: 'https://ik.imagekit.io/ferminrp/eth-logo?updatedAt=1708168133038',
},
WETH: {
logo: 'https://ik.imagekit.io/ferminrp/eth-logo?updatedAt=1708168133038',
},
WSTETH: {
logo: 'https://ik.imagekit.io/ferminrp/eth-logo?updatedAt=1708168133038',
},
STETH: {
logo: 'https://ik.imagekit.io/ferminrp/eth-logo?updatedAt=1708168133038',
},
CBETH: {
logo: 'https://ik.imagekit.io/ferminrp/eth-logo?updatedAt=1708168133038',
},
RETH: {
logo: 'https://ik.imagekit.io/ferminrp/eth-logo?updatedAt=1708168133038',
},
DOT: {
logo: 'https://ik.imagekit.io/ferminrp/dot.png?updatedAt=1708168304391',
},
MATIC: {
logo: 'https://ik.imagekit.io/ferminrp/matic.webp?updatedAt=1708167991700',
},
STMATIC: {
logo: 'https://ik.imagekit.io/ferminrp/matic.webp?updatedAt=1708167991700',
},
WMATIC: {
logo: 'https://ik.imagekit.io/ferminrp/matic.webp?updatedAt=1708167991700',
},
BNB: {
logo: 'https://ik.imagekit.io/ferminrp/download.png?updatedAt=1703518180297',
},
Expand All @@ -38,6 +64,12 @@ export const MAPPING_RETURNS = {
DAI: {
logo: 'https://ik.imagekit.io/ferminrp/dai.png?updatedAt=1706873664303',
},
SDAI: {
logo: 'https://ik.imagekit.io/ferminrp/dai.png?updatedAt=1706873664303',
},
WXDAI: {
logo: 'https://ik.imagekit.io/ferminrp/dai.png?updatedAt=1706873664303',
},
USDP: {
logo: 'https://ik.imagekit.io/ferminrp/usdp.png?updatedAt=1708125100866',
},
Expand All @@ -47,6 +79,9 @@ export const MAPPING_RETURNS = {
USDC: {
logo: 'https://ik.imagekit.io/ferminrp/USDC%20Logo.png?updatedAt=1706873507983',
},
OP: {
logo: 'https://ik.imagekit.io/ferminrp/optimism-ethereum-op-logo.png?updatedAt=1703511056838',
},
};

export const TYPE_INVESTMENT_PESOS_MAPPING = {
Expand Down

0 comments on commit 48d5b08

Please sign in to comment.