{lang('GiftUnique', { title: action.gift.title, number: action.gift.number })}
diff --git a/src/components/modals/gift/UniqueGiftHeader.tsx b/src/components/modals/gift/UniqueGiftHeader.tsx
index 924fb49c4..04b6d46d0 100644
--- a/src/components/modals/gift/UniqueGiftHeader.tsx
+++ b/src/components/modals/gift/UniqueGiftHeader.tsx
@@ -34,7 +34,7 @@ type OwnProps = {
modelAttribute: ApiStarGiftAttributeModel;
backdropAttribute: ApiStarGiftAttributeBackdrop;
patternAttribute: ApiStarGiftAttributePattern;
- title?: string;
+ title?: TeactNode;
badge?: TeactNode;
subtitle?: TeactNode;
subtitlePeer?: ApiPeer;
@@ -114,7 +114,7 @@ const UniqueGiftHeader = ({
{Boolean(badge) && (
{badge}
)}
- {title &&
{title}
}
+ {Boolean(title) &&
{title}
}
{Boolean(subtitle) && (
{
- if (!gift || gift.type !== 'starGiftUnique') return undefined;
-
- if (releasedByPeer) {
- const releasedByUsername = `@${getMainUsername(releasedByPeer)}`;
- const ownerTitle = releasedByUsername || getPeerTitle(lang, releasedByPeer);
- const fallbackText = isApiPeerUser(releasedByPeer)
- ? lang('ActionFallbackUser')
- : lang('ActionFallbackChannel');
-
- return lang('GiftInfoCollectibleBy', {
- number: gift.number, owner: ownerTitle || fallbackText }, {
- withNodes: true,
- withMarkdown: true,
- });
- }
-
- return lang('GiftInfoCollectible', { number: gift.number });
- }, [gift, releasedByPeer, lang]);
-
const starGiftUniqueSlug = gift?.type === 'starGiftUnique' ? gift.slug : undefined;
const selfCollectibleStatus = useMemo(() => {
@@ -322,6 +303,42 @@ const GiftInfoModal = ({
return gift && getGiftAttributes(gift);
}, [gift]);
+ const uniqueGiftTitle = useMemo(() => {
+ if (!gift || gift.type !== 'starGiftUnique' || !giftAttributes?.backdrop) return undefined;
+
+ const numberColor = giftAttributes.backdrop.textColor;
+ const digitCount = String(gift.number).length;
+ const numberSizeClass = digitCount >= 6 ? styles.small : styles.regular;
+ const styledNumber = (
+
+ {lang('GiftSavedNumber', { number: gift.number })}
+
+ );
+
+ return lang('GiftInfoUniqueTitle', {
+ name: gift.title,
+ number: styledNumber,
+ }, { withNodes: true });
+ }, [gift, giftAttributes, lang]);
+
+ const uniqueGiftSubtitle = useMemo(() => {
+ if (!gift || gift.type !== 'starGiftUnique') return undefined;
+
+ if (releasedByPeer) {
+ const releasedByUsername = `@${getMainUsername(releasedByPeer)}`;
+ const ownerTitle = releasedByUsername || getPeerTitle(lang, releasedByPeer);
+ const fallbackText = isApiPeerUser(releasedByPeer)
+ ? lang('ActionFallbackUser')
+ : lang('ActionFallbackChannel');
+
+ return ownerTitle || fallbackText;
+ }
+
+ const modelName = giftAttributes?.model?.name;
+
+ return modelName;
+ }, [gift, giftAttributes, releasedByPeer, lang]);
+
const renderFooterButton = useLastCallback(() => {
if (canBuyGift) {
return (
@@ -551,8 +568,8 @@ const GiftInfoModal = ({
backdropAttribute={giftAttributes!.backdrop!}
patternAttribute={giftAttributes!.pattern!}
modelAttribute={giftAttributes!.model!}
- title={gift.title}
- subtitle={giftSubtitle}
+ title={uniqueGiftTitle}
+ subtitle={uniqueGiftSubtitle}
subtitlePeer={releasedByPeer}
showManageButtons={canManage}
savedGift={savedGift}
@@ -699,7 +716,7 @@ const GiftInfoModal = ({
>
{model.name}
- {getGiftRarityTitle(lang, model.rarity)}
+
,
]);
}
@@ -856,8 +873,8 @@ const GiftInfoModal = ({
canManage, hasConvertOption, isSender, oldLang, tonExplorerUrl,
gift, giftAttributes, renderFooterButton, isTargetChat,
isGiftUnique, saleDateInfo,
- canBuyGift, giftOwnerTitle, resellPrice, giftSubtitle,
- releasedByPeer, handleSymbolClick, handleBackdropClick, handleModelClick,
+ canBuyGift, giftOwnerTitle, resellPrice, uniqueGiftTitle, uniqueGiftSubtitle, releasedByPeer,
+ handleSymbolClick, handleBackdropClick, handleModelClick,
]);
const moreMenuItems = typeGift && (
diff --git a/src/global/actions/api/payments.ts b/src/global/actions/api/payments.ts
index dca1b3984..0a7d6450b 100644
--- a/src/global/actions/api/payments.ts
+++ b/src/global/actions/api/payments.ts
@@ -1234,19 +1234,20 @@ addActionHandler('openUniqueGiftBySlug', async (global, actions, payload): Promi
slug, tabId = getCurrentTabId(),
} = payload;
- const gift = await callApi('fetchUniqueStarGift', { slug });
+ const result = await callApi('fetchUniqueStarGift', { slug });
- if (!gift) {
+ if (!result || 'error' in result) {
+ const isBurned = result && 'error' in result && result.errorMessage === 'STARGIFT_ALREADY_BURNED';
actions.showNotification({
message: {
- key: 'GiftWasNotFound',
+ key: isBurned ? 'ActionStarGiftUniqueBurnedError' : 'GiftWasNotFound',
},
tabId,
});
return;
}
- actions.openGiftInfoModal({ gift, tabId });
+ actions.openGiftInfoModal({ gift: result, tabId });
});
addActionHandler('openGiftAuctionBySlug', async (global, actions, payload): Promise => {
diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss
index 1a8e8837d..4183dac30 100644
--- a/src/styles/_variables.scss
+++ b/src/styles/_variables.scss
@@ -209,6 +209,15 @@ $color-message-story-mention-to: #74bcff;
--color-stars: #FFAA00;
--color-heart: #ff3c32;
+ --color-gift-uncommon: #40A920;
+ --color-gift-uncommon-bg: rgba(64, 169, 32, 0.15);
+ --color-gift-rare: #11AABE;
+ --color-gift-rare-bg: rgba(17, 170, 190, 0.15);
+ --color-gift-epic: #955CDB;
+ --color-gift-epic-bg: rgba(149, 92, 219, 0.15);
+ --color-gift-legendary: #BF7600;
+ --color-gift-legendary-bg: rgba(191, 118, 0, 0.15);
+
--color-negative-progress: #CE4C47;
--vh: 1vh;
diff --git a/src/types/language.d.ts b/src/types/language.d.ts
index 537cf28e4..fe287703e 100644
--- a/src/types/language.d.ts
+++ b/src/types/language.d.ts
@@ -1521,6 +1521,8 @@ export interface LangPair {
'ActionGiftUniqueSent': undefined;
'ActionStarGiftUpgradedSelf': undefined;
'ActionStarGiftTransferredSelf': undefined;
+ 'ActionStarGiftCraftedSelf': undefined;
+ 'ActionStarGiftCrafted': undefined;
'ActionStarGiftTransferredUnknown': undefined;
'ActionStarGiftNoConvertTextYou': undefined;
'ActionStarGiftDisplaying': undefined;
@@ -1529,6 +1531,8 @@ export interface LangPair {
'ActionStarGiftUpgraded': undefined;
'ActionStarGiftUnpack': undefined;
'ActionStarGiftUniqueRibbon': undefined;
+ 'ActionStarGiftUniqueBurnedRibbon': undefined;
+ 'ActionStarGiftUniqueBurnedError': undefined;
'ActionStarGiftUniqueModel': undefined;
'ActionStarGiftUniqueBackdrop': undefined;
'ActionStarGiftUniqueSymbol': undefined;
@@ -2377,6 +2381,10 @@ export interface LangPairWithVariables {
'GiftInfoCollectible': {
'number': V;
};
+ 'GiftInfoUniqueTitle': {
+ 'name': V;
+ 'number': V;
+ };
'GiftSavedNumber': {
'number': V;
};