Skip to content

Commit

Permalink
chore: Remove disabled button and update some texts
Browse files Browse the repository at this point in the history
  • Loading branch information
fzavalia committed Oct 4, 2021
1 parent 693c610 commit be19677
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export default class ReviewModal extends React.PureComponent<Props> {
case ReviewType.REJECT_CURATION:
onRejectCuration(curation!.collectionId)
break
case ReviewType.DISABLE:
onReject(collection)
break
default:
throw new Error(`Invalid review type: ${type}`)
}
Expand All @@ -50,8 +47,6 @@ export default class ReviewModal extends React.PureComponent<Props> {
return base + '.approve_curation'
case ReviewType.REJECT_CURATION:
return base + '.reject_curation'
case ReviewType.DISABLE:
return base + '.disable'
default:
throw new Error(`Invalid review type: ${type}`)
}
Expand Down Expand Up @@ -143,8 +138,6 @@ export default class ReviewModal extends React.PureComponent<Props> {
this.renderApproved()
) : type === ReviewType.REJECT_CURATION && curation?.status === 'rejected' ? (
this.renderRejected()
) : type === ReviewType.DISABLE && !collection.isApproved ? (
this.renderRejected()
) : (
this.renderReview()
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export enum ReviewType {
APPROVE = 'APPROVE',
REJECT = 'REJECT',
APPROVE_CURATION = 'APPROVE_CURATION',
REJECT_CURATION = 'REJECT_CURATION',
DISABLE = 'DISABLE',
REJECT_CURATION = 'REJECT_CURATION'
}

export type Props = {
Expand Down
9 changes: 5 additions & 4 deletions src/components/ItemEditorPage/TopPanel/TopPanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
}

.TopPanel .actions .button-container {
display: inline-block;
display: flex;
justify-content: flex-end;
}

.TopPanel .actions .ui.button {
padding-top: 8px;
padding-bottom: 8px;
margin-right: 8px;
padding: 8px 32px;
margin-right: 2px;
width: 50%;
}
31 changes: 9 additions & 22 deletions src/components/ItemEditorPage/TopPanel/TopPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { locations } from 'routing/locations'
import { Collection } from 'modules/collection/types'
import { Item } from 'modules/item/types'
import { Curation } from 'modules/curation/types'
import { hasReviews } from 'modules/collection/utils'
import CollectionProvider from 'components/CollectionProvider'
import JumpIn from 'components/JumpIn'
import ReviewModal from './ReviewModal'
import { ReviewType } from './ReviewModal/ReviewModal.types'
import { Props, State } from './TopPanel.types'

import './TopPanel.css'
import { Curation } from 'modules/curation/types'

export default class TopPanel extends React.PureComponent<Props, State> {
state: State = {
currentVeredict: undefined,
isApproveModalOpen: false,
isRejectModalOpen: false,
isApproveCurationModalOpen: false,
isRejectCurationModalOpen: false,
isDisableModalOpen: false
isRejectCurationModalOpen: false
}

handleBack = () => {
Expand All @@ -43,12 +43,8 @@ export default class TopPanel extends React.PureComponent<Props, State> {
this.setState({ isRejectCurationModalOpen })
}

setDisableModalVisibility = (isDisableModalOpen: boolean) => {
this.setState({ isDisableModalOpen })
}

renderPage = (collection: Collection, items: Item[], curation: Curation | null) => {
const { isApproveModalOpen, isRejectModalOpen, isApproveCurationModalOpen, isRejectCurationModalOpen, isDisableModalOpen } = this.state
const { isApproveModalOpen, isRejectModalOpen, isApproveCurationModalOpen, isRejectCurationModalOpen } = this.state
const { chainId } = this.props

const inCatalyst = this.inCatalyst(items)
Expand Down Expand Up @@ -100,13 +96,6 @@ export default class TopPanel extends React.PureComponent<Props, State> {
curation={curation}
onClose={() => this.setRejectCurationModalVisibility(false)}
/>
<ReviewModal
type={ReviewType.DISABLE}
open={isDisableModalOpen}
collection={collection}
curation={null}
onClose={() => this.setDisableModalVisibility(false)}
/>
</>
)
}
Expand All @@ -120,21 +109,19 @@ export default class TopPanel extends React.PureComponent<Props, State> {
[ReviewType.APPROVE]: this.setApproveModalVisibility,
[ReviewType.REJECT]: this.setRejectModalVisibility,
[ReviewType.APPROVE_CURATION]: this.setApproveCurationModalVisibility,
[ReviewType.REJECT_CURATION]: this.setRejectCurationModalVisibility,
[ReviewType.DISABLE]: this.setDisableModalVisibility
[ReviewType.REJECT_CURATION]: this.setRejectCurationModalVisibility
}

const textMap = {
[ReviewType.APPROVE]: 'approve',
[ReviewType.REJECT]: 'reject',
[ReviewType.APPROVE_CURATION]: 'approve_curation',
[ReviewType.REJECT_CURATION]: 'reject_curation',
[ReviewType.DISABLE]: 'disable'
[ReviewType.REJECT_CURATION]: 'reject_curation'
}

return (
<Button
primary={![ReviewType.REJECT, ReviewType.REJECT_CURATION].includes(reviewType)}
primary={[ReviewType.APPROVE, ReviewType.APPROVE_CURATION].includes(reviewType)}
onClick={() => onClickMap[reviewType](true)}
{...buttonProps}
>
Expand All @@ -157,13 +144,13 @@ export default class TopPanel extends React.PureComponent<Props, State> {
)
case 'approved':
case 'rejected':
return this.renderButton(ReviewType.DISABLE, buttonProps)
return this.renderButton(ReviewType.REJECT, buttonProps)
}
}

if (hasReviews(collection)) {
if (collection.isApproved) {
return this.renderButton(ReviewType.DISABLE, buttonProps)
return this.renderButton(ReviewType.REJECT, buttonProps)
} else {
return this.renderButton(ReviewType.APPROVE, buttonProps)
}
Expand Down
1 change: 0 additions & 1 deletion src/components/ItemEditorPage/TopPanel/TopPanel.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export type State = {
isRejectModalOpen: boolean
isApproveCurationModalOpen: boolean
isRejectCurationModalOpen: boolean
isDisableModalOpen: boolean
}

export type MapStateProps = Pick<Props, 'isReviewing' | 'isCommitteeMember' | 'selectedCollectionId' | 'chainId' | 'isConnected'>
Expand Down
14 changes: 4 additions & 10 deletions src/modules/translation/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1063,31 +1063,25 @@
"title": "Reject Collection",
"subtitle": "I guess it's just not good enough, huh?",
"tx_pending": "Waiting for reject transaction to confirm",
"action": "Reject"
"action": "Reject collection"
},
"approve": {
"title": "Approve Collection",
"subtitle": "If you feel this collection its up to Decentraland standards, approve it!",
"tx_pending": "Waiting for approve transaction to confirm",
"action": "Approve"
"action": "Approve collection"
},
"reject_curation": {
"title": "Reject Changes",
"subtitle": "I guess the changes are not good enough, huh?",
"tx_pending": "Waiting for reject changes transaction to confirm",
"action": "Reject"
"action": "Reject changes"
},
"approve_curation": {
"title": "Approve Changes",
"subtitle": "If you feel the changes applied to this collection are up to Decentraland standards, approve them!",
"tx_pending": "Waiting for approve changes transaction to confirm",
"action": "Approve"
},
"disable": {
"title": "Disable Collection",
"subtitle": "This collection will be unavailable until enabled again. Are you sure?",
"tx_pending": "Waiting for disable transaction to confirm",
"action": "Disable"
"action": "Approve changes"
}
},
"left_panel": {
Expand Down
14 changes: 4 additions & 10 deletions src/modules/translation/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1074,31 +1074,25 @@
"title": "Rechazar Colección",
"subtitle": "No es lo suficientemente buena?",
"tx_pending": "Esperando a que se confirme la transacción de rechazo",
"action": "Rechazar"
"action": "Rechazar colección"
},
"approve": {
"title": "Aprobar Colección",
"subtitle": "Si cree que esta colección está a la altura de los estándares de Decentraland, apruébela!",
"tx_pending": "Esperando a que se confirme la transacción de aprobación",
"action": "Aprobar"
"action": "Aprobar colección"
},
"reject_curation": {
"title": "Rechazar Cambios",
"subtitle": "Los cambios no son lo suficientemenete buenos?",
"tx_pending": "Esperando a que se confirme la transacción de rechazo",
"action": "Rechazar"
"action": "Rechazar cambios"
},
"approve_curation": {
"title": "Aprobar Cambios",
"subtitle": "Si cree que los cambios a esta colección estan a la altura de los estándares de Decentraland, apruébela!",
"tx_pending": "Esperando a que se confirme la transacción de aprobación",
"action": "Aprobar"
},
"disable": {
"title": "Deshabilitar Colección",
"subtitle": "Esta colección se deshabilitara hasta que sea habilitada nuevamente.",
"tx_pending": "Esperando a que se confirme la transacción de deshabilitado",
"action": "Deshabilitar"
"action": "Aprobar cambios"
}
},
"left_panel": {
Expand Down
14 changes: 4 additions & 10 deletions src/modules/translation/languages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1054,31 +1054,25 @@
"title": "拒绝收藏",
"subtitle": "我想还不够,是吧?",
"tx_pending": "等待拒绝交易确认",
"action": "拒绝"
"action": "拒绝收藏"
},
"approve": {
"title": "批准收藏",
"subtitle": "如果您觉得此收藏符合Decentraland标准,请批准它!",
"tx_pending": "等待批准交易以确认",
"action": "批准"
"action": "批准收藏"
},
"reject_curation": {
"title": "拒绝更改",
"subtitle": "我想这些变化还不够好, 嗯?",
"tx_pending": "等待拒绝更改交易以确认",
"action": "拒绝"
"action": "拒绝更改"
},
"approve_curation": {
"title": "批准更改",
"subtitle": "如果您认为适用于此集合的更改达到体面兰标准,请批准它们!",
"tx_pending": "等待批准更改交易以确认",
"action": "批准"
},
"disable": {
"title": "禁用集合",
"subtitle": "此集合在再次启用之前不可用。是否确定?",
"tx_pending": "等待禁用交易确认",
"action": "禁用"
"action": "批准更改"
}
},
"left_panel": {
Expand Down

0 comments on commit be19677

Please sign in to comment.