Skip to content

Commit 2a54c31

Browse files
authored
Merge pull request #1682 from mars-protocol/develop
v3.0.2
2 parents cb6ff5c + 941b9e8 commit 2a54c31

File tree

4 files changed

+39
-15
lines changed

4 files changed

+39
-15
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mars-v2-frontend",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"homepage": "./",
55
"private": false,
66
"license": "SEE LICENSE IN LICENSE FILE",
@@ -79,8 +79,8 @@
7979
"@types/lodash.debounce": "^4.0.9",
8080
"@types/lodash.throttle": "^4.1.9",
8181
"@types/node": "^24.5.2",
82-
"@types/react": "19.1.13",
83-
"@types/react-dom": "19.1.9",
82+
"@types/react": "19.2.2",
83+
"@types/react-dom": "19.2.2",
8484
"@types/react-helmet": "^6.1.11",
8585
"@typescript-eslint/eslint-plugin": "^8.44.1",
8686
"@typescript-eslint/parser": "^8.44.1",

src/components/common/Grid/GridWithSplitters.tsx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'classnames'
22
import { ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
3+
import { isMobile } from 'react-device-detect'
34

45
interface Props {
56
className?: string
@@ -8,7 +9,8 @@ interface Props {
89
bottomArea: ReactNode
910
}
1011

11-
export default function GridWithSplitters({ className, chartArea, rightArea, bottomArea }: Props) {
12+
// Desktop layout component with full grid and drag functionality
13+
function DesktopGridLayout({ className, chartArea, rightArea, bottomArea }: Props) {
1214
const [chartWidthPercent, setChartWidthPercent] = useState(75) // Chart takes 75% width
1315
const [chartHeightPercent, setChartHeightPercent] = useState(75) // Chart takes 75% height
1416
const [isDragging, setIsDragging] = useState<'vertical' | 'horizontal' | null>(null)
@@ -141,15 +143,8 @@ export default function GridWithSplitters({ className, chartArea, rightArea, bot
141143
/>
142144
)}
143145

144-
{/* Mobile Layout - Stacked */}
145-
<div className='flex flex-col w-full gap-1 md:hidden'>
146-
<div className='bg-surface w-full'>{chartArea}</div>
147-
<div className='bg-surface w-full'>{rightArea}</div>
148-
<div className='bg-surface w-full'>{bottomArea}</div>
149-
</div>
150-
151146
{/* Desktop Layout - CSS Grid with Splitters */}
152-
<div className='hidden md:grid w-full h-full min-h-0' style={gridStyles}>
147+
<div className='grid w-full h-full min-h-0' style={gridStyles}>
153148
{/* Row 1, Col 1: Chart Area */}
154149
<div className='min-w-0 min-h-0 overflow-hidden row-start-1 row-end-2 col-start-1 col-end-2'>
155150
{chartArea}
@@ -214,3 +209,20 @@ export default function GridWithSplitters({ className, chartArea, rightArea, bot
214209
</div>
215210
)
216211
}
212+
213+
// Mobile layout - stacked
214+
function MobileGridLayout({ className, chartArea, rightArea, bottomArea }: Props) {
215+
return (
216+
<div className={classNames('w-full', className)}>
217+
<div className='flex flex-col w-full gap-1'>
218+
<div className='bg-surface w-full'>{chartArea}</div>
219+
<div className='bg-surface w-full'>{rightArea}</div>
220+
<div className='bg-surface w-full'>{bottomArea}</div>
221+
</div>
222+
</div>
223+
)
224+
}
225+
226+
export default function GridWithSplitters(props: Props) {
227+
return isMobile ? <MobileGridLayout {...props} /> : <DesktopGridLayout {...props} />
228+
}

src/components/common/LeverageSlider/InputOverlay.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function InputOverlay({ max, value, marginThreshold, type, min }: Props) {
2323
const markPosPercent = Math.max(0, Math.min(100, 100 / (max / (marginThreshold ?? 1))))
2424
const markPadRight = (markPosPercent / 100) * THUMB_WIDTH
2525
const hasPastMarginThreshold = marginThreshold ? value >= marginThreshold : undefined
26+
const isMarginNearMax = markPosPercent > 85
2627

2728
return (
2829
<>
@@ -49,7 +50,12 @@ function InputOverlay({ max, value, marginThreshold, type, min }: Props) {
4950
style={{ left: `calc(${markPosPercent}% - ${markPadRight}px)` }}
5051
>
5152
<div className='w-1 h-1 bg-white rounded-full' />
52-
<div className='absolute top-2.5 flex-col text-xs w-[33px] items-center flex'>
53+
<div
54+
className={classNames(
55+
'absolute top-2.5 flex flex-col items-center text-xs w-[33px]',
56+
isMarginNearMax && 'pt-4',
57+
)}
58+
>
5359
<VerticalThreeLine className='h-2 w-[1px]' />
5460
<div className={!hasPastMarginThreshold ? 'opacity-50' : 'opacity-100'}>Margin</div>
5561
</div>

src/components/perps/PerpsInfo/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import classNames from 'classnames'
12
import DisplayCurrency from 'components/common/DisplayCurrency'
23
import Divider from 'components/common/Divider'
34
import { FormattedNumber } from 'components/common/FormattedNumber'
@@ -65,7 +66,7 @@ export function PerpsInfo() {
6566
if (!market) return null
6667

6768
return (
68-
<div className='flex flex-wrap items-center gap-2 mb-2 md:gap-4 sm:mb-0'>
69+
<div className='flex flex-wrap items-center justify-between gap-2 mb-2 md:gap-4 sm:mb-0'>
6970
{items.map((item, index) => (
7071
<React.Fragment key={index}>
7172
{item}
@@ -86,7 +87,12 @@ interface InfoItemProps {
8687

8788
function InfoItem(props: InfoItemProps) {
8889
return (
89-
<div className={`flex flex-col gap-1 min-w-30 ${props.className || ''}`}>
90+
<div
91+
className={classNames(
92+
'flex flex-col gap-1 w-[calc(50%-0.25rem)] md:w-auto md:min-w-30',
93+
props.className,
94+
)}
95+
>
9096
<Text size='xs' className='text-white/40'>
9197
{props.label}
9298
</Text>

0 commit comments

Comments
 (0)