-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1314 from mars-protocol/develop
v2.8.7
- Loading branch information
Showing
11 changed files
with
1,179 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import classNames from 'classnames' | ||
import { CircularProgress } from 'components/common/CircularProgress' | ||
import { useState } from 'react' | ||
|
||
interface Props { | ||
denom: string | ||
} | ||
|
||
export function PerpsStats({ denom }: Props) { | ||
const [isLoading, setIsLoading] = useState(true) | ||
|
||
const handleIframeLoad = () => { | ||
setTimeout(() => setIsLoading(false), 1500) | ||
} | ||
|
||
return ( | ||
<div className='flex gap-4 h-[500px] md:h-screen/70 md:max-h-[980px] md:min-h-[560px] w-full items-center justify-center'> | ||
{isLoading && <CircularProgress size={60} />} | ||
<iframe | ||
src={`http://stats.marsprotocol.io/${denom}?iframeView=on`} | ||
className={classNames( | ||
'w-[calc(100%-2px)] ml-[1px] h-full border-0', | ||
isLoading ? 'hidden' : 'flex', | ||
)} | ||
title='Perps Stats' | ||
onLoad={handleIframeLoad} | ||
/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { CardWithTabs } from 'components/common/Card/CardWithTabs' | ||
import { PerpsChart } from 'components/perps/PerpsChart' | ||
import { PerpsStats } from 'components/perps/PerpsStats' | ||
import usePerpsAsset from 'hooks/perps/usePerpsAsset' | ||
import { Suspense, useMemo } from 'react' | ||
|
||
export function PerpsTabs() { | ||
const { perpsAsset } = usePerpsAsset() | ||
const tabs: CardTab[] = useMemo( | ||
() => [ | ||
{ | ||
title: 'Trading Chart', | ||
id: 'chart', | ||
renderContent: () => <PerpsChart />, | ||
}, | ||
{ | ||
title: 'Market Stats', | ||
id: 'stats', | ||
renderContent: () => ( | ||
<div className='flex flex-col h-full gap-4'> | ||
<Suspense fallback={<div>Loading...</div>}> | ||
<PerpsStats denom={perpsAsset.denom} /> | ||
</Suspense> | ||
</div> | ||
), | ||
}, | ||
], | ||
[perpsAsset.denom], | ||
) | ||
|
||
return <CardWithTabs tabs={tabs} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.