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) {
|
||||
let amount;
|
||||
const tokenizedMessage = props.children.replace(/(\d?\.?-?\d+?\.?-?\d+?)\s(LBC)/g, (originalString, lbcAmount) => {
|
||||
const tokenizedMessage = props.children.replace(
|
||||
/(\d?\.?-?\d?\.?-?\d+?)\s(LBC)/g,
|
||||
(originalString, lbcAmount, thirdArg) => {
|
||||
amount = lbcAmount;
|
||||
return `%lbc%`;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return (
|
||||
<I18nMessage tokens={{ lbc: amount ? <CreditAmount badge noFormat amount={amount} /> : undefined }}>
|
||||
{/* Catch any rogue LBC's left */}
|
||||
{tokenizedMessage.replace(/LBC/g, 'LBRY Credits')}
|
||||
{tokenizedMessage.replace(/LBC/g, 'Credits')}
|
||||
</I18nMessage>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ const RewardLink = (props: Props) => {
|
|||
<Button
|
||||
button={button ? 'primary' : 'link'}
|
||||
disabled={isPending}
|
||||
label={<LbcMessage test>{displayLabel}</LbcMessage>}
|
||||
label={<LbcMessage>{displayLabel}</LbcMessage>}
|
||||
onClick={() => {
|
||||
claimReward(reward);
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue