fix channel revoke confirmation

This commit is contained in:
jessop 2020-06-07 15:17:18 -04:00 committed by Sean Yesmunt
parent 91662a9d57
commit 9758286ad8
2 changed files with 14 additions and 16 deletions

View file

@ -1202,5 +1202,7 @@
"Sending information to third parties (e.g. Google Analytics or Mixpanel) allows us to use detailed\n analytical reports to improve all aspects of LBRY.": "Sending information to third parties (e.g. Google Analytics or Mixpanel) allows us to use detailed\n analytical reports to improve all aspects of LBRY.",
"Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as\n well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.": "Sharing information with LBRY, Inc. allows us to report to publishers how their content is doing, as\n well as track basic usage and performance. This is the minimum required to earn rewards from LBRY, Inc.",
"No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.": "No information will be sent directly to LBRY, Inc. or third-parties about your usage. Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.",
"%view_count% Views": "%view_count% Views"
"%view_count% Views": "%view_count% Views",
"This channel hasn't published anything yet": "This channel hasn't published anything yet",
"Buy": "Buy"
}

View file

@ -20,6 +20,9 @@ export default function ModalRevokeClaim(props: Props) {
const { value_type: valueType, type, normalized_name: name, is_my_input: isSupport } = tx || claim;
const [channelName, setChannelName] = useState('');
const shouldConfirmChannel =
valueType === txnTypes.CHANNEL || type === txnTypes.CHANNEL || (type === txnTypes.UPDATE && name.startsWith('@'));
function getButtonLabel(type: string, isSupport: boolean) {
if (isSupport && type === txnTypes.SUPPORT) {
return 'Confirm Support Revoke';
@ -52,11 +55,7 @@ export default function ModalRevokeClaim(props: Props) {
</p>
</React.Fragment>
);
} else if (
valueType === txnTypes.CHANNEL ||
type === txnTypes.CHANNEL ||
(type === txnTypes.UPDATE && name.startsWith('@'))
) {
} else if (shouldConfirmChannel) {
return (
<React.Fragment>
<p>
@ -91,21 +90,18 @@ export default function ModalRevokeClaim(props: Props) {
const label = getButtonLabel(type, isSupport);
return (
<Modal
isOpen
contentLabel={label}
type="card"
confirmButtonLabel={label}
onConfirmed={revokeClaim}
onAborted={closeModal}
confirmButtonDisabled={valueType === txnTypes.CHANNEL && name !== channelName}
>
<Modal isOpen contentLabel={label} type="card" onAborted={closeModal}>
<Card
title={label}
body={getMsgBody(type, isSupport, name)}
actions={
<div className="section__actions">
<Button button="primary" label={label} onClick={revokeClaim} />
<Button
disabled={shouldConfirmChannel && name !== channelName}
button="primary"
label={label}
onClick={revokeClaim}
/>
<Button button="link" label={__('Cancel')} onClick={closeModal} />
</div>
}