@@ -8,6 +8,7 @@ import { FolderOutlined, RightOutlined } from '@ant-design/icons';
8
8
import { Box , ControlButton , Flex } from '@input-output-hk/lace-ui-toolkit' ;
9
9
import { ReactComponent as ProfileIcon } from '../../assets/icons/profile-icon.component.svg' ;
10
10
import { ReactComponent as PrintNftIcon } from '../../assets/icons/print-nft.component.svg' ;
11
+ import { useTranslation } from 'react-i18next' ;
11
12
12
13
export interface NftDetailProps {
13
14
title ?: ReactNode ;
@@ -43,80 +44,86 @@ export const NftDetail = ({
43
44
onSetAsAvatar,
44
45
onPrintNft,
45
46
isPopup
46
- } : NftDetailProps ) : React . ReactElement => (
47
- < div className = { styles . nftDetail } >
48
- { title }
49
- < div className = { styles . imageContainer } >
50
- < div className = { styles . imageWrapper } >
51
- { Number ( amount ) > 1 && (
52
- < div data-testid = "nft-item-amount" className = { styles . amount } >
53
- { amount }
54
- </ div >
55
- ) }
56
- < NftImage image = { image } detailView popupView />
47
+ } : NftDetailProps ) : React . ReactElement => {
48
+ const { t } = useTranslation ( ) ;
49
+ const rootKey = t ( 'core.nftFolderName.root' ) ;
50
+ return (
51
+ < div className = { styles . nftDetail } >
52
+ { title }
53
+ < div className = { styles . imageContainer } >
54
+ < div className = { styles . imageWrapper } >
55
+ { Number ( amount ) > 1 && (
56
+ < div data-testid = "nft-item-amount" className = { styles . amount } >
57
+ { amount }
58
+ </ div >
59
+ ) }
60
+ < NftImage image = { image } detailView popupView />
61
+ </ div >
57
62
</ div >
58
- </ div >
59
- < Flex w = "$fill" gap = "$24" flexDirection = { isPopup ? 'column' : 'row' } justifyContent = "center" px = "$10" >
60
- < ControlButton . Outlined
61
- w = { onPrintNft ? '$fill' : undefined }
62
- size = "small"
63
- label = { translations . setAsAvatar }
64
- icon = { < ProfileIcon /> }
65
- onClick = { ( ) => image && onSetAsAvatar ?.( image ) }
66
- data-testid = "nft-set-as-avatar-button"
67
- />
68
- { onPrintNft && (
63
+ < Flex w = "$fill" gap = "$24" flexDirection = { isPopup ? 'column' : 'row' } justifyContent = "center" px = "$10" >
69
64
< ControlButton . Outlined
70
- w = " $fill"
65
+ w = { onPrintNft ? ' $fill' : undefined }
71
66
size = "small"
72
- label = { translations . printNft }
73
- icon = { < PrintNftIcon /> }
74
- onClick = { ( ) => onPrintNft ( ) }
75
- data-testid = "nft-print -button"
67
+ label = { translations . setAsAvatar }
68
+ icon = { < ProfileIcon /> }
69
+ onClick = { ( ) => image && onSetAsAvatar ?. ( image ) }
70
+ data-testid = "nft-set-as-avatar -button"
76
71
/>
77
- ) }
78
- </ Flex >
79
- < div className = { styles . info } >
80
- < div data-testid = "nft-info" className = { styles . section } >
81
- < h4 data-testid = "nft-info-label" > { translations . tokenInformation } </ h4 >
82
- < InlineInfoList
83
- items = { [
84
- ...tokenInformation ,
85
- {
86
- name : translations . directory ,
87
- value : folder ? `Root > ${ folder } ` : 'Root' ,
88
- renderValueAs : ! isPopup ? (
89
- < Breadcrumb separator = { < RightOutlined /> } >
90
- < Breadcrumb . Item >
91
- < FolderOutlined />
92
- < span data-testid = "folder-path-1" > Root</ span >
93
- </ Breadcrumb . Item >
94
- { folder && (
72
+ { onPrintNft && (
73
+ < ControlButton . Outlined
74
+ w = "$fill"
75
+ size = "small"
76
+ label = { translations . printNft }
77
+ icon = { < PrintNftIcon /> }
78
+ onClick = { ( ) => onPrintNft ( ) }
79
+ data-testid = "nft-print-button"
80
+ />
81
+ ) }
82
+ </ Flex >
83
+ < div className = { styles . info } >
84
+ < div data-testid = "nft-info" className = { styles . section } >
85
+ < h4 data-testid = "nft-info-label" > { translations . tokenInformation } </ h4 >
86
+ < InlineInfoList
87
+ items = { [
88
+ ...tokenInformation ,
89
+ {
90
+ name : translations . directory ,
91
+ value : folder ? `${ rootKey } > ${ folder } ` : rootKey ,
92
+ renderValueAs : ! isPopup ? (
93
+ < Breadcrumb separator = { < RightOutlined /> } >
95
94
< Breadcrumb . Item >
96
- < Ellipsis text = { folder } beforeEllipsis = { 5 } afterEllipsis = { 5 } dataTestId = "folder-path-2" />
95
+ < FolderOutlined />
96
+ < span data-testid = "folder-path-1" > Root</ span >
97
97
</ Breadcrumb . Item >
98
- ) }
99
- </ Breadcrumb >
100
- ) : (
101
- < Flex justifyContent = "space-between" gap = "$1" >
102
- < Box testId = "folder-path-1" > Root</ Box >
103
- { folder && < Box px = "$8" > { '>' } </ Box > }
104
- { folder && < Ellipsis text = { folder } beforeEllipsis = { 5 } afterEllipsis = { 5 } dataTestId = "folder-path-2" /> }
105
- </ Flex >
106
- )
107
- }
108
- ] }
109
- />
98
+ { folder && (
99
+ < Breadcrumb . Item >
100
+ < Ellipsis text = { folder } beforeEllipsis = { 5 } afterEllipsis = { 5 } dataTestId = "folder-path-2" />
101
+ </ Breadcrumb . Item >
102
+ ) }
103
+ </ Breadcrumb >
104
+ ) : (
105
+ < Flex justifyContent = "space-between" gap = "$1" >
106
+ < Box testId = "folder-path-1" > { rootKey } </ Box >
107
+ { folder && < Box px = "$8" > { '>' } </ Box > }
108
+ { folder && (
109
+ < Ellipsis text = { folder } beforeEllipsis = { 5 } afterEllipsis = { 5 } dataTestId = "folder-path-2" />
110
+ ) }
111
+ </ Flex >
112
+ )
113
+ }
114
+ ] }
115
+ />
116
+ </ div >
117
+ { attributes && (
118
+ < >
119
+ < div className = { styles . separator } />
120
+ < div data-testid = "nft-attributes" className = { styles . section } >
121
+ < h4 data-testid = "nft-attributes-label" > { translations . attributes } </ h4 >
122
+ < InlineInfoList items = { parseAttributes ( JSON . parse ( attributes ) ) } />
123
+ </ div >
124
+ </ >
125
+ ) }
110
126
</ div >
111
- { attributes && (
112
- < >
113
- < div className = { styles . separator } />
114
- < div data-testid = "nft-attributes" className = { styles . section } >
115
- < h4 data-testid = "nft-attributes-label" > { translations . attributes } </ h4 >
116
- < InlineInfoList items = { parseAttributes ( JSON . parse ( attributes ) ) } />
117
- </ div >
118
- </ >
119
- ) }
120
127
</ div >
121
- </ div >
122
- ) ;
128
+ ) ;
129
+ } ;
0 commit comments