@@ -4,36 +4,46 @@ import TableContainer from "~/renderer/components/TableContainer";
4
4
import TableHeader from "LLD/features/Collectibles/components/Collection/TableHeader" ;
5
5
import Item from "./Item" ;
6
6
import { TableHeaderTitleKey } from "LLD/features/Collectibles/types/Collection" ;
7
- import { Box , Flex } from "@ledgerhq/react-ui" ;
7
+ import { Box , Flex , Icons } from "@ledgerhq/react-ui" ;
8
8
import { TableHeader as TableHeaderContainer } from "./TableHeader" ;
9
9
import { SimpleHashNft } from "@ledgerhq/live-nft/api/types" ;
10
10
import Loader from "../Loader" ;
11
11
import Error from "../Error" ;
12
+ import EmptyCollection from "../../../components/Collection/EmptyCollection" ;
13
+ import { CollectibleTypeEnum } from "../../../types/enum/Collectibles" ;
14
+ import Button from "~/renderer/components/Button" ;
15
+ import { useTranslation } from "react-i18next" ;
12
16
13
17
type ViewProps = ReturnType < typeof useRareSatsModel > & {
14
18
isLoading : boolean ;
15
19
isError : boolean ;
16
20
isFetched : boolean ;
21
+ error : Error | null ;
22
+ onReceive : ( ) => void ;
17
23
} ;
18
24
19
25
type Props = {
20
26
rareSats : SimpleHashNft [ ] ;
21
27
isLoading : boolean ;
22
28
isError : boolean ;
23
29
isFetched : boolean ;
30
+ error : Error | null ;
31
+ onReceive : ( ) => void ;
24
32
} ;
25
33
26
- function View ( { rareSats, isLoading, isError, isFetched } : ViewProps ) {
27
- const isLoaded = isFetched ;
34
+ function View ( { rareSats, isLoading, isError, isFetched, error, onReceive } : ViewProps ) {
35
+ const { t } = useTranslation ( ) ;
36
+ const isLoaded = isFetched && ! isError && ! isLoading ;
28
37
const hasRareSats = Object . values ( rareSats ) . length > 0 ;
29
38
const dataReady = isLoaded && hasRareSats ;
39
+ const hasError = isError && error ;
30
40
31
41
return (
32
42
< Box >
33
43
< TableContainer id = "oridinals-raresats" >
34
44
< TableHeader titleKey = { TableHeaderTitleKey . RareSats } />
35
45
{ isLoading && < Loader /> }
36
- { isError && < Error /> }
46
+ { hasError && < Error error = { error } /> }
37
47
{ dataReady && < TableHeaderContainer /> }
38
48
< Flex flexDirection = "column" >
39
49
{ dataReady &&
@@ -45,22 +55,29 @@ function View({ rareSats, isLoading, isError, isFetched }: ViewProps) {
45
55
</ Flex >
46
56
) ) }
47
57
{ isLoaded && ! hasRareSats && (
48
- < Flex justifyContent = "center" my = { 4 } >
49
- { "NOTHING TO SHOW WAITING FOR DESIGN" }
50
- </ Flex >
58
+ < EmptyCollection collectionType = { CollectibleTypeEnum . RareSat } >
59
+ < Button small primary onClick = { onReceive } icon >
60
+ < Flex alignItems = { "center" } >
61
+ < Icons . ArrowDown size = "XS" />
62
+ < Box > { t ( "ordinals.rareSats.receive" ) } </ Box >
63
+ </ Flex >
64
+ </ Button >
65
+ </ EmptyCollection >
51
66
) }
52
67
</ Flex >
53
68
</ TableContainer >
54
69
</ Box >
55
70
) ;
56
71
}
57
72
58
- const RareSats = ( { rareSats, isLoading, isError, isFetched } : Props ) => {
73
+ const RareSats = ( { rareSats, isLoading, isError, isFetched, error , onReceive } : Props ) => {
59
74
return (
60
75
< View
61
76
isFetched = { isFetched }
62
77
isLoading = { isLoading }
63
78
isError = { isError }
79
+ error = { error }
80
+ onReceive = { onReceive }
64
81
{ ...useRareSatsModel ( { rareSats } ) }
65
82
/>
66
83
) ;
0 commit comments