Skip to content

Commit

Permalink
feat: final
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao committed Dec 20, 2024
1 parent 2474a84 commit 88db9cc
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 511 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ function StakeStrategy({ params }: Props) {
return null;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const stakingInfo = (stakingData as any)[strategy?.raw.integration.slug];
const stakingInfo = stakingData[strategy?.raw.integration.slug];

if (!stakingInfo) return null;

const isLending = strategy.raw.integration.type === 'lending';

Expand Down Expand Up @@ -64,7 +65,7 @@ function StakeStrategy({ params }: Props) {
<Card flex={1}>
<Tabs fullWidth size='lg'>
<TabsItem key='deposit' title={isLending ? <Trans>Supply</Trans> : <Trans>Stake</Trans>}>
<StakingForm strategy={strategy} onStakeSuccess={refetchTransactions} />
<StakingForm stakingInfo={stakingInfo} strategy={strategy} onStakeSuccess={refetchTransactions} />
</TabsItem>
<TabsItem key='withdraw' title={isLending ? <Trans>Withdraw</Trans> : <Trans>Unstake</Trans>}>
<P>Follow these step to unstake your asset:</P>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { useRouter } from 'next/navigation';
import { Key, ReactNode, useEffect, useMemo, useState } from 'react';
import { useTheme } from 'styled-components';

import { StakingInfo } from '../../../utils/stakeData';
import { stakingInfo } from '../../../utils/stakeData';
import { StrategyData, useGetStakingStrategies } from '../../hooks';
import { StakeRewards } from '../StakeRewards';
import { StrategyModal } from '../StrategyModal';
Expand Down Expand Up @@ -116,12 +116,11 @@ enum StakeTableFilter {
interface Props {
searchParams?: { receive: string };
onStakeSuccess: () => void;
stakingInfo: StakingInfo;
}

const AllCategory = 'all-categories';

const StakeTable = ({ searchParams, stakingInfo, onStakeSuccess }: Props) => {
const StakeTable = ({ searchParams, onStakeSuccess }: Props) => {
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('s'));
const isTablet = useMediaQuery(theme.breakpoints.down('md'));
Expand Down Expand Up @@ -179,8 +178,10 @@ const StakeTable = ({ searchParams, stakingInfo, onStakeSuccess }: Props) => {
strategy.raw.integration.logo ||
'https://github.com/0xPellNetwork/pell_media_kit/blob/main/logos/500r_whiteblack.png?raw=true'
}
name={stakingInfo.strategy as string}
protocol={stakingInfo.protocol as string}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
name={(stakingInfo as any)[strategy?.raw.integration.slug ?? '']?.strategy as string}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protocol={(stakingInfo as any)[strategy?.raw.integration.slug ?? '']?.protocol as string}
/>
),
[StakeTableColumns.REWARDS]: <StakeRewards slug={strategy?.raw.integration.slug ?? ''} />,
Expand Down Expand Up @@ -292,7 +293,8 @@ const StakeTable = ({ searchParams, stakingInfo, onStakeSuccess }: Props) => {
)}
{strategy && (
<StrategyModal
stakingInfo={stakingInfo}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
stakingInfo={(stakingInfo as any)[strategy?.raw.integration.slug] as any}
strategy={strategy}
onCloseModal={() => setStrategy(undefined)}
onStakeSuccess={onStakeSuccess}
Expand Down
Loading

0 comments on commit 88db9cc

Please sign in to comment.