Unique Gift: Show TON link (#5647)
Co-authored-by: Alexander Zinchuk <alx.zinchuk@gmail.com>
This commit is contained in:
parent
e8b4a4c00d
commit
f93f678ee5
@ -86,6 +86,7 @@ export interface GramJsAppConfig extends LimitsConfig {
|
||||
stargifts_message_length_max?: number;
|
||||
stargifts_convert_period_max?: number;
|
||||
starref_start_param_prefixes?: string[];
|
||||
ton_blockchain_explorer_url?: string;
|
||||
}
|
||||
|
||||
function buildEmojiSounds(appConfig: GramJsAppConfig) {
|
||||
@ -172,5 +173,6 @@ export function buildAppConfig(json: GramJs.TypeJSONValue, hash: number): ApiApp
|
||||
starGiftMaxMessageLength: appConfig.stargifts_message_length_max,
|
||||
starGiftMaxConvertPeriod: appConfig.stargifts_convert_period_max,
|
||||
starRefStartPrefixes: appConfig.starref_start_param_prefixes,
|
||||
tonExplorerUrl: appConfig.ton_blockchain_explorer_url,
|
||||
};
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ export function buildApiStarGift(starGift: GramJs.TypeStarGift): ApiStarGift {
|
||||
if (starGift instanceof GramJs.StarGiftUnique) {
|
||||
const {
|
||||
id, num, ownerId, ownerName, title, attributes, availabilityIssued, availabilityTotal, slug, ownerAddress,
|
||||
giftAddress,
|
||||
} = starGift;
|
||||
|
||||
return {
|
||||
@ -31,6 +32,7 @@ export function buildApiStarGift(starGift: GramJs.TypeStarGift): ApiStarGift {
|
||||
totalCount: availabilityTotal,
|
||||
issuedCount: availabilityIssued,
|
||||
slug,
|
||||
giftAddress,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -241,6 +241,7 @@ export interface ApiAppConfig {
|
||||
starGiftMaxMessageLength?: number;
|
||||
starGiftMaxConvertPeriod?: number;
|
||||
starRefStartPrefixes?: string[];
|
||||
tonExplorerUrl?: string;
|
||||
}
|
||||
|
||||
export interface ApiConfig {
|
||||
|
||||
@ -218,6 +218,7 @@ export interface ApiStarGiftUnique {
|
||||
totalCount: number;
|
||||
attributes: ApiStarGiftAttribute[];
|
||||
slug: string;
|
||||
giftAddress?: string;
|
||||
}
|
||||
|
||||
export type ApiStarGift = ApiStarGiftRegular | ApiStarGiftUnique;
|
||||
|
||||
@ -1405,6 +1405,8 @@
|
||||
"GiftInfoChannelHidden" = "This gift is hidden from visitors of your channel. {link}";
|
||||
"GiftInfoSavedHide" = "Hide >";
|
||||
"GiftInfoSavedShow" = "Show >";
|
||||
"GiftInfoTonText" = "This gift is on the TON Blockchain. {link}";
|
||||
"GiftInfoTonLinkText" = "View >";
|
||||
"GiftInfoAvailability" = "Availability";
|
||||
"GiftInfoAvailabilityValue_one" = "{count} of {total} left";
|
||||
"GiftInfoAvailabilityValue_other" = "{count} of {total} left";
|
||||
@ -1569,7 +1571,8 @@
|
||||
"ActionUnsupportedDescription" = "Please use one of our apps to complete this action.";
|
||||
"LocationPermissionText" = "**{name}** requests access to set your **location**. You will be able to revoke this access in the profile page of **{name}**.";
|
||||
"UnlockMoreSimilarBots" = "Show More Apps";
|
||||
"MoreSimilarBotsText" = "Subscribe to **Telegram Premium** to unlock up to {count} similar apps.";
|
||||
"MoreSimilarBotsDescription_one" = "Subscribe to **Telegram Premium** to unlock up to {count} similar bot.";
|
||||
"MoreSimilarBotsDescription_other" = "Subscribe to **Telegram Premium** to unlock up to {count} similar bots.";
|
||||
"GiftWasNotFound" = "Gift was not found";
|
||||
"ViewButtonRequestJoin" = "REQUEST TO JOIN";
|
||||
"ViewButtonMessage" = "VIEW MESSAGE";
|
||||
|
||||
@ -33,6 +33,7 @@ import AnimatedIconFromSticker from '../../../common/AnimatedIconFromSticker';
|
||||
import Avatar from '../../../common/Avatar';
|
||||
import BadgeButton from '../../../common/BadgeButton';
|
||||
import Icon from '../../../common/icons/Icon';
|
||||
import SafeLink from '../../../common/SafeLink';
|
||||
import Button from '../../../ui/Button';
|
||||
import ConfirmDialog from '../../../ui/ConfirmDialog';
|
||||
import DropdownMenu from '../../../ui/DropdownMenu';
|
||||
@ -55,6 +56,7 @@ type StateProps = {
|
||||
hasAdminRights?: boolean;
|
||||
currentUserEmojiStatus?: ApiEmojiStatusType;
|
||||
collectibleEmojiStatuses?: ApiEmojiStatusType[];
|
||||
tonExplorerUrl?: string;
|
||||
};
|
||||
|
||||
const STICKER_SIZE = 120;
|
||||
@ -68,6 +70,7 @@ const GiftInfoModal = ({
|
||||
hasAdminRights,
|
||||
currentUserEmojiStatus,
|
||||
collectibleEmojiStatuses,
|
||||
tonExplorerUrl,
|
||||
}: OwnProps & StateProps) => {
|
||||
const {
|
||||
closeGiftInfoModal,
|
||||
@ -599,21 +602,34 @@ const GiftInfoModal = ({
|
||||
}
|
||||
}
|
||||
|
||||
const tonLink = tonExplorerUrl && isGiftUnique && gift.giftAddress && (
|
||||
`${tonExplorerUrl}${gift.giftAddress}`
|
||||
);
|
||||
|
||||
const footer = (
|
||||
<div className={styles.footer}>
|
||||
{canUpdate && (
|
||||
{(canUpdate || tonLink) && (
|
||||
<div className={styles.footerDescription}>
|
||||
<div>
|
||||
{lang(`GiftInfo${isTargetChat ? 'Channel' : ''}${isUnsaved ? 'Hidden' : 'Saved'}`, {
|
||||
link: (
|
||||
<Link isPrimary onClick={handleTriggerVisibility}>
|
||||
{lang(`GiftInfoSaved${isUnsaved ? 'Show' : 'Hide'}`)}
|
||||
</Link>
|
||||
),
|
||||
}, {
|
||||
withNodes: true,
|
||||
})}
|
||||
</div>
|
||||
{tonLink && (
|
||||
<div>
|
||||
{lang('GiftInfoTonText', {
|
||||
link: <SafeLink url={tonLink} text={lang('GiftInfoTonLinkText')} />,
|
||||
}, { withNodes: true })}
|
||||
</div>
|
||||
)}
|
||||
{canUpdate && (
|
||||
<div>
|
||||
{lang(`GiftInfo${isTargetChat ? 'Channel' : ''}${isUnsaved ? 'Hidden' : 'Saved'}`, {
|
||||
link: (
|
||||
<Link isPrimary onClick={handleTriggerVisibility}>
|
||||
{lang(`GiftInfoSaved${isUnsaved ? 'Show' : 'Hide'}`)}
|
||||
</Link>
|
||||
),
|
||||
}, {
|
||||
withNodes: true,
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
{isVisibleForMe && (
|
||||
<div>
|
||||
{lang('GiftInfoSenderHidden')}
|
||||
@ -633,7 +649,7 @@ const GiftInfoModal = ({
|
||||
};
|
||||
}, [
|
||||
typeGift, savedGift, renderingTargetPeer, giftSticker, lang,
|
||||
canUpdate, canConvertDifference, isSender, oldLang,
|
||||
canUpdate, canConvertDifference, isSender, oldLang, tonExplorerUrl,
|
||||
gift, giftAttributes, renderFooterButton, isTargetChat,
|
||||
SettingsMenuButton, isOpen, isGiftUnique, canWear, canTakeOff,
|
||||
]);
|
||||
@ -703,6 +719,7 @@ export default memo(withGlobal<OwnProps>(
|
||||
targetPeer,
|
||||
currentUserId: global.currentUserId,
|
||||
starGiftMaxConvertPeriod: global.appConfig?.starGiftMaxConvertPeriod,
|
||||
tonExplorerUrl: global.appConfig?.tonExplorerUrl,
|
||||
hasAdminRights,
|
||||
currentUserEmojiStatus,
|
||||
collectibleEmojiStatuses,
|
||||
|
||||
@ -807,9 +807,10 @@ const Profile: FC<OwnProps & StateProps> = ({
|
||||
<Icon name="unlock-badge" />
|
||||
</Button>
|
||||
<div className="more-similar">
|
||||
{renderText(lang('MoreSimilarBotsText', { count: limitSimilarPeers }, {
|
||||
{renderText(lang('MoreSimilarBotsDescription', { count: limitSimilarPeers }, {
|
||||
withNodes: true,
|
||||
withMarkdown: true,
|
||||
pluralValue: limitSimilarPeers,
|
||||
}))}
|
||||
</div>
|
||||
</>
|
||||
|
||||
10
src/types/language.d.ts
vendored
10
src/types/language.d.ts
vendored
@ -1178,6 +1178,7 @@ export interface LangPair {
|
||||
'GiftInfoConvertDescription2': undefined;
|
||||
'GiftInfoSavedHide': undefined;
|
||||
'GiftInfoSavedShow': undefined;
|
||||
'GiftInfoTonLinkText': undefined;
|
||||
'GiftInfoAvailability': undefined;
|
||||
'GiftInfoFirstSale': undefined;
|
||||
'GiftInfoLastSale': undefined;
|
||||
@ -1768,6 +1769,9 @@ export interface LangPairWithVariables<V extends unknown = LangVariable> {
|
||||
'GiftInfoChannelHidden': {
|
||||
'link': V;
|
||||
};
|
||||
'GiftInfoTonText': {
|
||||
'link': V;
|
||||
};
|
||||
'GiftInfoIssued': {
|
||||
'issued': V;
|
||||
'total': V;
|
||||
@ -1892,9 +1896,6 @@ export interface LangPairWithVariables<V extends unknown = LangVariable> {
|
||||
'LocationPermissionText': {
|
||||
'name': V;
|
||||
};
|
||||
'MoreSimilarBotsText': {
|
||||
'count': V;
|
||||
};
|
||||
'ActionPinnedText': {
|
||||
'from': V;
|
||||
'text': V;
|
||||
@ -2424,6 +2425,9 @@ export interface LangPairPluralWithVariables<V extends unknown = LangVariable> {
|
||||
'FolderLinkNotificationUpdatedSubtitle': {
|
||||
'count': V;
|
||||
};
|
||||
'MoreSimilarBotsDescription': {
|
||||
'count': V;
|
||||
};
|
||||
'ActionGameScore': {
|
||||
'from': V;
|
||||
'count': V;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user