lbry-desktop/ui/component/common/premium-badge.jsx
infinite-persistence 32d5eaf8e1 Don't translate 'Premium/Premium+'
- Forgot that we've concluded to not translate 'Premium/Premium+' and keep that as a product name. This is the same as competitors.
- For other instances of "Premium" in a longer string, we'll just have to communicate with translators to not translate it.
- Remove a few old strings.
2022-03-16 20:56:40 -04:00

46 lines
1.2 KiB
JavaScript

// @flow
import 'scss/component/_comment-badge.scss';
import * as ICONS from 'constants/icons';
import React from 'react';
import CommentBadge from './comment-badge';
import Button from 'component/button';
type Props = {
membership: ?string,
linkPage?: boolean,
placement?: string,
className?: string,
hideTooltip?: boolean,
};
export default function PremiumBadge(props: Props) {
const { membership, linkPage, placement, className, hideTooltip } = props;
const badgeToShow = membership === 'Premium' ? 'silver' : membership === 'Premium+' ? 'gold' : null;
if (!badgeToShow) return null;
const badgeProps = { size: 40, placement, hideTooltip, className };
return (
<BadgeWrapper linkPage={linkPage}>
{badgeToShow === 'silver' ? (
<CommentBadge label={'Premium'} icon={ICONS.PREMIUM} {...badgeProps} />
) : (
badgeToShow === 'gold' && <CommentBadge label={'Premium+'} icon={ICONS.PREMIUM_PLUS} {...badgeProps} />
)}
</BadgeWrapper>
);
}
type WrapperProps = {
linkPage?: boolean,
children: any,
};
const BadgeWrapper = (props: WrapperProps) => {
const { linkPage, children } = props;
return linkPage ? <Button navigate="/$/membership">{children}</Button> : children;
};