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", "Currency --[transactions tab]--": "Currency",
"Receiving Channel Name": "Receiving Channel Name", "Receiving Channel Name": "Receiving Channel Name",
"Tip Location": "Tip Location", "Tip Location": "Tip Location",
"Amount (USD)": "Amount (USD)",
"Processing Fee": "Processing Fee", "Processing Fee": "Processing Fee",
"Odysee Fee": "Odysee Fee", "Odysee Fee": "Odysee Fee",
"Received Amount": "Received Amount", "Received Amount": "Received Amount",

View file

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

View file

@ -59,11 +59,8 @@ export default function PreorderContent(props: Props) {
setTipAmount(Number(preorderTag)); setTipAmount(Number(preorderTag));
}, [preorderTag]); }, [preorderTag]);
/** STATE **/
const [tipAmount, setTipAmount] = React.useState(0); const [tipAmount, setTipAmount] = React.useState(0);
const [waitingForBackend, setWaitingForBackend] = React.useState(false); const [waitingForBackend, setWaitingForBackend] = React.useState(false);
const [hasCardSaved, setHasSavedCard] = React.useState(true); const [hasCardSaved, setHasSavedCard] = React.useState(true);
// check if user has a payment method saved // check if user has a payment method saved
@ -89,12 +86,10 @@ export default function PreorderContent(props: Props) {
}, [setHasSavedCard]); }, [setHasSavedCard]);
const modalHeaderText = __('Preorder Your Content'); const modalHeaderText = __('Preorder Your Content');
const subtitleText = __(
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.'
'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() { function handleSubmit() {
const tipParams: TipParams = { const tipParams: TipParams = {
tipAmount, tipAmount,
@ -123,15 +118,12 @@ export default function PreorderContent(props: Props) {
); );
} }
let fiatSymbolToUse = '$'; const fiatSymbolToUse = preferredCurrency === 'EUR' ? '€' : '$';
if (preferredCurrency === 'EUR') {
fiatSymbolToUse = '€';
}
function buildButtonText() { function buildButtonText() {
return __('Preorder your content for %fiatSymbolToUse%%tipAmount%', { return __('Preorder your content for %tip_currency%%tip_amount%', {
fiatSymbolToUse, tip_currency: fiatSymbolToUse,
tipAmount: tipAmount.toString(), tip_amount: tipAmount.toString(),
}); });
} }
@ -156,6 +148,7 @@ export default function PreorderContent(props: Props) {
{!hasCardSaved && ( {!hasCardSaved && (
<div className="add-card-prompt"> <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" /> <Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add a Card')} button="link" />
{' ' + __('To Preorder Content')} {' ' + __('To Preorder Content')}
</div> </div>

View file

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

View file

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

View file

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