Files
discord-decomp/modules/wishlists/native/CollectiblesWishlistItemCard.tsx
T
2026-11-01 12:12:55 +02:00

41 lines
2.0 KiB
TypeScript

// Metro module 9772 (f9773).
import { useMemo, useCallback } from "react";
import { transformSKUToCollectiblesItem } from "../../collectibles/records/CollectiblesItemRecord";
import SentGiftsStore from "../SentGiftsStore";
import { useIsProfileFrameGiftingEnabled } from "../../collectibles/experiments/CollectiblesProfileFrameGiftingExperiment";
import { useStateFromStores } from "../../../_bundle/Module589";
import { getProductNameAndTypeFromSku } from "../CollectiblesWishlistUtils";
import { CollectiblesPreview } from "../../skus/native/SKUPreview";
import { CollectiblesItemType } from "../../../_bundle/Module1901";
import WishlistItemCardBase from "./WishlistItemCardBase";
export default function CollectiblesWishlistItemCard(props) {
let r52;
let memo;
const sku = props.sku;
let isOwned = props.isOwned;
if (isOwned === void 0) {
isOwned = false;
}
const { source, wishlistOwnerId, size, sku: _sku, isOwned: _isOwned, ...props2 } = props;
memo = void 0;
const isProfileFrameGiftingEnabled = useIsProfileFrameGiftingEnabled("CollectiblesWishlistItemCard");
const stateFromStores = useStateFromStores([SentGiftsStore], () => wishlistOwnerId != null && SentGiftsStore.hasSentGift(sku.id, wishlistOwnerId), [sku.id, wishlistOwnerId]);
const productNameAndTypeFromSku = getProductNameAndTypeFromSku(sku);
memo = useMemo(() => transformSKUToCollectiblesItem(sku), [sku]);
const callback = useCallback(() => memo != null ? <CollectiblesPreview collectiblesItemData={memo} size={size} /> : null, [memo, size]);
const type = memo?.type;
L10: {
if (type === "single" && memo.item.type === CollectiblesItemType.PROFILE_FRAME) {
r52 = null;
if (!isProfileFrameGiftingEnabled) {
break L10;
}
}
if (!isOwned) {
isOwned = stateFromStores;
}
r52 = <WishlistItemCardBase accessibilityLabel={productNameAndTypeFromSku} renderPreview={callback} source={source} isOwned={isOwned} size={size} {...props2} />;
}
return r52;
};