Privacy Paid Messages: Add unlock premium button (#5849)
This commit is contained in:
parent
05ff8a385b
commit
f1297f877b
@ -1931,6 +1931,7 @@
|
|||||||
"DescriptionRestrictedMedia" = "Posting media content is not allowed in this group.";
|
"DescriptionRestrictedMedia" = "Posting media content is not allowed in this group.";
|
||||||
"DescriptionScheduledPaidMediaNotAllowed" = "Posting scheduled paid media content is not allowed";
|
"DescriptionScheduledPaidMediaNotAllowed" = "Posting scheduled paid media content is not allowed";
|
||||||
"DescriptionScheduledPaidMessagesNotAllowed" = "Scheduled paid messages is not allowed";
|
"DescriptionScheduledPaidMessagesNotAllowed" = "Scheduled paid messages is not allowed";
|
||||||
|
"UnlockButtonTitle" = "Unlock with Telegram Premium";
|
||||||
"FrozenAccountModalTitle" = "Your Account is Frozen";
|
"FrozenAccountModalTitle" = "Your Account is Frozen";
|
||||||
"FrozenAccountViolationTitle" = "Violation of Terms";
|
"FrozenAccountViolationTitle" = "Violation of Terms";
|
||||||
"FrozenAccountViolationSubtitle" = "Your account was frozen for breaking Telegram's Terms and Conditions";
|
"FrozenAccountViolationSubtitle" = "Your account was frozen for breaking Telegram's Terms and Conditions";
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import useLastCallback from '../../../hooks/useLastCallback';
|
|||||||
import useOldLang from '../../../hooks/useOldLang';
|
import useOldLang from '../../../hooks/useOldLang';
|
||||||
|
|
||||||
import Icon from '../../common/icons/Icon';
|
import Icon from '../../common/icons/Icon';
|
||||||
|
import Button from '../../ui/Button';
|
||||||
import ListItem from '../../ui/ListItem';
|
import ListItem from '../../ui/ListItem';
|
||||||
import RadioGroup from '../../ui/RadioGroup';
|
import RadioGroup from '../../ui/RadioGroup';
|
||||||
import RangeSlider from '../../ui/RangeSlider';
|
import RangeSlider from '../../ui/RangeSlider';
|
||||||
@ -65,7 +66,7 @@ function PrivacyMessages({
|
|||||||
onReset,
|
onReset,
|
||||||
onScreenSelect,
|
onScreenSelect,
|
||||||
}: OwnProps & StateProps) {
|
}: OwnProps & StateProps) {
|
||||||
const { updateGlobalPrivacySettings } = getActions();
|
const { updateGlobalPrivacySettings, openPremiumModal } = getActions();
|
||||||
const oldLang = useOldLang();
|
const oldLang = useOldLang();
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|
||||||
@ -139,9 +140,13 @@ function PrivacyMessages({
|
|||||||
);
|
);
|
||||||
}, [lang, canChangeChargeForMessages]);
|
}, [lang, canChangeChargeForMessages]);
|
||||||
|
|
||||||
|
const handleUnlockWithPremium = useLastCallback(() => {
|
||||||
|
openPremiumModal({ initialSection: 'message_privacy' });
|
||||||
|
});
|
||||||
|
|
||||||
function renderSectionStarsAmountForPaidMessages() {
|
function renderSectionStarsAmountForPaidMessages() {
|
||||||
return (
|
return (
|
||||||
<div className="settings-item">
|
<div className="settings-item fluid-container">
|
||||||
<h4 className="settings-item-header" dir={oldLang.isRtl ? 'rtl' : undefined}>
|
<h4 className="settings-item-header" dir={oldLang.isRtl ? 'rtl' : undefined}>
|
||||||
{lang('SectionTitleStarsForForMessages')}
|
{lang('SectionTitleStarsForForMessages')}
|
||||||
</h4>
|
</h4>
|
||||||
@ -154,19 +159,36 @@ function PrivacyMessages({
|
|||||||
renderValue={renderValueForStarsRange}
|
renderValue={renderValueForStarsRange}
|
||||||
readOnly={!canChangeChargeForMessages}
|
readOnly={!canChangeChargeForMessages}
|
||||||
/>
|
/>
|
||||||
<p className="settings-item-description-larger" dir={oldLang.isRtl ? 'rtl' : undefined}>
|
{!isCurrentUserPremium && (
|
||||||
{lang('SectionDescriptionStarsForForMessages', {
|
<Button
|
||||||
percent: starsPaidMessageCommissionPermille * 100,
|
color="primary"
|
||||||
amount: formatCurrencyAsString(
|
fluid
|
||||||
chargeForMessages * starsUsdWithdrawRate * starsPaidMessageCommissionPermille,
|
size="smaller"
|
||||||
'USD',
|
noForcedUpperCase
|
||||||
lang.code,
|
className="settings-unlock-button"
|
||||||
|
onClick={handleUnlockWithPremium}
|
||||||
|
>
|
||||||
|
|
||||||
),
|
<span className="settings-unlock-button-title">
|
||||||
}, {
|
{lang('UnlockButtonTitle')}
|
||||||
withNodes: true,
|
<Icon name="lock-badge" className="settings-unlock-button-icon" />
|
||||||
})}
|
</span>
|
||||||
</p>
|
</Button>
|
||||||
|
)}
|
||||||
|
{isCurrentUserPremium && (
|
||||||
|
<p className="settings-item-description-larger" dir={oldLang.isRtl ? 'rtl' : undefined}>
|
||||||
|
{lang('SectionDescriptionStarsForForMessages', {
|
||||||
|
percent: starsPaidMessageCommissionPermille * 100,
|
||||||
|
amount: formatCurrencyAsString(
|
||||||
|
chargeForMessages * starsUsdWithdrawRate * starsPaidMessageCommissionPermille,
|
||||||
|
'USD',
|
||||||
|
lang.code,
|
||||||
|
),
|
||||||
|
}, {
|
||||||
|
withNodes: true,
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -228,7 +250,8 @@ function PrivacyMessages({
|
|||||||
</div>
|
</div>
|
||||||
{selectedValue === 'charge_for_messages' && renderSectionStarsAmountForPaidMessages()}
|
{selectedValue === 'charge_for_messages' && renderSectionStarsAmountForPaidMessages()}
|
||||||
{canChangeChargeForMessages && selectedValue === 'charge_for_messages' && renderSectionNoPaidMessagesForUsers()}
|
{canChangeChargeForMessages && selectedValue === 'charge_for_messages' && renderSectionNoPaidMessagesForUsers()}
|
||||||
{!isCurrentUserPremium && <PremiumStatusItem premiumSection="message_privacy" />}
|
{!isCurrentUserPremium && selectedValue !== 'charge_for_messages'
|
||||||
|
&& <PremiumStatusItem premiumSection="message_privacy" />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,6 +136,25 @@
|
|||||||
@include mixins.side-panel-section;
|
@include mixins.side-panel-section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings-unlock-button {
|
||||||
|
margin-inline: 1rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fluid-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-unlock-button-title {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-unlock-button-icon {
|
||||||
|
margin-inline-start: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.settings-item {
|
.settings-item {
|
||||||
&.no-border {
|
&.no-border {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|||||||
1
src/types/language.d.ts
vendored
1
src/types/language.d.ts
vendored
@ -1475,6 +1475,7 @@ export interface LangPair {
|
|||||||
'DescriptionRestrictedMedia': undefined;
|
'DescriptionRestrictedMedia': undefined;
|
||||||
'DescriptionScheduledPaidMediaNotAllowed': undefined;
|
'DescriptionScheduledPaidMediaNotAllowed': undefined;
|
||||||
'DescriptionScheduledPaidMessagesNotAllowed': undefined;
|
'DescriptionScheduledPaidMessagesNotAllowed': undefined;
|
||||||
|
'UnlockButtonTitle': undefined;
|
||||||
'PrivacySubscribeToTelegramPremium': undefined;
|
'PrivacySubscribeToTelegramPremium': undefined;
|
||||||
'PrivacyDisableLimitedEditionStarGifts': undefined;
|
'PrivacyDisableLimitedEditionStarGifts': undefined;
|
||||||
'PrivacyEnableLimitedEditionStarGifts': undefined;
|
'PrivacyEnableLimitedEditionStarGifts': undefined;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user