Skip to content

Commit

Permalink
Merge branch 'feat/home-page' of github.com:DimensionDev/stake.mask.i…
Browse files Browse the repository at this point in the history
…o into feat/home-page
  • Loading branch information
beyond009 committed May 6, 2024
2 parents dea667e + cc1bea1 commit 2d9dd7b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/components/Header/NavTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const navigation = [
{ name: 'About', path: '/about' },
];

export interface NavigationHeaderProps { }
export interface NavigationHeaderProps {}

export function NavTabs() {
const pathname = usePathname();
Expand Down
76 changes: 38 additions & 38 deletions src/components/StakeCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,46 @@ import { STAKE_MANAGER_CONTRACT } from '@/constants/index.js';
import { Image } from '@/esm/Image.js';

interface StakeCardProps {
setIsOpen: (isOpen: boolean) => void;
setIsOpen: (isOpen: boolean) => void;
}

export function StakeCard({ setIsOpen }: StakeCardProps) {
const { address } = useAccount();
const { data, isLoading, isError } = useQuery({
queryKey: ['stake', address],
queryFn: async () => {
if (!address) return;
const [stakeAmount, poolId] = await readContract({
...STAKE_MANAGER_CONTRACT,
functionName: 'userInfos',
args: [address],
});
return { stakeAmount, poolId };
},
});
const { address } = useAccount();
const { data, isLoading, isError } = useQuery({
queryKey: ['stake', address],
queryFn: async () => {
if (!address) return;
const [stakeAmount, poolId] = await readContract({
...STAKE_MANAGER_CONTRACT,
functionName: 'userInfos',
args: [address],
});
return { stakeAmount, poolId };
},
});

return (
<div className="relative flex h-[196px] flex-col rounded-[16px] border-[1px] border-neutrals6 p-[16px]">
<Image
src="/glow.png"
width={360}
height={230}
alt="right"
className="absolute left-[-35px] top-[-30px] z-50"
/>
<div className="text-[20px] font-bold text-white">Staked MASK</div>
<div className="w-full text-center text-[48px] leading-[48px] text-white ">
{data?.stakeAmount ? formatEther(data.stakeAmount) : 0}
</div>
<div className="mb-[12px] w-full text-center text-[16px] text-white">+3 Points/h</div>
<MainButton
onClick={() => {
setIsOpen(true);
}}
>
<MASK width={16} height={16} />
Stake MASK
</MainButton>
</div>
);
return (
<div className="relative flex h-[196px] flex-col rounded-[16px] border-[1px] border-neutrals6 p-[16px]">
<Image
src="/glow.png"
width={360}
height={230}
alt="right"
className="absolute left-[-35px] top-[-30px] z-50"
/>
<div className="text-[20px] font-bold text-white">Staked MASK</div>
<div className="w-full text-center text-[48px] leading-[48px] text-white ">
{data?.stakeAmount ? formatEther(data.stakeAmount) : 0}
</div>
<div className="mb-[12px] w-full text-center text-[16px] text-white">+3 Points/h</div>
<MainButton
onClick={() => {
setIsOpen(true);
}}
>
<MASK width={16} height={16} />
Stake MASK
</MainButton>
</div>
);
}
5 changes: 3 additions & 2 deletions src/components/StakeModal/StakeTokenInput/Stake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ export function Stake() {
return (
<>
<InputPanel amount={amount} setAmount={setAmount} balance={balance} />
{poolInfo ?
{poolInfo ? (
<div className="flex items-center justify-between text-[16px] text-neutrals4">
<div>Unlock MASK Time</div>
<div className="font-bold text-secondary3">
{dayjs(poolInfo.endTime).format('HH:MM MM/DD/YYYY')}
</div>
</div> : null}
</div>
) : null}
<div className="flex items-center justify-between text-[16px] text-neutrals4">
<div>APY</div>
<div className="font-bold"> {Math.floor(apyInfo?.data?.apy) || 0}%</div>
Expand Down
2 changes: 1 addition & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const REWARD = '0xf0c196d1b1489738cda956e994e82ef6897e85bc' as `0x${strin
export const BASE_URL = 'https://masknetwork-dev.firefly.land/v1/mask_stake';

export const IS_TESTNET = process.env.NEXT_PUBLIC_TEST;
export const CHAIN_ID = IS_TESTNET ? sepolia.id : mainnet.id
export const CHAIN_ID = IS_TESTNET ? sepolia.id : mainnet.id;

export const STAKE_MANAGER_CONTRACT = {
address: IS_TESTNET ? STAKE_MANAGER_TEST : STAKE_MANAGER,
Expand Down

0 comments on commit 2d9dd7b

Please sign in to comment.