Saved Gifts: Show number on pinned (#5826)
This commit is contained in:
parent
e69a589432
commit
9636876aad
@ -1459,6 +1459,7 @@
|
|||||||
"GiftInfoOwner" = "Owner";
|
"GiftInfoOwner" = "Owner";
|
||||||
"GiftInfoIssued" = "{issued}/{total} issued";
|
"GiftInfoIssued" = "{issued}/{total} issued";
|
||||||
"GiftInfoCollectible" = "Collectible #{number}";
|
"GiftInfoCollectible" = "Collectible #{number}";
|
||||||
|
"GiftSavedNumber" = "#{number}";
|
||||||
"GiftAttributeModel" = "Model";
|
"GiftAttributeModel" = "Model";
|
||||||
"GiftAttributeBackdrop" = "Backdrop";
|
"GiftAttributeBackdrop" = "Backdrop";
|
||||||
"GiftAttributeSymbol" = "Symbol";
|
"GiftAttributeSymbol" = "Symbol";
|
||||||
|
|||||||
@ -13,8 +13,8 @@ import { getGiftAttributes, getStickerFromGift, getTotalGiftAvailability } from
|
|||||||
import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers';
|
import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers';
|
||||||
import useFlag from '../../../hooks/useFlag';
|
import useFlag from '../../../hooks/useFlag';
|
||||||
import { type ObserveFn, useOnIntersect } from '../../../hooks/useIntersectionObserver';
|
import { type ObserveFn, useOnIntersect } from '../../../hooks/useIntersectionObserver';
|
||||||
|
import useLang from '../../../hooks/useLang';
|
||||||
import useLastCallback from '../../../hooks/useLastCallback';
|
import useLastCallback from '../../../hooks/useLastCallback';
|
||||||
import useOldLang from '../../../hooks/useOldLang';
|
|
||||||
|
|
||||||
import Menu from '../../ui/Menu';
|
import Menu from '../../ui/Menu';
|
||||||
import AnimatedIconFromSticker from '../AnimatedIconFromSticker';
|
import AnimatedIconFromSticker from '../AnimatedIconFromSticker';
|
||||||
@ -61,10 +61,17 @@ const SavedGift = ({
|
|||||||
|
|
||||||
const [shouldPlay, play] = useFlag();
|
const [shouldPlay, play] = useFlag();
|
||||||
|
|
||||||
const oldLang = useOldLang();
|
const lang = useLang();
|
||||||
|
|
||||||
const canManage = peerId === currentUserId || hasAdminRights;
|
const canManage = peerId === currentUserId || hasAdminRights;
|
||||||
|
|
||||||
|
const totalIssued = getTotalGiftAvailability(gift.gift);
|
||||||
|
const ribbonText = gift.isPinned && gift.gift.type === 'starGiftUnique'
|
||||||
|
? lang('GiftSavedNumber', { number: gift.gift.number })
|
||||||
|
: totalIssued
|
||||||
|
? lang('ActionStarGiftLimitedRibbon', { total: formatIntegerCompact(totalIssued) })
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isContextMenuOpen, contextMenuAnchor,
|
isContextMenuOpen, contextMenuAnchor,
|
||||||
handleBeforeContextMenu, handleContextMenu,
|
handleBeforeContextMenu, handleContextMenu,
|
||||||
@ -117,8 +124,6 @@ const SavedGift = ({
|
|||||||
|
|
||||||
if (!sticker) return undefined;
|
if (!sticker) return undefined;
|
||||||
|
|
||||||
const totalIssued = getTotalGiftAvailability(gift.gift);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
@ -143,10 +148,10 @@ const SavedGift = ({
|
|||||||
<Icon name="eye-crossed-outline" />
|
<Icon name="eye-crossed-outline" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{totalIssued && (
|
{ribbonText && (
|
||||||
<GiftRibbon
|
<GiftRibbon
|
||||||
color="blue"
|
color="blue"
|
||||||
text={oldLang('Gift2Limited1OfRibbon', formatIntegerCompact(totalIssued))}
|
text={ribbonText}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{contextMenuAnchor !== undefined && (
|
{contextMenuAnchor !== undefined && (
|
||||||
|
|||||||
3
src/types/language.d.ts
vendored
3
src/types/language.d.ts
vendored
@ -1856,6 +1856,9 @@ export interface LangPairWithVariables<V extends unknown = LangVariable> {
|
|||||||
'GiftInfoCollectible': {
|
'GiftInfoCollectible': {
|
||||||
'number': V;
|
'number': V;
|
||||||
};
|
};
|
||||||
|
'GiftSavedNumber': {
|
||||||
|
'number': V;
|
||||||
|
};
|
||||||
'GiftInfoPeerOriginalInfo': {
|
'GiftInfoPeerOriginalInfo': {
|
||||||
'peer': V;
|
'peer': V;
|
||||||
'date': V;
|
'date': V;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user