mirror of
https://github.com/duckietm/Nitro-Cool-UI.git
synced 2025-06-21 22:36:58 +00:00
small fixes
This commit is contained in:
parent
ccd1370666
commit
96dedca519
@ -2,7 +2,7 @@ import { GiftReceiverNotFoundEvent, PurchaseFromCatalogAsGiftComposer } from '@n
|
|||||||
import { ChangeEvent, FC, useCallback, useEffect, useMemo, useState } from 'react';
|
import { ChangeEvent, FC, useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { FaChevronLeft, FaChevronRight } from 'react-icons/fa';
|
import { FaChevronLeft, FaChevronRight } from 'react-icons/fa';
|
||||||
import { ColorUtils, GetSessionDataManager, LocalizeText, MessengerFriend, ProductTypeEnum, SendMessageComposer } from '../../../../api';
|
import { ColorUtils, GetSessionDataManager, LocalizeText, MessengerFriend, ProductTypeEnum, SendMessageComposer } from '../../../../api';
|
||||||
import { Base, Button, ButtonGroup, classNames, Column, Flex, FormGroup, LayoutCurrencyIcon, LayoutFurniImageView, LayoutGiftTagView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../../../common';
|
import { Base, Button, ButtonGroup, Column, Flex, FormGroup, LayoutCurrencyIcon, LayoutFurniImageView, LayoutGiftTagView, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text, classNames } from '../../../../common';
|
||||||
import { CatalogEvent, CatalogInitGiftEvent, CatalogPurchasedEvent } from '../../../../events';
|
import { CatalogEvent, CatalogInitGiftEvent, CatalogPurchasedEvent } from '../../../../events';
|
||||||
import { useCatalog, useFriends, useMessageEvent, useUiEvent } from '../../../../hooks';
|
import { useCatalog, useFriends, useMessageEvent, useUiEvent } from '../../../../hooks';
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ export const CatalogGiftView: FC<{}> = props =>
|
|||||||
const [ maxBoxIndex, setMaxBoxIndex ] = useState<number>(0);
|
const [ maxBoxIndex, setMaxBoxIndex ] = useState<number>(0);
|
||||||
const [ maxRibbonIndex, setMaxRibbonIndex ] = useState<number>(0);
|
const [ maxRibbonIndex, setMaxRibbonIndex ] = useState<number>(0);
|
||||||
const [ receiverNotFound, setReceiverNotFound ] = useState<boolean>(false);
|
const [ receiverNotFound, setReceiverNotFound ] = useState<boolean>(false);
|
||||||
const { catalogOptions = null } = useCatalog();
|
const { catalogOptions = null, getNodesByOfferId = null } = useCatalog();
|
||||||
const { friends } = useFriends();
|
const { friends } = useFriends();
|
||||||
const { giftConfiguration = null } = catalogOptions;
|
const { giftConfiguration = null } = catalogOptions;
|
||||||
const [ boxTypes, setBoxTypes ] = useState<number[]>([]);
|
const [ boxTypes, setBoxTypes ] = useState<number[]>([]);
|
||||||
@ -121,10 +121,19 @@ export const CatalogGiftView: FC<{}> = props =>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageComposer(new PurchaseFromCatalogAsGiftComposer(pageId, offerId, extraData, receiverName, message, colourId , selectedBoxIndex, selectedRibbonIndex, showMyFace));
|
let buyPageId = pageId
|
||||||
|
|
||||||
|
if(buyPageId === -1)
|
||||||
|
{
|
||||||
|
const nodes = getNodesByOfferId(offerId);
|
||||||
|
|
||||||
|
if(nodes) buyPageId = nodes[0].pageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendMessageComposer(new PurchaseFromCatalogAsGiftComposer(buyPageId, offerId, extraData, receiverName, message, colourId, selectedBoxIndex, selectedRibbonIndex, showMyFace));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, [ colourId, extraData, maxBoxIndex, maxRibbonIndex, message, offerId, pageId, receiverName, selectedBoxIndex, selectedRibbonIndex, showMyFace ]);
|
}, [ colourId, extraData, maxBoxIndex, maxRibbonIndex, message, offerId, pageId, receiverName, selectedBoxIndex, selectedRibbonIndex, showMyFace, getNodesByOfferId ]);
|
||||||
|
|
||||||
useMessageEvent<GiftReceiverNotFoundEvent>(GiftReceiverNotFoundEvent, event => setReceiverNotFound(true));
|
useMessageEvent<GiftReceiverNotFoundEvent>(GiftReceiverNotFoundEvent, event => setReceiverNotFound(true));
|
||||||
|
|
||||||
@ -185,6 +194,7 @@ export const CatalogGiftView: FC<{}> = props =>
|
|||||||
if(!giftData) continue;
|
if(!giftData) continue;
|
||||||
|
|
||||||
if (giftData.colors && giftData.colors.length > 0) newColors.push({ id: colorId, color: ColorUtils.makeColorNumberHex(giftData.colors[0]) });
|
if (giftData.colors && giftData.colors.length > 0) newColors.push({ id: colorId, color: ColorUtils.makeColorNumberHex(giftData.colors[0]) });
|
||||||
|
else newColors.push({ id: colorId, color: '#000000' });
|
||||||
}
|
}
|
||||||
|
|
||||||
createBoxTypes();
|
createBoxTypes();
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { Dispatch, FC, SetStateAction, useEffect } from 'react';
|
import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react';
|
||||||
import { FaSearch } from 'react-icons/fa';
|
import { FaSearch } from 'react-icons/fa';
|
||||||
import { GroupItem, LocalizeText } from '../../../../api';
|
import { GroupItem, LocalizeText } from '../../../../api';
|
||||||
import { Button, Flex } from '../../../../common';
|
import { Button, Flex } from '../../../../common';
|
||||||
import { useLocalStorage } from '../../../../hooks';
|
|
||||||
|
|
||||||
export interface InventoryFurnitureSearchViewProps
|
export interface InventoryFurnitureSearchViewProps
|
||||||
{
|
{
|
||||||
@ -13,7 +12,7 @@ export interface InventoryFurnitureSearchViewProps
|
|||||||
export const InventoryFurnitureSearchView: FC<InventoryFurnitureSearchViewProps> = props =>
|
export const InventoryFurnitureSearchView: FC<InventoryFurnitureSearchViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { groupItems = [], setGroupItems = null } = props;
|
const { groupItems = [], setGroupItems = null } = props;
|
||||||
const [ searchValue, setSearchValue ] = useLocalStorage('inventoryFurnitureSearchValue', '');
|
const [ searchValue, setSearchValue ] = useState('');
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
@ -27,8 +26,7 @@ export const InventoryFurnitureSearchView: FC<InventoryFurnitureSearchViewProps>
|
|||||||
{
|
{
|
||||||
if(comparison && comparison.length)
|
if(comparison && comparison.length)
|
||||||
{
|
{
|
||||||
if(comparison === 'rare' && item.isSellable) return item;
|
if(item.name.toLocaleLowerCase().includes(comparison)) return item;
|
||||||
if(comparison !== 'rare' && item.name.toLocaleLowerCase().includes(comparison)) return item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -2,7 +2,7 @@ import { BuildersClubFurniCountMessageEvent, BuildersClubPlaceRoomItemMessageCom
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { useBetween } from 'use-between';
|
import { useBetween } from 'use-between';
|
||||||
import { BuilderFurniPlaceableStatus, CatalogNode, CatalogPage, CatalogPetPalette, CatalogType, CreateLinkEvent, DispatchUiEvent, FurniCategory, GetFurnitureData, GetProductDataForLocalization, GetRoomEngine, GetRoomSession, GiftWrappingConfiguration, ICatalogNode, ICatalogOptions, ICatalogPage, IPageLocalization, IProduct, IPurchasableOffer, IPurchaseOptions, LocalizeText, NotificationAlertType, Offer, PageLocalization, PlacedObjectPurchaseData, PlaySound, Product, ProductTypeEnum, RequestedPage, SearchResult, SendMessageComposer, SoundNames } from '../../api';
|
import { BuilderFurniPlaceableStatus, CatalogNode, CatalogPage, CatalogPetPalette, CatalogType, CreateLinkEvent, DispatchUiEvent, FurniCategory, GetFurnitureData, GetProductDataForLocalization, GetRoomEngine, GetRoomSession, GiftWrappingConfiguration, ICatalogNode, ICatalogOptions, ICatalogPage, IPageLocalization, IProduct, IPurchasableOffer, IPurchaseOptions, LocalizeText, NotificationAlertType, Offer, PageLocalization, PlacedObjectPurchaseData, PlaySound, Product, ProductTypeEnum, RequestedPage, SearchResult, SendMessageComposer, SoundNames } from '../../api';
|
||||||
import { CatalogPurchasedEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, InventoryFurniAddedEvent } from '../../events';
|
import { CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, CatalogPurchasedEvent, InventoryFurniAddedEvent } from '../../events';
|
||||||
import { useMessageEvent, useRoomEngineEvent, useUiEvent } from '../events';
|
import { useMessageEvent, useRoomEngineEvent, useUiEvent } from '../events';
|
||||||
import { useNotification } from '../notification';
|
import { useNotification } from '../notification';
|
||||||
import { useCatalogPlaceMultipleItems } from './useCatalogPlaceMultipleItems';
|
import { useCatalogPlaceMultipleItems } from './useCatalogPlaceMultipleItems';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user