1
- import React , { useCallback , useEffect } from "react" ;
1
+ import React from "react" ;
2
2
import { useTheme } from "@emotion/react" ;
3
3
import styled from "@emotion/styled" ;
4
4
import { observer } from "mobx-react" ;
@@ -10,26 +10,12 @@ import {
10
10
useSpotTradesVM ,
11
11
} from "@screens/TradeScreen/OrderbookAndTradesInterface/SpotTrades/SpotTradesVM" ;
12
12
import { SmartFlex } from "@src/components/SmartFlex" ;
13
- import { useEventListener } from "@src/hooks/useEventListener" ;
14
- import { useMedia } from "@src/hooks/useMedia" ;
15
13
16
14
const SpotTradesImpl : React . FC = observer ( ( ) => {
17
15
const vm = useSpotTradesVM ( ) ;
18
16
const theme = useTheme ( ) ;
19
- const media = useMedia ( ) ;
20
17
21
- useEffect ( ( ) => {
22
- vm . calcSize ( media . mobile ) ;
23
- } , [ media . mobile ] ) ;
24
-
25
- const handleCalcSize = useCallback ( ( ) => {
26
- vm . calcSize ( media . mobile ) ;
27
- } , [ media . mobile ] ) ;
28
-
29
- useEventListener ( "resize" , handleCalcSize ) ;
30
-
31
- const trades = vm . trades . slice ( - vm . amountOfOrders ) ;
32
- if ( trades . length === 0 )
18
+ if ( vm . trades . length === 0 )
33
19
return (
34
20
< Root alignItems = "center" justifyContent = "center" mainAxisSize = "stretch" >
35
21
< Text type = { TEXT_TYPES . SUPPORTING } > No trades yet</ Text >
@@ -46,7 +32,7 @@ const SpotTradesImpl: React.FC = observer(() => {
46
32
</ Header >
47
33
48
34
< Container className = "better-scroll" >
49
- { trades . map ( ( trade ) => (
35
+ { vm . trades . map ( ( trade ) => (
50
36
< Row key = { "trade" + trade . id } alignItems = "center" justifyContent = "space-between" style = { { marginBottom : 2 } } >
51
37
< Text color = { theme . colors . textPrimary } type = { TEXT_TYPES . BODY } >
52
38
{ trade . formatPrice }
@@ -74,6 +60,7 @@ export default SpotTrades;
74
60
75
61
const Root = styled ( Column ) `
76
62
width: 100%;
63
+ height: 100%;
77
64
` ;
78
65
79
66
const Header = styled . div `
@@ -90,21 +77,13 @@ const Header = styled.div`
90
77
}
91
78
` ;
92
79
93
- const Container = styled . div < {
94
- fitContent ?: boolean ;
95
- reverse ?: boolean ;
96
- } > `
97
- display: flex;
98
- flex-direction: column;
99
- justify-content: center;
80
+ const Container = styled . div `
81
+ display: grid;
100
82
width: 100%;
101
- ${ ( { fitContent } ) => ! fitContent && "height: 100%;" } ;
102
- ${ ( { reverse } ) => reverse && "flex-direction: column-reverse;" } ;
103
- height: 100%;
104
83
box-sizing: border-box;
105
- padding: 54px 12px 0;
84
+ padding: 5px 12px 0;
106
85
overflow-y: auto;
107
- max-height: calc(100vh - 263px );
86
+ max-height: calc(100vh - 260px );
108
87
gap: 2px;
109
88
` ;
110
89
0 commit comments