fix LbcMessage for single digit integers
This commit is contained in:
parent
6b8a38b894
commit
40d32a6065
2 changed files with 9 additions and 6 deletions
|
@ -9,15 +9,18 @@ type Props = {
|
||||||
|
|
||||||
export default function LbcMessage(props: Props) {
|
export default function LbcMessage(props: Props) {
|
||||||
let amount;
|
let amount;
|
||||||
const tokenizedMessage = props.children.replace(/(\d?\.?-?\d+?\.?-?\d+?)\s(LBC)/g, (originalString, lbcAmount) => {
|
const tokenizedMessage = props.children.replace(
|
||||||
amount = lbcAmount;
|
/(\d?\.?-?\d?\.?-?\d+?)\s(LBC)/g,
|
||||||
return `%lbc%`;
|
(originalString, lbcAmount, thirdArg) => {
|
||||||
});
|
amount = lbcAmount;
|
||||||
|
return `%lbc%`;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<I18nMessage tokens={{ lbc: amount ? <CreditAmount badge noFormat amount={amount} /> : undefined }}>
|
<I18nMessage tokens={{ lbc: amount ? <CreditAmount badge noFormat amount={amount} /> : undefined }}>
|
||||||
{/* Catch any rogue LBC's left */}
|
{/* Catch any rogue LBC's left */}
|
||||||
{tokenizedMessage.replace(/LBC/g, 'LBRY Credits')}
|
{tokenizedMessage.replace(/LBC/g, 'Credits')}
|
||||||
</I18nMessage>
|
</I18nMessage>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ const RewardLink = (props: Props) => {
|
||||||
<Button
|
<Button
|
||||||
button={button ? 'primary' : 'link'}
|
button={button ? 'primary' : 'link'}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
label={<LbcMessage test>{displayLabel}</LbcMessage>}
|
label={<LbcMessage>{displayLabel}</LbcMessage>}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
claimReward(reward);
|
claimReward(reward);
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in a new issue