Preorder cleanup

Reported issues that weren't completed in de068d36
This commit is contained in:
infinite-persistence 2022-06-28 13:25:46 +08:00
parent 1bf3f492ff
commit 1933997276
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
6 changed files with 14 additions and 26 deletions

View file

@ -2081,7 +2081,6 @@
"Currency --[transactions tab]--": "Currency",
"Receiving Channel Name": "Receiving Channel Name",
"Tip Location": "Tip Location",
"Amount (USD)": "Amount (USD)",
"Processing Fee": "Processing Fee",
"Odysee Fee": "Odysee Fee",
"Received Amount": "Received Amount",

View file

@ -117,7 +117,7 @@ export default function FileActions(props: Props) {
<div className="media__actions">
{ENABLE_FILE_REACTIONS && <FileReactions uri={uri} />}
{ !isAPreorder && <ClaimSupportButton uri={uri} fileAction />}
{!isAPreorder && <ClaimSupportButton uri={uri} fileAction />}
<ClaimCollectionAddButton uri={uri} fileAction />

View file

@ -59,11 +59,8 @@ export default function PreorderContent(props: Props) {
setTipAmount(Number(preorderTag));
}, [preorderTag]);
/** STATE **/
const [tipAmount, setTipAmount] = React.useState(0);
const [waitingForBackend, setWaitingForBackend] = React.useState(false);
const [hasCardSaved, setHasSavedCard] = React.useState(true);
// check if user has a payment method saved
@ -89,12 +86,10 @@ export default function PreorderContent(props: Props) {
}, [setHasSavedCard]);
const modalHeaderText = __('Preorder Your Content');
let subtitleText = __(
'This content is not available yet but you can pre-order ' + 'it now so you can access it as soon as it goes live'
const subtitleText = __(
'This content is not available yet but you can pre-order it now so you can access it as soon as it goes live.'
);
// when the form button is clicked
function handleSubmit() {
const tipParams: TipParams = {
tipAmount,
@ -123,15 +118,12 @@ export default function PreorderContent(props: Props) {
);
}
let fiatSymbolToUse = '$';
if (preferredCurrency === 'EUR') {
fiatSymbolToUse = '€';
}
const fiatSymbolToUse = preferredCurrency === 'EUR' ? '€' : '$';
function buildButtonText() {
return __('Preorder your content for %fiatSymbolToUse%%tipAmount%', {
fiatSymbolToUse,
tipAmount: tipAmount.toString(),
return __('Preorder your content for %tip_currency%%tip_amount%', {
tip_currency: fiatSymbolToUse,
tip_amount: tipAmount.toString(),
});
}
@ -156,6 +148,7 @@ export default function PreorderContent(props: Props) {
{!hasCardSaved && (
<div className="add-card-prompt">
{/* FIX_THIS: no split strings please. Use <i18Message> */}
<Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add a Card')} button="link" />
{' ' + __('To Preorder Content')}
</div>

View file

@ -1,9 +1,9 @@
import { connect } from 'react-redux';
import { doHideModal } from 'redux/actions/app';
import ModalSendTip from './view';
import ModalPreorderContent from './view';
const perform = {
doHideModal,
};
export default connect(null, perform)(ModalSendTip);
export default connect(null, perform)(ModalPreorderContent);

View file

@ -9,20 +9,16 @@ type Props = {
checkIfAlreadyPurchased: () => void,
};
class ModalSendTip extends React.PureComponent<Props> {
class ModalPreorderContent extends React.PureComponent<Props> {
render() {
const { uri, doHideModal, checkIfAlreadyPurchased } = this.props;
return (
<Modal onAborted={doHideModal} isOpen type="card">
<PreorderContent
uri={uri}
onCancel={doHideModal}
checkIfAlreadyPurchased={checkIfAlreadyPurchased}
/>
<PreorderContent uri={uri} onCancel={doHideModal} checkIfAlreadyPurchased={checkIfAlreadyPurchased} />
</Modal>
);
}
}
export default ModalSendTip;
export default ModalPreorderContent;

View file

@ -225,7 +225,7 @@ export default function FilePage(props: Props) {
{!isMarkdown && (
<div className="file-page__secondary-content">
<section className="file-page__media-actions">
<PreorderButton uri={uri} />
<PreorderButton uri={uri} />
{claimIsMine && isLivestream && (
<div className="livestream__creator-message">
<h4>{__('Only visible to you')}</h4>