File tree 6 files changed +58
-15
lines changed
packages/frontend/src/components/Positions
6 files changed +58
-15
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
import { useAtomValue } from 'jotai'
3
- import { Typography } from '@material-ui/core'
4
3
5
4
import { activePositionsAtom } from '@state/positions/atoms'
6
5
import { poolAtom } from '@state/squeethPool/atoms'
7
6
import { LPTable } from '@components/Lp/LPTable'
7
+ import NoPosition from './NoPosition'
8
8
9
9
const LPPositions : React . FC = ( ) => {
10
10
const pool = useAtomValue ( poolAtom )
11
11
const activePositions = useAtomValue ( activePositionsAtom )
12
12
13
13
if ( activePositions . length === 0 ) {
14
- return (
15
- < Typography variant = "body1" color = "textSecondary" >
16
- No active LP position
17
- </ Typography >
18
- )
14
+ return < NoPosition noPositionText = "No active LP position." ctaText = "open a position." ctaLink = "/lp" />
19
15
}
20
16
21
17
return < LPTable isLPage = { false } pool = { pool ! } />
Original file line number Diff line number Diff line change
1
+ import React from 'react'
2
+ import { Typography } from '@material-ui/core'
3
+ import Link from 'next/link'
4
+
5
+ import useStyles from './useStyles'
6
+
7
+ interface NoPositionProps {
8
+ noPositionText : string
9
+ ctaText : string
10
+ ctaLink : string
11
+ }
12
+
13
+ const NoPosition : React . FC < NoPositionProps > = ( { noPositionText, ctaText, ctaLink } ) => {
14
+ const classes = useStyles ( )
15
+
16
+ return (
17
+ < div className = { classes . noPositionContainer } >
18
+ < Typography variant = "body1" color = "textSecondary" >
19
+ { noPositionText }
20
+ </ Typography >
21
+
22
+ < div >
23
+ < Typography variant = "body1" color = "primary" component = "span" >
24
+ < Link href = { ctaLink } > Click here</ Link >
25
+ </ Typography >
26
+ < Typography variant = "body1" color = "textSecondary" component = "span" >
27
+ to { ctaText }
28
+ </ Typography >
29
+ </ div >
30
+ </ div >
31
+ )
32
+ }
33
+
34
+ export default NoPosition
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import ShortSqueeth from './ShortSqueeth'
35
35
import LPedSqueeth from './LPedSqueeth'
36
36
import MintedSqueeth from './MintedSqueeth'
37
37
import BullPosition from './BullPosition'
38
+ import NoPosition from './NoPosition'
38
39
39
40
const Positions : React . FC = ( ) => {
40
41
const address = useAtomValue ( addressAtom )
@@ -113,10 +114,20 @@ const Positions: React.FC = () => {
113
114
mintedDebt . isZero ( ) &&
114
115
lpedSqueeth . isZero ( )
115
116
) {
117
+ if ( isLoadingPositions ) {
118
+ return (
119
+ < Typography variant = "body1" color = "textSecondary" >
120
+ { 'loading...' }
121
+ </ Typography >
122
+ )
123
+ }
124
+
116
125
return (
117
- < Typography variant = "body1" color = "textSecondary" >
118
- { isLoadingPositions ? 'loading...' : 'No active position' }
119
- </ Typography >
126
+ < NoPosition
127
+ noPositionText = "You have no active position."
128
+ ctaText = "stack USDC with Crab 🦀"
129
+ ctaLink = "/strategies/crab"
130
+ />
120
131
)
121
132
}
122
133
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ const TxHistory: React.FC = () => {
102
102
if ( transactions . length === 0 ) {
103
103
return (
104
104
< Typography variant = "body1" color = "textSecondary" >
105
- No transaction found
105
+ No transaction found.
106
106
</ Typography >
107
107
)
108
108
}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import useYourVaults from '@hooks/useYourVaults'
9
9
import { toTokenAmount } from '@utils/calculations'
10
10
import { formatNumber } from '@utils/formatter'
11
11
import useStyles from './useStyles'
12
+ import NoPosition from './NoPosition'
12
13
13
14
const YourVaults : FC = ( ) => {
14
15
const classes = useStyles ( )
@@ -31,11 +32,7 @@ const YourVaults: FC = () => {
31
32
}
32
33
33
34
if ( vaults ?. length === 0 || ! vaults ) {
34
- return (
35
- < Typography variant = "body1" color = "textSecondary" >
36
- No vault found
37
- </ Typography >
38
- )
35
+ return < NoPosition noPositionText = "No vault found." ctaText = "open a vault." ctaLink = "/mint" />
39
36
}
40
37
41
38
return (
Original file line number Diff line number Diff line change @@ -117,6 +117,11 @@ const useStyles = makeStyles((theme) =>
117
117
fontMedium : {
118
118
fontWeight : 500 ,
119
119
} ,
120
+ noPositionContainer : {
121
+ display : 'flex' ,
122
+ justifyContent : 'flex-start' ,
123
+ alignItems : 'center' ,
124
+ } ,
120
125
} ) ,
121
126
)
122
127
You can’t perform that action at this time.
0 commit comments