@@ -35,7 +35,7 @@ export default class TopPanel extends React.PureComponent<Props, State> {
35
35
setShowRejectionModal = ( showRejectionModal : RejectionType | null ) => this . setState ( { showRejectionModal } )
36
36
37
37
renderPage = ( collection : Collection ) => {
38
- const { items, itemCurations, curation, totalItems } = this . props
38
+ const { items, itemCurations, curation, totalItems, thirdParty } = this . props
39
39
const { showRejectionModal, showApproveConfirmModal } = this . state
40
40
const { chainId } = this . props
41
41
const type = getCollectionType ( collection )
@@ -71,6 +71,7 @@ export default class TopPanel extends React.PureComponent<Props, State> {
71
71
open = { true }
72
72
collection = { collection }
73
73
curation = { curation }
74
+ thirdParty = { thirdParty }
74
75
onClose = { ( ) => this . setShowRejectionModal ( null ) }
75
76
/>
76
77
) }
@@ -87,7 +88,7 @@ export default class TopPanel extends React.PureComponent<Props, State> {
87
88
}
88
89
89
90
renderButton = ( type : ButtonType , collection : Collection , curation : CollectionCuration | null ) => {
90
- const { address, onInitiateApprovalFlow, onInitiateTPApprovalFlow, reviewedItems, totalItems } = this . props
91
+ const { address, thirdParty , onInitiateApprovalFlow, onInitiateTPApprovalFlow, reviewedItems, totalItems } = this . props
91
92
92
93
const onClickMap = {
93
94
[ ButtonType . APPROVE ] : ( ) =>
@@ -97,7 +98,8 @@ export default class TopPanel extends React.PureComponent<Props, State> {
97
98
? onInitiateTPApprovalFlow ( collection )
98
99
: onInitiateApprovalFlow ( collection ) ,
99
100
[ ButtonType . ENABLE ] : ( ) => onInitiateApprovalFlow ( collection ) ,
100
- [ ButtonType . DISABLE ] : ( ) => this . setShowRejectionModal ( RejectionType . DISABLE_COLLECTION ) ,
101
+ [ ButtonType . DISABLE ] : ( ) =>
102
+ this . setShowRejectionModal ( thirdParty ? RejectionType . DISABLE_THIRD_PARTY : RejectionType . DISABLE_COLLECTION ) ,
101
103
[ ButtonType . REJECT ] : ( ) => {
102
104
if ( curation ?. status === CurationStatus . PENDING ) {
103
105
this . setShowRejectionModal ( RejectionType . REJECT_CURATION )
@@ -147,18 +149,20 @@ export default class TopPanel extends React.PureComponent<Props, State> {
147
149
}
148
150
149
151
renderTPButtons = ( collection : Collection , collectionCuration : CollectionCuration | null , itemCurations : ItemCuration [ ] | null ) => {
150
- const { reviewedItems, totalItems } = this . props
151
- const shouldShowApproveButton = itemCurations ?. some ( itemCuration => itemCuration . status === CurationStatus . PENDING )
152
+ const { reviewedItems, totalItems, thirdParty } = this . props
153
+ const areCurationsPending = itemCurations ?. some ( itemCuration => itemCuration . status === CurationStatus . PENDING )
152
154
return (
153
155
< >
154
156
< Header sub >
155
- { t ( 'item_editor.top_panel.reviewed_counter' , { count : reviewedItems . length , threshold : getTPThresholdToReview ( totalItems ! ) } ) }
157
+ { areCurationsPending
158
+ ? t ( 'item_editor.top_panel.reviewed_counter' , { count : reviewedItems . length , threshold : getTPThresholdToReview ( totalItems ! ) } )
159
+ : t ( 'item_editor.top_panel.not_enough_items_to_curate_more' ) }
156
160
{ reviewedItems . length >= getTPThresholdToReview ( totalItems ! ) ? < Icon name = "check circle" /> : null }
157
161
</ Header >
158
- { shouldShowApproveButton ? this . renderButton ( ButtonType . APPROVE , collection , collectionCuration ) : null }
159
- { this . renderButton ( ButtonType . REJECT , collection , collectionCuration ) }
160
- { /* TODO: the disable button from below is not the same as the original disable one, it will be implemented once the sagas are ready */ }
161
- { /* { this.renderButton(ButtonType.DISABLE , collection, collectionCuration )} */ }
162
+ { areCurationsPending && this . renderButton ( ButtonType . APPROVE , collection , collectionCuration ) }
163
+ { areCurationsPending && this . renderButton ( ButtonType . REJECT , collection , collectionCuration ) }
164
+ { ! areCurationsPending && thirdParty ?. isApproved && this . renderButton ( ButtonType . DISABLE , collection , null ) }
165
+ { /* TODO: Add when enabling is possible {!areCurationsPending && !thirdParty?.isApproved && thirdParty?.root && this.renderButton(ButtonType.ENABLE , collection, null )} */ }
162
166
</ >
163
167
)
164
168
}
0 commit comments