Lint and cleanup. No functional change.

This commit is contained in:
infinite-persistence 2021-07-29 21:07:23 +08:00
parent 4ff32e0c61
commit 7537b5ae7b
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
2 changed files with 15 additions and 22 deletions

View file

@ -72,8 +72,7 @@ export function CommentCreate(props: Props) {
sendTip,
doToast,
} = props;
const buttonref: ElementRef<any> = React.useRef();
const buttonRef: ElementRef<any> = React.useRef();
const {
push,
location: { pathname },
@ -89,11 +88,8 @@ export function CommentCreate(props: Props) {
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
const hasChannels = channels && channels.length;
const charCount = commentValue.length;
const [activeTab, setActiveTab] = React.useState('');
const [tipError, setTipError] = React.useState();
const disabled = isSubmitting || !activeChannelClaim || !commentValue.length;
const [shouldDisableReviewButton, setShouldDisableReviewButton] = React.useState();
@ -112,7 +108,7 @@ export function CommentCreate(props: Props) {
const KEYCODE_ENTER = 13;
if ((livestream || e.ctrlKey || e.metaKey) && e.keyCode === KEYCODE_ENTER) {
e.preventDefault();
buttonref.current.click();
buttonRef.current.click();
}
}
@ -186,8 +182,7 @@ export function CommentCreate(props: Props) {
}
const sourceClaimId = claim.claim_id;
var roundedAmount = Math.round(tipAmount * 100) / 100;
const roundedAmount = Math.round(tipAmount * 100) / 100;
Lbryio.call(
'customer',
@ -206,8 +201,6 @@ export function CommentCreate(props: Props) {
'post'
)
.then((customerTipResponse) => {
console.log(customerTipResponse);
const paymentIntendId = customerTipResponse.payment_intent_id;
handleCreateComment(null, paymentIntendId, stripeEnvironment);
@ -227,14 +220,14 @@ export function CommentCreate(props: Props) {
// handleCreateComment(null);
})
.catch(function (error) {
var displayError = 'Sorry, there was an error in processing your payment!';
if (error.message !== 'payment intent failed to confirm') {
displayError = error.message;
}
doToast({ message: displayError, isError: true });
.catch((error) => {
doToast({
message:
error.message !== 'payment intent failed to confirm'
? error.message
: 'Sorry, there was an error in processing your payment!',
isError: true,
});
});
}
}
@ -263,7 +256,7 @@ export function CommentCreate(props: Props) {
}
}
})
.catch((e) => {
.catch(() => {
setIsSubmitting(false);
setCommentFailure(true);
});
@ -313,7 +306,7 @@ export function CommentCreate(props: Props) {
<div className="comment__create">
<div className="comment__sc-preview">
<CreditAmount
className="comment__scpreview-amount"
className="comment__sc-preview-amount"
isFiat={activeTab === TAB_FIAT}
amount={tipAmount}
size={activeTab === TAB_LBC ? 18 : 2}
@ -406,7 +399,7 @@ export function CommentCreate(props: Props) {
) : (
<>
<Button
ref={buttonref}
ref={buttonRef}
button="primary"
disabled={disabled}
type="submit"

View file

@ -127,7 +127,7 @@ $thumbnailWidthSmall: 1rem;
margin-top: var(--spacing-xxs);
}
.comment__scpreview-amount {
.comment__sc-preview-amount {
margin-right: var(--spacing-m);
font-size: var(--font-large);
}