diff --git a/src/views/catalog/CatalogMessageHandler.tsx b/src/components/catalog/CatalogMessageHandler.tsx similarity index 97% rename from src/views/catalog/CatalogMessageHandler.tsx rename to src/components/catalog/CatalogMessageHandler.tsx index 89c1e6fc..61948e8f 100644 --- a/src/views/catalog/CatalogMessageHandler.tsx +++ b/src/components/catalog/CatalogMessageHandler.tsx @@ -7,13 +7,12 @@ import { CatalogPurchasedEvent } from '../../events/catalog/CatalogPurchasedEven import { CatalogPurchaseSoldOutEvent } from '../../events/catalog/CatalogPurchaseSoldOutEvent'; import { dispatchUiEvent } from '../../hooks/events/ui/ui-event'; import { CreateMessageHook } from '../../hooks/messages/message-event'; -import { CatalogMessageHandlerProps } from './CatalogMessageHandler.types'; import { CatalogPetPalette } from './common/CatalogPetPalette'; import { SubscriptionInfo } from './common/SubscriptionInfo'; import { useCatalogContext } from './context/CatalogContext'; import { CatalogActions } from './reducers/CatalogReducer'; -export const CatalogMessageHandler: FC = props => +export const CatalogMessageHandler: FC<{}> = props => { const { catalogState = null, dispatchCatalogState = null } = useCatalogContext(); diff --git a/src/views/catalog/CatalogView.scss b/src/components/catalog/CatalogView.scss similarity index 100% rename from src/views/catalog/CatalogView.scss rename to src/components/catalog/CatalogView.scss diff --git a/src/views/catalog/CatalogView.tsx b/src/components/catalog/CatalogView.tsx similarity index 97% rename from src/views/catalog/CatalogView.tsx rename to src/components/catalog/CatalogView.tsx index ff833840..c97148d1 100644 --- a/src/views/catalog/CatalogView.tsx +++ b/src/components/catalog/CatalogView.tsx @@ -9,7 +9,7 @@ import { useUiEvent } from '../../hooks/events/ui/ui-event'; import { SendMessageHook } from '../../hooks/messages/message-event'; import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../layout'; import { CatalogMessageHandler } from './CatalogMessageHandler'; -import { CatalogMode, CatalogViewProps } from './CatalogView.types'; +import { CatalogMode } from './common/CatalogMode'; import { BuildCatalogPageTree } from './common/CatalogUtilities'; import { CatalogContextProvider } from './context/CatalogContext'; import { CatalogReducer, initialCatalog } from './reducers/CatalogReducer'; @@ -18,7 +18,7 @@ import { ACTIVE_PAGES, CatalogNavigationView } from './views/navigation/CatalogN import { CatalogPageView } from './views/page/CatalogPageView'; import { MarketplacePostOfferView } from './views/page/layout/marketplace/post-offer/MarketplacePostOfferView'; -export const CatalogView: FC = props => +export const CatalogView: FC<{}> = props => { const [ isVisible, setIsVisible ] = useState(false); const [ roomPreviewer, setRoomPreviewer ] = useState(null); @@ -215,10 +215,10 @@ export const CatalogView: FC = props => { currentNavigationPage && !navigationHidden && - + } - + diff --git a/src/views/catalog/common/AttemptCatalogPlacement.ts b/src/components/catalog/common/AttemptCatalogPlacement.ts similarity index 100% rename from src/views/catalog/common/AttemptCatalogPlacement.ts rename to src/components/catalog/common/AttemptCatalogPlacement.ts diff --git a/src/views/catalog/CatalogView.types.ts b/src/components/catalog/common/CatalogMode.ts similarity index 64% rename from src/views/catalog/CatalogView.types.ts rename to src/components/catalog/common/CatalogMode.ts index 6879614a..5cf52c70 100644 --- a/src/views/catalog/CatalogView.types.ts +++ b/src/components/catalog/common/CatalogMode.ts @@ -1,8 +1,3 @@ -export interface CatalogViewProps -{ - -} - export class CatalogMode { public static MODE_NORMAL: string = 'NORMAL'; diff --git a/src/views/catalog/common/CatalogPageName.ts b/src/components/catalog/common/CatalogPageName.ts similarity index 100% rename from src/views/catalog/common/CatalogPageName.ts rename to src/components/catalog/common/CatalogPageName.ts diff --git a/src/views/catalog/common/CatalogPetPalette.ts b/src/components/catalog/common/CatalogPetPalette.ts similarity index 100% rename from src/views/catalog/common/CatalogPetPalette.ts rename to src/components/catalog/common/CatalogPetPalette.ts diff --git a/src/components/catalog/common/CatalogPurchaseState.ts b/src/components/catalog/common/CatalogPurchaseState.ts new file mode 100644 index 00000000..b442f621 --- /dev/null +++ b/src/components/catalog/common/CatalogPurchaseState.ts @@ -0,0 +1,10 @@ +export class CatalogPurchaseState +{ + public static NONE = 0; + public static CONFIRM = 1; + public static PURCHASE = 2; + public static NO_CREDITS = 3; + public static NO_POINTS = 4; + public static SOLD_OUT = 5; + public static FAILED = 6; +} diff --git a/src/views/catalog/common/CatalogUtilities.ts b/src/components/catalog/common/CatalogUtilities.ts similarity index 100% rename from src/views/catalog/common/CatalogUtilities.ts rename to src/components/catalog/common/CatalogUtilities.ts diff --git a/src/views/catalog/common/FurniCategory.ts b/src/components/catalog/common/FurniCategory.ts similarity index 100% rename from src/views/catalog/common/FurniCategory.ts rename to src/components/catalog/common/FurniCategory.ts diff --git a/src/views/catalog/common/GetProuductIconUrl.ts b/src/components/catalog/common/GetProuductIconUrl.ts similarity index 100% rename from src/views/catalog/common/GetProuductIconUrl.ts rename to src/components/catalog/common/GetProuductIconUrl.ts diff --git a/src/views/catalog/common/GiftWrappingConfiguration.ts b/src/components/catalog/common/GiftWrappingConfiguration.ts similarity index 100% rename from src/views/catalog/common/GiftWrappingConfiguration.ts rename to src/components/catalog/common/GiftWrappingConfiguration.ts diff --git a/src/views/catalog/common/IPurse.ts b/src/components/catalog/common/IPurse.ts similarity index 100% rename from src/views/catalog/common/IPurse.ts rename to src/components/catalog/common/IPurse.ts diff --git a/src/views/catalog/common/IsCatalogOfferDraggable.ts b/src/components/catalog/common/IsCatalogOfferDraggable.ts similarity index 100% rename from src/views/catalog/common/IsCatalogOfferDraggable.ts rename to src/components/catalog/common/IsCatalogOfferDraggable.ts diff --git a/src/views/catalog/common/ProductTypeEnum.ts b/src/components/catalog/common/ProductTypeEnum.ts similarity index 100% rename from src/views/catalog/common/ProductTypeEnum.ts rename to src/components/catalog/common/ProductTypeEnum.ts diff --git a/src/views/catalog/common/Purse.ts b/src/components/catalog/common/Purse.ts similarity index 100% rename from src/views/catalog/common/Purse.ts rename to src/components/catalog/common/Purse.ts diff --git a/src/views/catalog/common/SubscriptionInfo.ts b/src/components/catalog/common/SubscriptionInfo.ts similarity index 100% rename from src/views/catalog/common/SubscriptionInfo.ts rename to src/components/catalog/common/SubscriptionInfo.ts diff --git a/src/views/catalog/context/CatalogContext.tsx b/src/components/catalog/context/CatalogContext.tsx similarity index 100% rename from src/views/catalog/context/CatalogContext.tsx rename to src/components/catalog/context/CatalogContext.tsx diff --git a/src/views/catalog/context/CatalogContext.types.ts b/src/components/catalog/context/CatalogContext.types.ts similarity index 100% rename from src/views/catalog/context/CatalogContext.types.ts rename to src/components/catalog/context/CatalogContext.types.ts diff --git a/src/views/catalog/reducers/CatalogReducer.tsx b/src/components/catalog/reducers/CatalogReducer.tsx similarity index 100% rename from src/views/catalog/reducers/CatalogReducer.tsx rename to src/components/catalog/reducers/CatalogReducer.tsx diff --git a/src/views/catalog/views/CatalogViews.scss b/src/components/catalog/views/CatalogViews.scss similarity index 52% rename from src/views/catalog/views/CatalogViews.scss rename to src/components/catalog/views/CatalogViews.scss index f6973ade..d86fa058 100644 --- a/src/views/catalog/views/CatalogViews.scss +++ b/src/components/catalog/views/CatalogViews.scss @@ -1,4 +1,10 @@ -@import './catalog-icon/CatalogIconView'; +.catalog-icon-image { + width: 20px; + height: 20px; + min-width: 20px; + min-height: 20px; +} + @import './gift/CatalogGiftView'; @import './navigation/CatalogNavigationView'; @import './page/CatalogPageView'; diff --git a/src/components/catalog/views/catalog-icon/CatalogIconView.tsx b/src/components/catalog/views/catalog-icon/CatalogIconView.tsx new file mode 100644 index 00000000..e287d9cf --- /dev/null +++ b/src/components/catalog/views/catalog-icon/CatalogIconView.tsx @@ -0,0 +1,20 @@ +import { FC, useMemo } from 'react'; +import { GetConfiguration } from '../../../../api'; +import { LayoutImage } from '../../../../common/layout/LayoutImage'; + +export interface CatalogIconViewProps +{ + icon: number; +} + +export const CatalogIconView: FC = props => +{ + const { icon = 0 } = props; + + const getIconUrl = useMemo(() => + { + return ((GetConfiguration('catalog.asset.icon.url')).replace('%name%', icon.toString())); + }, [ icon ]); + + return ; +} diff --git a/src/views/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx b/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx similarity index 88% rename from src/views/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx rename to src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx index ee43b2e9..dce973b6 100644 --- a/src/views/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx +++ b/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx @@ -3,8 +3,8 @@ import { FC, useCallback, useRef } from 'react'; import { GetRoomEngine } from '../../../../api'; import { CatalogEvent } from '../../../../events'; import { useUiEvent } from '../../../../hooks'; -import { RoomPreviewerView } from '../../../shared/room-previewer/RoomPreviewerView'; -import { RoomPreviewerViewProps } from '../../../shared/room-previewer/RoomPreviewerView.types'; +import { RoomPreviewerView } from '../../../../views/shared/room-previewer/RoomPreviewerView'; +import { RoomPreviewerViewProps } from '../../../../views/shared/room-previewer/RoomPreviewerView.types'; export const CatalogRoomPreviewerView: FC = props => { diff --git a/src/views/catalog/views/gift/CatalogGiftView.scss b/src/components/catalog/views/gift/CatalogGiftView.scss similarity index 100% rename from src/views/catalog/views/gift/CatalogGiftView.scss rename to src/components/catalog/views/gift/CatalogGiftView.scss diff --git a/src/components/catalog/views/gift/CatalogGiftView.tsx b/src/components/catalog/views/gift/CatalogGiftView.tsx new file mode 100644 index 00000000..53e65d89 --- /dev/null +++ b/src/components/catalog/views/gift/CatalogGiftView.tsx @@ -0,0 +1,241 @@ +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { PurchaseFromCatalogAsGiftComposer } from '@nitrots/nitro-renderer'; +import classNames from 'classnames'; +import { FC, useCallback, useEffect, useMemo, useState } from 'react'; +import { GetSessionDataManager, LocalizeText } from '../../../../api'; +import { Button } from '../../../../common/Button'; +import { ButtonGroup } from '../../../../common/ButtonGroup'; +import { Column } from '../../../../common/Column'; +import { Flex } from '../../../../common/Flex'; +import { FormGroup } from '../../../../common/FormGroup'; +import { Text } from '../../../../common/Text'; +import { CatalogEvent } from '../../../../events'; +import { CatalogInitGiftEvent } from '../../../../events/catalog/CatalogInitGiftEvent'; +import { BatchUpdates, SendMessageHook, useUiEvent } from '../../../../hooks'; +import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutGiftCardView } from '../../../../layout'; +import { CurrencyIcon } from '../../../../views/shared/currency-icon/CurrencyIcon'; +import { FurniImageView } from '../../../../views/shared/furni-image/FurniImageView'; +import { useCatalogContext } from '../../context/CatalogContext'; + +export const CatalogGiftView: FC<{}> = props => +{ + const [ isVisible, setIsVisible ] = useState(false); + const [ pageId, setPageId ] = useState(0); + const [ offerId, setOfferId ] = useState(0); + const [ receiverName, setReceiverName ] = useState(''); + const [ showMyFace, setShowMyFace ] = useState(true); + const [ message, setMessage ] = useState(''); + const [ colors, setColors ] = useState<{ id: number, color: string }[]>([]); + const [ selectedBoxIndex, setSelectedBoxIndex ] = useState(0); + const [ selectedRibbonIndex, setSelectedRibbonIndex ] = useState(0); + const [ selectedColorId, setSelectedColorId ] = useState(0); + const [ maxBoxIndex, setMaxBoxIndex ] = useState(0); + const [ maxRibbonIndex, setMaxRibbonIndex ] = useState(0); + const [ receiverNotFound, setReceiverNotFound ] = useState(false); + const { catalogState = null } = useCatalogContext(); + const { giftConfiguration = null } = catalogState; + + const close = useCallback(() => + { + BatchUpdates(() => + { + setIsVisible(false); + setPageId(0); + setOfferId(0); + setReceiverName(''); + setShowMyFace(true); + setMessage(''); + setSelectedBoxIndex(0); + setSelectedRibbonIndex(0); + + if(colors.length) setSelectedColorId(colors[0].id); + }); + }, [ colors ]); + + const onCatalogEvent = useCallback((event: CatalogEvent) => + { + switch(event.type) + { + case CatalogEvent.PURCHASE_SUCCESS: + close(); + return; + case CatalogEvent.INIT_GIFT: + const castedEvent = (event as CatalogInitGiftEvent); + + BatchUpdates(() => + { + close(); + + setPageId(castedEvent.pageId); + setOfferId(castedEvent.offerId); + setIsVisible(true); + }); + return; + case CatalogEvent.GIFT_RECEIVER_NOT_FOUND: + setReceiverNotFound(true); + return; + } + }, [ close ]); + + useUiEvent(CatalogEvent.PURCHASE_SUCCESS, onCatalogEvent); + useUiEvent(CatalogEvent.INIT_GIFT, onCatalogEvent); + useUiEvent(CatalogEvent.GIFT_RECEIVER_NOT_FOUND, onCatalogEvent); + + const isBoxDefault = useMemo(() => + { + return giftConfiguration ? (giftConfiguration.defaultStuffTypes.findIndex(s => (s === giftConfiguration.boxTypes[selectedBoxIndex])) > -1) : true; + }, [ giftConfiguration, selectedBoxIndex ]); + + const extraData = useMemo(() => + { + if(!giftConfiguration) return ''; + + return ((giftConfiguration.boxTypes[selectedBoxIndex] * 1000) + giftConfiguration.ribbonTypes[selectedRibbonIndex]).toString(); + }, [ giftConfiguration, selectedBoxIndex, selectedRibbonIndex ]); + + const isColorable = useMemo(() => + { + if(!giftConfiguration) return false; + + const boxType = giftConfiguration.boxTypes[selectedBoxIndex]; + + return (boxType === 8 || (boxType >= 3 && boxType <= 6)) ? false : true; + }, [ giftConfiguration, selectedBoxIndex ]); + + const handleAction = useCallback((action: string) => + { + switch(action) + { + case 'prev_box': + setSelectedBoxIndex(value => (value === 0 ? maxBoxIndex : value - 1)); + return; + case 'next_box': + setSelectedBoxIndex(value => (value === maxBoxIndex ? 0 : value + 1)); + return; + case 'prev_ribbon': + setSelectedRibbonIndex(value => (value === 0 ? maxRibbonIndex : value - 1)); + return; + case 'next_ribbon': + setSelectedRibbonIndex(value => (value === maxRibbonIndex ? 0 : value + 1)); + return; + case 'buy': + if(!receiverName || (receiverName.length === 0)) + { + setReceiverNotFound(true); + return; + } + + SendMessageHook(new PurchaseFromCatalogAsGiftComposer(pageId, offerId, extraData, receiverName, message, selectedColorId, selectedBoxIndex, selectedRibbonIndex, showMyFace)); + return; + } + }, [ extraData, maxBoxIndex, maxRibbonIndex, message, offerId, pageId, receiverName, selectedBoxIndex, selectedColorId, selectedRibbonIndex, showMyFace ]); + + useEffect(() => + { + setReceiverNotFound(false); + }, [ receiverName ]); + + useEffect(() => + { + if(!giftConfiguration) return; + + const newColors: { id: number, color: string }[] = []; + + for(const colorId of giftConfiguration.stuffTypes) + { + const giftData = GetSessionDataManager().getFloorItemData(colorId); + + if(!giftData) continue; + + if(giftData.colors && giftData.colors.length > 0) newColors.push({ id: colorId, color: `#${giftData.colors[0].toString(16)}` }); + } + + BatchUpdates(() => + { + setMaxBoxIndex(giftConfiguration.boxTypes.length - 1); + setMaxRibbonIndex(giftConfiguration.ribbonTypes.length - 1); + + if(newColors.length) + { + setSelectedColorId(newColors[0].id); + setColors(newColors); + } + }); + }, [ giftConfiguration ]); + + if(!giftConfiguration || !giftConfiguration.isEnabled || !isVisible) return null; + + const boxName = 'catalog.gift_wrapping_new.box.' + (isBoxDefault ? 'default' : selectedBoxIndex); + const ribbonName = `catalog.gift_wrapping_new.ribbon.${ selectedRibbonIndex }`; + const priceText = 'catalog.gift_wrapping_new.' + (isBoxDefault ? 'freeprice' : 'price'); + + return ( + + + + + { LocalizeText('catalog.gift_wrapping.receiver') } + setReceiverName(e.target.value) } /> + { receiverNotFound &&
{ LocalizeText('catalog.gift_wrapping.receiver_not_found.title') }
} +
+ setMessage(value) } /> +
+ setShowMyFace(value => !value) } /> + +
+ + { selectedColorId && +
+ +
} + + + + + + + + { LocalizeText(boxName) } + + { LocalizeText(priceText, ['price'], [giftConfiguration.price.toString()]) } + + + + + + + + + + { LocalizeText(ribbonName) } + + +
+ + + { LocalizeText('catalog.gift_wrapping.pick_color') } + + + { colors.map(color => + + +
+
+ ); +}; diff --git a/src/views/catalog/views/navigation/item/CatalogNavigationItemView.tsx b/src/components/catalog/views/navigation/CatalogNavigationItemView.tsx similarity index 64% rename from src/views/catalog/views/navigation/item/CatalogNavigationItemView.tsx rename to src/components/catalog/views/navigation/CatalogNavigationItemView.tsx index f618c0e1..b35e02b3 100644 --- a/src/views/catalog/views/navigation/item/CatalogNavigationItemView.tsx +++ b/src/components/catalog/views/navigation/CatalogNavigationItemView.tsx @@ -1,12 +1,22 @@ +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { GetCatalogPageComposer, INodeData } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useEffect, useState } from 'react'; -import { SendMessageHook } from '../../../../../hooks/messages/message-event'; -import { NitroCardGridItemView } from '../../../../../layout'; -import { CatalogMode } from '../../../CatalogView.types'; -import { CatalogIconView } from '../../catalog-icon/CatalogIconView'; -import { ACTIVE_PAGES } from '../CatalogNavigationView'; -import { CatalogNavigationSetView } from '../set/CatalogNavigationSetView'; -import { CatalogNavigationItemViewProps } from './CatalogNavigationItemView.types'; +import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; +import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem'; +import { Text } from '../../../../common/Text'; +import { SendMessageHook } from '../../../../hooks/messages/message-event'; +import { CatalogMode } from '../../common/CatalogMode'; +import { CatalogIconView } from '../catalog-icon/CatalogIconView'; +import { CatalogNavigationSetView } from './CatalogNavigationSetView'; +import { ACTIVE_PAGES } from './CatalogNavigationView'; + +export interface CatalogNavigationItemViewProps +{ + page: INodeData; + isActive: boolean; + pendingTree: INodeData[]; + setPendingTree: Dispatch>; + setActiveChild: Dispatch>; +} export const CatalogNavigationItemView: FC = props => { @@ -72,11 +82,12 @@ export const CatalogNavigationItemView: FC = pro return ( <> - select(page) }> + select(page) }> -
{ page.localization }
- { (page.children.length > 0) && } -
+ { page.localization } + { (page.children.length > 0) && + } + { isActive && isExpanded && page.children && (page.children.length > 0) && } diff --git a/src/views/catalog/views/navigation/set/CatalogNavigationSetView.tsx b/src/components/catalog/views/navigation/CatalogNavigationSetView.tsx similarity index 78% rename from src/views/catalog/views/navigation/set/CatalogNavigationSetView.tsx rename to src/components/catalog/views/navigation/CatalogNavigationSetView.tsx index 3d6199a1..ce52208f 100644 --- a/src/views/catalog/views/navigation/set/CatalogNavigationSetView.tsx +++ b/src/components/catalog/views/navigation/CatalogNavigationSetView.tsx @@ -1,7 +1,14 @@ import { INodeData } from '@nitrots/nitro-renderer'; -import { FC, useEffect, useState } from 'react'; -import { CatalogNavigationItemView } from '../item/CatalogNavigationItemView'; -import { CatalogNavigationSetViewProps } from './CatalogNavigationSetView.types'; +import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'; +import { CatalogNavigationItemView } from './CatalogNavigationItemView'; + +export interface CatalogNavigationSetViewProps +{ + page: INodeData; + isFirstSet?: boolean; + pendingTree: INodeData[]; + setPendingTree: Dispatch>; +} export const CatalogNavigationSetView: FC = props => { diff --git a/src/views/catalog/views/navigation/CatalogNavigationView.scss b/src/components/catalog/views/navigation/CatalogNavigationView.scss similarity index 90% rename from src/views/catalog/views/navigation/CatalogNavigationView.scss rename to src/components/catalog/views/navigation/CatalogNavigationView.scss index d76fdbf9..38161d9f 100644 --- a/src/views/catalog/views/navigation/CatalogNavigationView.scss +++ b/src/components/catalog/views/navigation/CatalogNavigationView.scss @@ -4,7 +4,7 @@ background-color: #CDD3D9; border: 2px solid; - .grid-item { + .layout-grid-item { font-size: $font-size-sm; height: 23px !important; border-color: unset !important; @@ -12,7 +12,7 @@ border: 0 !important; padding: 1px 3px; - i.fas { + .svg-inline--fa { color: $black; font-size: 10px; padding: 1px; diff --git a/src/views/catalog/views/navigation/CatalogNavigationView.tsx b/src/components/catalog/views/navigation/CatalogNavigationView.tsx similarity index 52% rename from src/views/catalog/views/navigation/CatalogNavigationView.tsx rename to src/components/catalog/views/navigation/CatalogNavigationView.tsx index 4ee356ec..aaa4ed9d 100644 --- a/src/views/catalog/views/navigation/CatalogNavigationView.tsx +++ b/src/components/catalog/views/navigation/CatalogNavigationView.tsx @@ -1,9 +1,16 @@ import { INodeData } from '@nitrots/nitro-renderer'; -import { FC, useEffect } from 'react'; -import { NitroCardGridView, NitroLayoutFlexColumn } from '../../../../layout'; +import { Dispatch, FC, SetStateAction, useEffect } from 'react'; +import { Column } from '../../../../common/Column'; +import { Grid } from '../../../../common/Grid'; import { CatalogSearchView } from '../search/CatalogSearchView'; -import { CatalogNavigationViewProps } from './CatalogNavigationView.types'; -import { CatalogNavigationSetView } from './set/CatalogNavigationSetView'; +import { CatalogNavigationSetView } from './CatalogNavigationSetView'; + +export interface CatalogNavigationViewProps +{ + page: INodeData; + pendingTree: INodeData[]; + setPendingTree: Dispatch>; +} export let ACTIVE_PAGES: INodeData[] = []; @@ -24,13 +31,13 @@ export const CatalogNavigationView: FC = props => }, [ page ]); return ( - + <> - - + + - - - + + + ); } diff --git a/src/views/catalog/views/page-details/CatalogPageDetailsView.tsx b/src/components/catalog/views/page-details/CatalogPageDetailsView.tsx similarity index 100% rename from src/views/catalog/views/page-details/CatalogPageDetailsView.tsx rename to src/components/catalog/views/page-details/CatalogPageDetailsView.tsx diff --git a/src/views/catalog/views/page-details/CatalogPageDetailsView.types.ts b/src/components/catalog/views/page-details/CatalogPageDetailsView.types.ts similarity index 100% rename from src/views/catalog/views/page-details/CatalogPageDetailsView.types.ts rename to src/components/catalog/views/page-details/CatalogPageDetailsView.types.ts diff --git a/src/views/catalog/views/page/CatalogPageView.scss b/src/components/catalog/views/page/CatalogPageView.scss similarity index 100% rename from src/views/catalog/views/page/CatalogPageView.scss rename to src/components/catalog/views/page/CatalogPageView.scss diff --git a/src/views/catalog/views/page/CatalogPageView.tsx b/src/components/catalog/views/page/CatalogPageView.tsx similarity index 95% rename from src/views/catalog/views/page/CatalogPageView.tsx rename to src/components/catalog/views/page/CatalogPageView.tsx index fe1e45fe..9ca30aa4 100644 --- a/src/views/catalog/views/page/CatalogPageView.tsx +++ b/src/components/catalog/views/page/CatalogPageView.tsx @@ -1,4 +1,4 @@ -import { CatalogPageMessageOfferData, IObjectData, Vector3d } from '@nitrots/nitro-renderer'; +import { CatalogPageMessageOfferData, IObjectData, RoomPreviewer, Vector3d } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { GetAvatarRenderManager, GetFurnitureDataForProductOffer, GetSessionDataManager } from '../../../../api'; import { SetRoomPreviewerStuffDataEvent } from '../../../../events'; @@ -6,10 +6,14 @@ import { useUiEvent } from '../../../../hooks'; import { FurniCategory } from '../../common/FurniCategory'; import { ProductTypeEnum } from '../../common/ProductTypeEnum'; import { useCatalogContext } from '../../context/CatalogContext'; -import { CatalogPageViewProps } from './CatalogPageView.types'; import { GetCatalogLayout } from './layout/GetCatalogLayout'; import { CatalogLayoutSearchResultView } from './search-result/CatalogLayoutSearchResultView'; +export interface CatalogPageViewProps +{ + roomPreviewer: RoomPreviewer; +} + export const CatalogPageView: FC = props => { const { roomPreviewer = null } = props; @@ -22,6 +26,9 @@ export const CatalogPageView: FC = props => if(!offer || !roomPreviewer) return; const product = offer.products[0]; + + if(!product) return; + const furniData = GetFurnitureDataForProductOffer(product); if(!furniData && (product.productType !== ProductTypeEnum.ROBOT)) return; diff --git a/src/components/catalog/views/page/layout/CatalogLayout.scss b/src/components/catalog/views/page/layout/CatalogLayout.scss new file mode 100644 index 00000000..2d8db51f --- /dev/null +++ b/src/components/catalog/views/page/layout/CatalogLayout.scss @@ -0,0 +1,32 @@ +.nitro-catalog-layout-info-loyalty { + + .info-loyalty-content { + background-repeat: no-repeat; + background-position: top right; + background-image: url('../../../../../assets/images/catalog/diamond_info_illustration.gif'); + padding-right:123px; + } + + .info-image { + width: 123px; + height:350px; + background-image: url('../../../../../assets/images/catalog/diamond_info_illustration.gif'); + } +} + +.nitro-catalog-layout-vip-buy-grid { + + .layout-grid-item { + height: 50px !important; + max-height: 50px !important; + + .icon-hc-banner { + width: 68px; + height: 40px; + background: url("../../../../../assets/images/catalog/hc_big.png") center no-repeat; + } + } +} + +@import './marketplace/marketplace-item/MarketplaceItemView'; +@import './marketplace/post-offer/MarketplacePostOfferView'; diff --git a/src/views/catalog/views/page/layout/CatalogLayout.types.ts b/src/components/catalog/views/page/layout/CatalogLayout.types.ts similarity index 100% rename from src/views/catalog/views/page/layout/CatalogLayout.types.ts rename to src/components/catalog/views/page/layout/CatalogLayout.types.ts diff --git a/src/views/catalog/views/page/layout/GetCatalogLayout.tsx b/src/components/catalog/views/page/layout/GetCatalogLayout.tsx similarity index 100% rename from src/views/catalog/views/page/layout/GetCatalogLayout.tsx rename to src/components/catalog/views/page/layout/GetCatalogLayout.tsx diff --git a/src/views/catalog/views/page/layout/badge-display/CatalogLayoutBadgeDisplayView.tsx b/src/components/catalog/views/page/layout/badge-display/CatalogLayoutBadgeDisplayView.tsx similarity index 58% rename from src/views/catalog/views/page/layout/badge-display/CatalogLayoutBadgeDisplayView.tsx rename to src/components/catalog/views/page/layout/badge-display/CatalogLayoutBadgeDisplayView.tsx index 38156bd6..78703c6e 100644 --- a/src/views/catalog/views/page/layout/badge-display/CatalogLayoutBadgeDisplayView.tsx +++ b/src/components/catalog/views/page/layout/badge-display/CatalogLayoutBadgeDisplayView.tsx @@ -1,28 +1,26 @@ import { StringDataType } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { LocalizeText } from '../../../../../../api'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; +import { LayoutGridItem } from '../../../../../../common/layout/LayoutGridItem'; +import { Text } from '../../../../../../common/Text'; import { InventoryBadgesUpdatedEvent, SetRoomPreviewerStuffDataEvent } from '../../../../../../events'; import { InventoryBadgesRequestEvent } from '../../../../../../events/inventory/InventoryBadgesRequestEvent'; import { dispatchUiEvent, useUiEvent } from '../../../../../../hooks'; -import { NitroLayoutFlexColumn, NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; -import { NitroLayoutBase } from '../../../../../../layout/base'; -import { NitroCardGridItemView } from '../../../../../../layout/card/grid/item/NitroCardGridItemView'; -import { NitroCardGridView } from '../../../../../../layout/card/grid/NitroCardGridView'; -import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView'; +import { BadgeImageView } from '../../../../../../views/shared/badge-image/BadgeImageView'; import { useCatalogContext } from '../../../../context/CatalogContext'; import { CatalogPageOffersView } from '../../offers/CatalogPageOffersView'; import { CatalogProductPreviewView } from '../../product-preview/CatalogProductPreviewView'; -import { CatalogLayoutBadgeDisplayViewProps } from './CatalogLayoutBadgeDisplayView.types'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; -export const CatalogLayoutBadgeDisplayView: FC = props => +export const CatalogLayoutBadgeDisplayView: FC = props => { const { roomPreviewer = null, pageParser = null } = props; - const { catalogState = null, dispatchCatalogState = null } = useCatalogContext(); - const { activeOffer = null } = catalogState; const [ badges, setBadges ] = useState([]); const [ currentBadge, setCurrentBadge ] = useState(null); - - const product = ((activeOffer && activeOffer.products[0]) || null); + const { catalogState = null } = useCatalogContext(); + const { activeOffer = null } = catalogState; const onInventoryBadgesUpdatedEvent = useCallback((event: InventoryBadgesUpdatedEvent) => { @@ -55,26 +53,26 @@ export const CatalogLayoutBadgeDisplayView: FC - - - - { LocalizeText('catalog_selectbadge') } - + + + + + { LocalizeText('catalog_selectbadge') } + { badges && (badges.length > 0) && badges.map(code => { return ( - setCurrentBadge(code) }> + setCurrentBadge(code) }> - + ); }) } - - - - + + + + - - + + ); } diff --git a/src/views/catalog/views/page/layout/default/CatalogLayoutDefaultView.tsx b/src/components/catalog/views/page/layout/default/CatalogLayoutDefaultView.tsx similarity index 55% rename from src/views/catalog/views/page/layout/default/CatalogLayoutDefaultView.tsx rename to src/components/catalog/views/page/layout/default/CatalogLayoutDefaultView.tsx index 1ec8d867..6f3595c3 100644 --- a/src/views/catalog/views/page/layout/default/CatalogLayoutDefaultView.tsx +++ b/src/components/catalog/views/page/layout/default/CatalogLayoutDefaultView.tsx @@ -1,26 +1,25 @@ import { FC } from 'react'; -import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; import { useCatalogContext } from '../../../../context/CatalogContext'; import { CatalogPageOffersView } from '../../offers/CatalogPageOffersView'; import { CatalogProductPreviewView } from '../../product-preview/CatalogProductPreviewView'; -import { CatalogLayoutDefaultViewProps } from './CatalogLayoutDefaultView.types'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; -export const CatalogLayoutDefaultView: FC = props => +export const CatalogLayoutDefaultView: FC = props => { const { roomPreviewer = null, pageParser = null } = props; const { catalogState = null } = useCatalogContext(); const { activeOffer = null } = catalogState; - const product = ((activeOffer && activeOffer.products[0]) || null); - return ( - - + + - - + + - - + + ); } diff --git a/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontPageItemView.tsx b/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontPageItemView.tsx new file mode 100644 index 00000000..8ce38aac --- /dev/null +++ b/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontPageItemView.tsx @@ -0,0 +1,37 @@ +import { FrontPageItem } from '@nitrots/nitro-renderer'; +import { FC, useMemo } from 'react'; +import { GetConfiguration } from '../../../../../../api'; +import { LayoutImage, LayoutImageProps } from '../../../../../../common/layout/LayoutImage'; +import { Text } from '../../../../../../common/Text'; + +export interface CatalogLayoutFrontPageItemViewProps extends LayoutImageProps +{ + item: FrontPageItem; +} + +export const CatalogLayoutFrontPageItemView: FC = props => +{ + const { item = null, position = 'relative', pointer = true, overflow = 'hidden', fullHeight = true, classNames = [], children = null, ...rest } = props; + + const getClassNames = useMemo(() => + { + const newClassNames: string[] = [ 'rounded', 'nitro-front-page-item' ]; + + if(classNames.length) newClassNames.push(...classNames); + + return newClassNames; + }, [ classNames ]); + + if(!item) return null; + + const imageUrl = (GetConfiguration('image.library.url') + item.itemPromoImage); + + return ( + + + { item.itemName } + + { children } + + ); +} diff --git a/src/views/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx b/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx similarity index 64% rename from src/views/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx rename to src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx index 9f04e00e..a331a151 100644 --- a/src/views/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx +++ b/src/components/catalog/views/page/layout/frontpage4/CatalogLayoutFrontpage4View.tsx @@ -1,22 +1,17 @@ import { FrontPageItem } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useMemo } from 'react'; -import { CreateLinkEvent, GetConfiguration } from '../../../../../../api'; -import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; +import { FC, useCallback } from 'react'; +import { CreateLinkEvent } from '../../../../../../api'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; import { GetCatalogPageText } from '../../../../common/CatalogUtilities'; import { CatalogRedeemVoucherView } from '../../redeem-voucher/CatalogRedeemVoucherView'; -import { CatalogLayoutFrontpage4ViewProps } from './CatalogLayoutFrontpage4View.types'; -import { CatalogLayoutFrontPageItemView } from './item/CatalogLayoutFrontPageItemView'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; +import { CatalogLayoutFrontPageItemView } from './CatalogLayoutFrontPageItemView'; -export const CatalogLayoutFrontpage4View: FC = props => +export const CatalogLayoutFrontpage4View: FC = props => { const { pageParser = null } = props; - const imageLibraryUrl = useMemo(() => - { - console.log(pageParser); - return GetConfiguration('image.library.url'); - }, []); - const selectItem = useCallback((item: FrontPageItem) => { switch(item.type) @@ -30,15 +25,13 @@ export const CatalogLayoutFrontpage4View: FC = } }, []); - if(!pageParser) return null; - return ( - - + + { pageParser.frontPageItems[0] && selectItem(pageParser.frontPageItems[0]) } /> } - - + + { pageParser.frontPageItems[1] && selectItem(pageParser.frontPageItems[1]) } /> } { pageParser.frontPageItems[2] && @@ -46,7 +39,7 @@ export const CatalogLayoutFrontpage4View: FC = { pageParser.frontPageItems[3] && selectItem(pageParser.frontPageItems[3]) } /> } - - + + ); } diff --git a/src/views/catalog/views/page/layout/guild-custom-furni/CatalogLayoutGuildCustomFurniView.tsx b/src/components/catalog/views/page/layout/guild-custom-furni/CatalogLayoutGuildCustomFurniView.tsx similarity index 83% rename from src/views/catalog/views/page/layout/guild-custom-furni/CatalogLayoutGuildCustomFurniView.tsx rename to src/components/catalog/views/page/layout/guild-custom-furni/CatalogLayoutGuildCustomFurniView.tsx index 2ee74233..104d38ff 100644 --- a/src/views/catalog/views/page/layout/guild-custom-furni/CatalogLayoutGuildCustomFurniView.tsx +++ b/src/components/catalog/views/page/layout/guild-custom-furni/CatalogLayoutGuildCustomFurniView.tsx @@ -1,16 +1,17 @@ import { CatalogGroupsComposer, StringDataType } from '@nitrots/nitro-renderer'; import { FC, useEffect, useMemo, useState } from 'react'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; import { SetRoomPreviewerStuffDataEvent } from '../../../../../../events'; import { dispatchUiEvent } from '../../../../../../hooks'; import { SendMessageHook } from '../../../../../../hooks/messages'; -import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; import { useCatalogContext } from '../../../../context/CatalogContext'; import { CatalogSelectGroupView } from '../../../select-group/CatalogSelectGroupView'; import { CatalogPageOffersView } from '../../offers/CatalogPageOffersView'; import { CatalogProductPreviewView } from '../../product-preview/CatalogProductPreviewView'; -import { CatalogLayoutGuildCustomFurniViewProps } from './CatalogLayoutGuildCustomFurniView.types'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; -export const CatalogLayouGuildCustomFurniView: FC = props => +export const CatalogLayouGuildCustomFurniView: FC = props => { const { roomPreviewer = null, pageParser = null } = props; const [ selectedGroupIndex, setSelectedGroupIndex ] = useState(0); @@ -49,15 +50,15 @@ export const CatalogLayouGuildCustomFurniView: FC - + + - - + + - - + + ); } diff --git a/src/views/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx b/src/components/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx similarity index 67% rename from src/views/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx rename to src/components/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx index c7c3204f..e51a1d4d 100644 --- a/src/views/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx +++ b/src/components/catalog/views/page/layout/guild-forum/CatalogLayoutGuildForumView.tsx @@ -1,26 +1,23 @@ import { CatalogGroupsComposer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; +import { Base } from '../../../../../../common/Base'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; import { SendMessageHook } from '../../../../../../hooks/messages'; -import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; -import { NitroLayoutBase } from '../../../../../../layout/base'; import { GetCatalogPageText } from '../../../../common/CatalogUtilities'; import { useCatalogContext } from '../../../../context/CatalogContext'; import { CatalogActions } from '../../../../reducers/CatalogReducer'; import { CatalogSelectGroupView } from '../../../select-group/CatalogSelectGroupView'; import { CatalogProductPreviewView } from '../../product-preview/CatalogProductPreviewView'; -import { CatalogLayoutGuildForumViewProps } from './CatalogLayoutGuildForumView.types'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; -export const CatalogLayouGuildForumView: FC = props => +export const CatalogLayouGuildForumView: FC = props => { const { pageParser = null } = props; - + const [ selectedGroupIndex, setSelectedGroupIndex ] = useState(0); const { catalogState = null, dispatchCatalogState = null } = useCatalogContext(); const { activeOffer = null, groups = null } = catalogState; - const [ selectedGroupIndex, setSelectedGroupIndex ] = useState(0); - - const product = ((activeOffer && activeOffer.products[0]) || null); - useEffect(() => { SendMessageHook(new CatalogGroupsComposer()); @@ -37,15 +34,15 @@ export const CatalogLayouGuildForumView: FC = }, [ dispatchCatalogState, pageParser ]); return ( - - - - - + + + + + - - + + ); } diff --git a/src/components/catalog/views/page/layout/guild-frontpage/CatalogLayoutGuildFrontpageView.tsx b/src/components/catalog/views/page/layout/guild-frontpage/CatalogLayoutGuildFrontpageView.tsx new file mode 100644 index 00000000..9412cd1f --- /dev/null +++ b/src/components/catalog/views/page/layout/guild-frontpage/CatalogLayoutGuildFrontpageView.tsx @@ -0,0 +1,30 @@ +import { FC } from 'react'; +import { CreateLinkEvent, LocalizeText } from '../../../../../../api'; +import { Base } from '../../../../../../common/Base'; +import { Button } from '../../../../../../common/Button'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; +import { LayoutImage } from '../../../../../../common/layout/LayoutImage'; +import { GetCatalogPageImage, GetCatalogPageText } from '../../../../common/CatalogUtilities'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; + +export const CatalogLayouGuildFrontpageView: FC = props => +{ + const { pageParser = null } = props; + + return ( + + + + + + + + + + + + ); +} diff --git a/src/views/catalog/views/page/layout/info-loyalty/CatalogLayoutInfoLoyaltyView.tsx b/src/components/catalog/views/page/layout/info-loyalty/CatalogLayoutInfoLoyaltyView.tsx similarity index 72% rename from src/views/catalog/views/page/layout/info-loyalty/CatalogLayoutInfoLoyaltyView.tsx rename to src/components/catalog/views/page/layout/info-loyalty/CatalogLayoutInfoLoyaltyView.tsx index 70635763..cb73e286 100644 --- a/src/views/catalog/views/page/layout/info-loyalty/CatalogLayoutInfoLoyaltyView.tsx +++ b/src/components/catalog/views/page/layout/info-loyalty/CatalogLayoutInfoLoyaltyView.tsx @@ -1,8 +1,8 @@ import { FC } from 'react'; import { GetCatalogPageText } from '../../../../common/CatalogUtilities'; -import { CatalogLayoutInfoLoyaltyViewProps } from './CatalogLayoutInfoLoyaltyView.types'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; -export const CatalogLayoutInfoLoyaltyView: FC = props => +export const CatalogLayoutInfoLoyaltyView: FC = props => { const { pageParser = null } = props; diff --git a/src/views/catalog/views/page/layout/marketplace/common/IMarketplaceSearchOptions.ts b/src/components/catalog/views/page/layout/marketplace/common/IMarketplaceSearchOptions.ts similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/common/IMarketplaceSearchOptions.ts rename to src/components/catalog/views/page/layout/marketplace/common/IMarketplaceSearchOptions.ts diff --git a/src/views/catalog/views/page/layout/marketplace/common/MarketplaceConfirmType.ts b/src/components/catalog/views/page/layout/marketplace/common/MarketplaceConfirmType.ts similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/common/MarketplaceConfirmType.ts rename to src/components/catalog/views/page/layout/marketplace/common/MarketplaceConfirmType.ts diff --git a/src/views/catalog/views/page/layout/marketplace/common/MarketplaceOfferData.ts b/src/components/catalog/views/page/layout/marketplace/common/MarketplaceOfferData.ts similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/common/MarketplaceOfferData.ts rename to src/components/catalog/views/page/layout/marketplace/common/MarketplaceOfferData.ts diff --git a/src/views/catalog/views/page/layout/marketplace/common/MarketplaceOfferState.ts b/src/components/catalog/views/page/layout/marketplace/common/MarketplaceOfferState.ts similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/common/MarketplaceOfferState.ts rename to src/components/catalog/views/page/layout/marketplace/common/MarketplaceOfferState.ts diff --git a/src/views/catalog/views/page/layout/marketplace/common/MarketplaceSearchType.ts b/src/components/catalog/views/page/layout/marketplace/common/MarketplaceSearchType.ts similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/common/MarketplaceSearchType.ts rename to src/components/catalog/views/page/layout/marketplace/common/MarketplaceSearchType.ts diff --git a/src/views/catalog/views/page/layout/marketplace/marketplace-item/MarketplaceItemView.scss b/src/components/catalog/views/page/layout/marketplace/marketplace-item/MarketplaceItemView.scss similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/marketplace-item/MarketplaceItemView.scss rename to src/components/catalog/views/page/layout/marketplace/marketplace-item/MarketplaceItemView.scss diff --git a/src/views/catalog/views/page/layout/marketplace/marketplace-item/MarketplaceItemView.tsx b/src/components/catalog/views/page/layout/marketplace/marketplace-item/MarketplaceItemView.tsx similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/marketplace-item/MarketplaceItemView.tsx rename to src/components/catalog/views/page/layout/marketplace/marketplace-item/MarketplaceItemView.tsx diff --git a/src/views/catalog/views/page/layout/marketplace/own-items/CatalogLayoutMarketplaceOwnItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/own-items/CatalogLayoutMarketplaceOwnItemsView.tsx similarity index 95% rename from src/views/catalog/views/page/layout/marketplace/own-items/CatalogLayoutMarketplaceOwnItemsView.tsx rename to src/components/catalog/views/page/layout/marketplace/own-items/CatalogLayoutMarketplaceOwnItemsView.tsx index d76ae6f3..5a68a22a 100644 --- a/src/views/catalog/views/page/layout/marketplace/own-items/CatalogLayoutMarketplaceOwnItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/own-items/CatalogLayoutMarketplaceOwnItemsView.tsx @@ -4,8 +4,8 @@ import { LocalizeText } from '../../../../../../../api'; import { BatchUpdates, CreateMessageHook, SendMessageHook, UseMountEffect } from '../../../../../../../hooks'; import { NitroCardGridView } from '../../../../../../../layout'; import { NitroLayoutBase } from '../../../../../../../layout/base'; -import { NotificationAlertType } from '../../../../../../notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../../../../../notification-center/common/NotificationUtilities'; +import { NotificationAlertType } from '../../../../../../../views/notification-center/common/NotificationAlertType'; +import { NotificationUtilities } from '../../../../../../../views/notification-center/common/NotificationUtilities'; import { CatalogLayoutProps } from '../../CatalogLayout.types'; import { MarketplaceOfferData } from '../common/MarketplaceOfferData'; import { MarketPlaceOfferState } from '../common/MarketplaceOfferState'; diff --git a/src/views/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.scss b/src/components/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.scss similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.scss rename to src/components/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.scss diff --git a/src/views/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.tsx b/src/components/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.tsx similarity index 96% rename from src/views/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.tsx rename to src/components/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.tsx index cef4fae5..27eec7b0 100644 --- a/src/views/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/post-offer/MarketplacePostOfferView.tsx @@ -1,11 +1,11 @@ import { ImageResult, MakeOfferMessageComposer, Vector3d } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; import { GetRoomEngine, LocalizeText } from '../../../../../../../api'; -import { FurnitureItem } from '../../../../../../../components/inventory/common/FurnitureItem'; import { CatalogPostMarketplaceOfferEvent } from '../../../../../../../events/catalog/CatalogPostMarketplaceOfferEvent'; import { SendMessageHook, useUiEvent } from '../../../../../../../hooks'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView, NitroLayoutFlex } from '../../../../../../../layout'; -import { NotificationUtilities } from '../../../../../../notification-center/common/NotificationUtilities'; +import { NotificationUtilities } from '../../../../../../../views/notification-center/common/NotificationUtilities'; +import { FurnitureItem } from '../../../../../../inventory/common/FurnitureItem'; export const MarketplacePostOfferView : FC<{}> = props => { diff --git a/src/views/catalog/views/page/layout/marketplace/public-items/CatalogLayoutMarketplacePublicItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/public-items/CatalogLayoutMarketplacePublicItemsView.tsx similarity index 95% rename from src/views/catalog/views/page/layout/marketplace/public-items/CatalogLayoutMarketplacePublicItemsView.tsx rename to src/components/catalog/views/page/layout/marketplace/public-items/CatalogLayoutMarketplacePublicItemsView.tsx index 69af4473..752d52b7 100644 --- a/src/views/catalog/views/page/layout/marketplace/public-items/CatalogLayoutMarketplacePublicItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/public-items/CatalogLayoutMarketplacePublicItemsView.tsx @@ -3,9 +3,9 @@ import { FC, useCallback, useMemo, useState } from 'react'; import { LocalizeText } from '../../../../../../../api'; import { BatchUpdates, CreateMessageHook, SendMessageHook } from '../../../../../../../hooks'; import { NitroCardGridView } from '../../../../../../../layout'; -import { NotificationAlertType } from '../../../../../../notification-center/common/NotificationAlertType'; -import { NotificationUtilities } from '../../../../../../notification-center/common/NotificationUtilities'; -import { GetCurrencyAmount } from '../../../../../../purse/common/CurrencyHelper'; +import { NotificationAlertType } from '../../../../../../../views/notification-center/common/NotificationAlertType'; +import { NotificationUtilities } from '../../../../../../../views/notification-center/common/NotificationUtilities'; +import { GetCurrencyAmount } from '../../../../../../../views/purse/common/CurrencyHelper'; import { CatalogLayoutProps } from '../../CatalogLayout.types'; import { IMarketplaceSearchOptions } from '../common/IMarketplaceSearchOptions'; import { MarketplaceOfferData } from '../common/MarketplaceOfferData'; diff --git a/src/views/catalog/views/page/layout/marketplace/public-items/SearchFormView.tsx b/src/components/catalog/views/page/layout/marketplace/public-items/SearchFormView.tsx similarity index 100% rename from src/views/catalog/views/page/layout/marketplace/public-items/SearchFormView.tsx rename to src/components/catalog/views/page/layout/marketplace/public-items/SearchFormView.tsx diff --git a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetPurchaseView.tsx b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetPurchaseView.tsx new file mode 100644 index 00000000..790a7635 --- /dev/null +++ b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetPurchaseView.tsx @@ -0,0 +1,75 @@ +import { ApproveNameMessageComposer, CatalogPageMessageOfferData } from '@nitrots/nitro-renderer'; +import { FC, useCallback, useState } from 'react'; +import { LocalizeText } from '../../../../../../api'; +import { Column } from '../../../../../../common/Column'; +import { Flex } from '../../../../../../common/Flex'; +import { Text } from '../../../../../../common/Text'; +import { CatalogEvent } from '../../../../../../events'; +import { useUiEvent } from '../../../../../../hooks/events/ui/ui-event'; +import { SendMessageHook } from '../../../../../../hooks/messages/message-event'; +import { CurrencyIcon } from '../../../../../../views/shared/currency-icon/CurrencyIcon'; +import { CatalogPurchaseButtonView } from '../../purchase/CatalogPurchaseButtonView'; +import { CatalogPurchaseGiftButtonView } from '../../purchase/CatalogPurchaseGiftButtonView'; +import { CatalogPetNameApprovalView } from './CatalogPetNameApprovalView'; + +export interface CatalogLayoutPetPurchaseViewProps +{ + offer: CatalogPageMessageOfferData; + pageId: number; + extra?: string; +} + +export const CatalogLayoutPetPurchaseView: FC = props => +{ + const { offer = null, pageId = -1, extra = '' } = props; + const [ petNameValue, setPetNameValue ] = useState(''); + const [ nameApproved, setNameApproved ] = useState(false); + + const onCatalogEvent = useCallback((event: CatalogEvent) => + { + switch(event.type) + { + case CatalogEvent.PURCHASE_SUCCESS: + setNameApproved(false); + return; + } + }, []); + + useUiEvent(CatalogEvent.PURCHASE_SUCCESS, onCatalogEvent); + + const beforePurchase = useCallback(() => + { + SendMessageHook(new ApproveNameMessageComposer(petNameValue, 1)); + }, [ petNameValue ]); + + const extraData = `${ petNameValue }\n${ extra }`; + + return ( + +
+ +
+ +
+ { LocalizeText('catalog.bundlewidget.price') } +
+ + { (offer.priceCredits > 0) && + + { offer.priceCredits } + + } + { (offer.priceActivityPoints > 0) && + + { offer.priceActivityPoints } + + } + +
+ + + { offer.giftable && } + +
+ ); +} diff --git a/src/views/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx similarity index 65% rename from src/views/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx rename to src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx index 1d4b2ad3..94676c5f 100644 --- a/src/views/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx +++ b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx @@ -1,89 +1,35 @@ +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { ColorConverter, GetSellablePetPalettesComposer, SellablePetPaletteData } from '@nitrots/nitro-renderer'; import { FC, useEffect, useMemo, useState } from 'react'; import { GetProductDataForLocalization, LocalizeText } from '../../../../../../api'; +import { Base } from '../../../../../../common/Base'; +import { Button } from '../../../../../../common/Button'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; +import { LayoutGridItem } from '../../../../../../common/layout/LayoutGridItem'; +import { Text } from '../../../../../../common/Text'; +import { BatchUpdates } from '../../../../../../hooks'; import { SendMessageHook } from '../../../../../../hooks/messages/message-event'; -import { NitroCardGridItemView, NitroCardGridView, NitroLayoutFlexColumn, NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; -import { NitroLayoutBase } from '../../../../../../layout/base'; -import { PetImageView } from '../../../../../shared/pet-image/PetImageView'; +import { PetImageView } from '../../../../../../views/shared/pet-image/PetImageView'; import { GetPetAvailableColors, GetPetIndexFromLocalization } from '../../../../common/CatalogUtilities'; import { useCatalogContext } from '../../../../context/CatalogContext'; import { CatalogActions } from '../../../../reducers/CatalogReducer'; import { CatalogRoomPreviewerView } from '../../../catalog-room-previewer/CatalogRoomPreviewerView'; import { CatalogPageDetailsView } from '../../../page-details/CatalogPageDetailsView'; -import { CatalogLayoutPetViewProps } from './CatalogLayoutPetView.types'; -import { CatalogLayoutPetPurchaseView } from './purchase/CatalogLayoutPetPurchaseView'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; +import { CatalogLayoutPetPurchaseView } from './CatalogLayoutPetPurchaseView'; -export const CatalogLayoutPetView: FC = props => +export const CatalogLayoutPetView: FC = props => { const { roomPreviewer = null, pageParser = null } = props; - const { catalogState = null, dispatchCatalogState = null } = useCatalogContext(); - const { activeOffer = null, petPalettes = [] } = catalogState; const [ petIndex, setPetIndex ] = useState(-1); const [ sellablePalettes, setSellablePalettes ] = useState([]); const [ selectedPaletteIndex, setSelectedPaletteIndex ] = useState(-1); const [ sellableColors, setSellableColors ] = useState([]); const [ selectedColorIndex, setSelectedColorIndex ] = useState(-1); const [ colorsShowing, setColorsShowing ] = useState(false); - - useEffect(() => - { - if(!pageParser || !pageParser.offers.length) return; - - const offer = pageParser.offers[0]; - - dispatchCatalogState({ - type: CatalogActions.SET_CATALOG_ACTIVE_OFFER, - payload: { - activeOffer: offer - } - }); - - setPetIndex(GetPetIndexFromLocalization(offer.localizationId)); - setColorsShowing(false); - }, [ pageParser, dispatchCatalogState ]); - - useEffect(() => - { - if(!activeOffer) return; - - const productData = GetProductDataForLocalization(activeOffer.localizationId); - - if(!productData) return; - - for(const paletteData of petPalettes) - { - if(paletteData.breed !== productData.type) continue; - - const palettes: SellablePetPaletteData[] = []; - - for(const palette of paletteData.palettes) - { - if(!palette.sellable) continue; - - palettes.push(palette); - } - - setSelectedPaletteIndex((palettes.length ? 0 : -1)); - setSellablePalettes(palettes); - - return; - } - - setSelectedPaletteIndex(-1); - setSellablePalettes([]); - - SendMessageHook(new GetSellablePetPalettesComposer(productData.type)); - }, [ activeOffer, petPalettes ]); - - useEffect(() => - { - if(petIndex === -1) return; - - const colors = GetPetAvailableColors(petIndex, sellablePalettes); - - setSelectedColorIndex((colors.length ? 0 : -1)); - setSellableColors(colors); - }, [ petIndex, sellablePalettes ]); + const { catalogState = null, dispatchCatalogState = null } = useCatalogContext(); + const { activeOffer = null, petPalettes = [] } = catalogState; const getColor = useMemo(() => { @@ -92,21 +38,6 @@ export const CatalogLayoutPetView: FC = props => return sellableColors[selectedColorIndex][0]; }, [ sellableColors, selectedColorIndex ]); - useEffect(() => - { - if(!roomPreviewer) return; - - roomPreviewer && roomPreviewer.reset(false); - - if((petIndex === -1) || !sellablePalettes.length || (selectedPaletteIndex === -1)) return; - - let petFigureString = `${ petIndex } ${ sellablePalettes[selectedPaletteIndex].paletteId }`; - - if(petIndex <= 7) petFigureString += ` ${ getColor.toString(16) }`; - - roomPreviewer.addPetIntoRoom(petFigureString); - }, [ roomPreviewer, petIndex, sellablePalettes, selectedPaletteIndex, getColor ]); - const petBreedName = useMemo(() => { if((petIndex === -1) || !sellablePalettes.length || (selectedPaletteIndex === -1)) return ''; @@ -131,56 +62,135 @@ export const CatalogLayoutPetView: FC = props => let colorString = color.toString(16).toUpperCase(); - while(colorString.length < 6) - { - colorString = ('0' + colorString); - } + while(colorString.length < 6) colorString = ('0' + colorString); return `${ paletteId }\n${ colorString }`; }, [ sellablePalettes, selectedPaletteIndex, petIndex, sellableColors, selectedColorIndex ]); + useEffect(() => + { + if(!pageParser || !pageParser.offers.length) return; + + const offer = pageParser.offers[0]; + + dispatchCatalogState({ + type: CatalogActions.SET_CATALOG_ACTIVE_OFFER, + payload: { + activeOffer: offer + } + }); + + BatchUpdates(() => + { + setPetIndex(GetPetIndexFromLocalization(offer.localizationId)); + setColorsShowing(false); + }); + }, [ pageParser, dispatchCatalogState ]); + + useEffect(() => + { + if(!activeOffer) return; + + const productData = GetProductDataForLocalization(activeOffer.localizationId); + + if(!productData) return; + + for(const paletteData of petPalettes) + { + if(paletteData.breed !== productData.type) continue; + + const palettes: SellablePetPaletteData[] = []; + + for(const palette of paletteData.palettes) + { + if(!palette.sellable) continue; + + palettes.push(palette); + } + + BatchUpdates(() => + { + setSelectedPaletteIndex((palettes.length ? 0 : -1)); + setSellablePalettes(palettes); + }); + + return; + } + + BatchUpdates(() => + { + setSelectedPaletteIndex(-1); + setSellablePalettes([]); + }); + + SendMessageHook(new GetSellablePetPalettesComposer(productData.type)); + }, [ activeOffer, petPalettes ]); + + useEffect(() => + { + if(petIndex === -1) return; + + const colors = GetPetAvailableColors(petIndex, sellablePalettes); + + BatchUpdates(() => + { + setSelectedColorIndex((colors.length ? 0 : -1)); + setSellableColors(colors); + }); + }, [ petIndex, sellablePalettes ]); + + useEffect(() => + { + if(!roomPreviewer) return; + + roomPreviewer && roomPreviewer.reset(false); + + if((petIndex === -1) || !sellablePalettes.length || (selectedPaletteIndex === -1)) return; + + let petFigureString = `${ petIndex } ${ sellablePalettes[selectedPaletteIndex].paletteId }`; + + if(petIndex <= 7) petFigureString += ` ${ getColor.toString(16) }`; + + roomPreviewer.addPetIntoRoom(petFigureString); + }, [ roomPreviewer, petIndex, sellablePalettes, selectedPaletteIndex, getColor ]); + if(!activeOffer) return null; return ( - - - + + + { !colorsShowing && (sellablePalettes.length > 0) && sellablePalettes.map((palette, index) => { return ( - setSelectedPaletteIndex(index) }> + setSelectedPaletteIndex(index) }> - + ); })} - { colorsShowing && (sellableColors.length > 0) && sellableColors.map((colorSet, index) => - { - return ( - setSelectedColorIndex(index) } /> - ); - })} - - - + { colorsShowing && (sellableColors.length > 0) && sellableColors.map((colorSet, index) => setSelectedColorIndex(index) } />) } + + + { (petIndex === -1) && } { (petIndex >= 0) && <> - + { roomPreviewer && } { (petIndex > -1 && petIndex <= 7) && - - - } - - - { petBreedName } + + + } + + + { petBreedName } - + } - - + + ); } diff --git a/src/views/catalog/views/page/layout/pets/name-approval/CatalogPetNameApprovalView.tsx b/src/components/catalog/views/page/layout/pets/CatalogPetNameApprovalView.tsx similarity index 78% rename from src/views/catalog/views/page/layout/pets/name-approval/CatalogPetNameApprovalView.tsx rename to src/components/catalog/views/page/layout/pets/CatalogPetNameApprovalView.tsx index c7b6f5c0..22d863b7 100644 --- a/src/views/catalog/views/page/layout/pets/name-approval/CatalogPetNameApprovalView.tsx +++ b/src/components/catalog/views/page/layout/pets/CatalogPetNameApprovalView.tsx @@ -1,19 +1,21 @@ -import { FC, useCallback, useEffect, useMemo, useState } from 'react'; -import { LocalizeText } from '../../../../../../../api'; -import { CatalogEvent, CatalogNameResultEvent } from '../../../../../../../events'; -import { useUiEvent } from '../../../../../../../hooks/events/ui/ui-event'; -import { CatalogPetNameApprovalViewProps } from './CatalogPetNameApprovalView.types'; +import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'; +import { LocalizeText } from '../../../../../../api'; +import { CatalogEvent, CatalogNameResultEvent } from '../../../../../../events'; +import { useUiEvent } from '../../../../../../hooks/events/ui/ui-event'; + +export interface CatalogPetNameApprovalViewProps +{ + petNameValue: string; + setPetNameValue: Dispatch>; + nameApproved: boolean; + setNameApproved: Dispatch>; +} export const CatalogPetNameApprovalView: FC = props => { const { petNameValue = null, setPetNameValue = null, nameApproved = false, setNameApproved = null } = props; const [ validationResult, setValidationResult ] = useState(-1); - useEffect(() => - { - setValidationResult(-1); - }, [ petNameValue ]); - const onCatalogNameResultEvent = useCallback((event: CatalogNameResultEvent) => { if(event.result === 0) @@ -28,7 +30,7 @@ export const CatalogPetNameApprovalView: FC = p useUiEvent(CatalogEvent.APPROVE_NAME_RESULT, onCatalogNameResultEvent); - const validationErrorMessage = useMemo(() => + const validationErrorMessage = () => { let key: string = ''; @@ -49,7 +51,12 @@ export const CatalogPetNameApprovalView: FC = p } return LocalizeText(key); - }, [ validationResult ]); + } + + useEffect(() => + { + setValidationResult(-1); + }, [ petNameValue ]); return (
diff --git a/src/views/catalog/views/page/layout/pets2/CatalogLayoutPets2View.tsx b/src/components/catalog/views/page/layout/pets2/CatalogLayoutPets2View.tsx similarity index 50% rename from src/views/catalog/views/page/layout/pets2/CatalogLayoutPets2View.tsx rename to src/components/catalog/views/page/layout/pets2/CatalogLayoutPets2View.tsx index 06dd970c..1bf23836 100644 --- a/src/views/catalog/views/page/layout/pets2/CatalogLayoutPets2View.tsx +++ b/src/components/catalog/views/page/layout/pets2/CatalogLayoutPets2View.tsx @@ -1,8 +1,8 @@ import { FC } from 'react'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; import { CatalogLayoutPets3View } from '../pets3/CatalogLayoutPets3View'; -import { CatalogLayoutPets2ViewProps } from './CatalogLayoutPets2View.types'; -export const CatalogLayoutPets2View: FC = props => +export const CatalogLayoutPets2View: FC = props => { return } diff --git a/src/components/catalog/views/page/layout/pets3/CatalogLayoutPets3View.tsx b/src/components/catalog/views/page/layout/pets3/CatalogLayoutPets3View.tsx new file mode 100644 index 00000000..fe9111aa --- /dev/null +++ b/src/components/catalog/views/page/layout/pets3/CatalogLayoutPets3View.tsx @@ -0,0 +1,28 @@ +import { FC } from 'react'; +import { Base } from '../../../../../../common/Base'; +import { Column } from '../../../../../../common/Column'; +import { Flex } from '../../../../../../common/Flex'; +import { GetCatalogPageImage, GetCatalogPageText } from '../../../../common/CatalogUtilities'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; + +export const CatalogLayoutPets3View: FC = props => +{ + const { pageParser = null } = props; + + const imageUrl = GetCatalogPageImage(pageParser, 1); + + return ( + + + { imageUrl && } + + + + + + + + + + ); +} diff --git a/src/views/catalog/views/page/layout/single-bundle/CatalogLayoutSingleBundleView.tsx b/src/components/catalog/views/page/layout/single-bundle/CatalogLayoutSingleBundleView.tsx similarity index 53% rename from src/views/catalog/views/page/layout/single-bundle/CatalogLayoutSingleBundleView.tsx rename to src/components/catalog/views/page/layout/single-bundle/CatalogLayoutSingleBundleView.tsx index e826290c..38944c38 100644 --- a/src/views/catalog/views/page/layout/single-bundle/CatalogLayoutSingleBundleView.tsx +++ b/src/components/catalog/views/page/layout/single-bundle/CatalogLayoutSingleBundleView.tsx @@ -1,31 +1,29 @@ import { FC } from 'react'; -import { NitroCardGridView, NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; import { useCatalogContext } from '../../../../context/CatalogContext'; import { CatalogPageDetailsView } from '../../../page-details/CatalogPageDetailsView'; import { CatalogProductView } from '../../product/CatalogProductView'; import { CatalogPurchaseView } from '../../purchase/CatalogPurchaseView'; -import { CatalogLayoutSingleBundleViewProps } from './CatalogLayoutSingleBundleView.types'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; -export const CatalogLayoutSingleBundleView: FC = props => +export const CatalogLayoutSingleBundleView: FC = props => { const { roomPreviewer = null, pageParser = null } = props; const { catalogState = null, dispatchCatalogState = null } = useCatalogContext(); const { activeOffer = null } = catalogState; return ( - - - - { activeOffer && activeOffer.products && (activeOffer.products.length > 0) && activeOffer.products.map((product, index) => - { - return - }) } - - - + + + + { activeOffer && activeOffer.products && (activeOffer.products.length > 0) && activeOffer.products.map((product, index) => )} + + + { activeOffer && } - - + + ); } diff --git a/src/views/catalog/views/page/layout/spaces-new/CatalogLayoutSpacesView.tsx b/src/components/catalog/views/page/layout/spaces-new/CatalogLayoutSpacesView.tsx similarity index 73% rename from src/views/catalog/views/page/layout/spaces-new/CatalogLayoutSpacesView.tsx rename to src/components/catalog/views/page/layout/spaces-new/CatalogLayoutSpacesView.tsx index 2a04a80b..7b8877af 100644 --- a/src/views/catalog/views/page/layout/spaces-new/CatalogLayoutSpacesView.tsx +++ b/src/components/catalog/views/page/layout/spaces-new/CatalogLayoutSpacesView.tsx @@ -1,14 +1,17 @@ import { CatalogPageMessageOfferData, IFurnitureData } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import { GetSessionDataManager, LocalizeText } from '../../../../../../api'; -import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; +import { Button } from '../../../../../../common/Button'; +import { ButtonGroup } from '../../../../../../common/ButtonGroup'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; import { ProductTypeEnum } from '../../../../common/ProductTypeEnum'; import { useCatalogContext } from '../../../../context/CatalogContext'; import { CatalogPageOffersView } from '../../offers/CatalogPageOffersView'; import { CatalogProductPreviewView } from '../../product-preview/CatalogProductPreviewView'; -import { CatalogLayoutSpacesViewProps } from './CatalogLayoutSpacesView.types'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; -export const CatalogLayoutSpacesView: FC = props => +export const CatalogLayoutSpacesView: FC = props => { const { roomPreviewer = null, pageParser = null } = props; const [ groups, setGroups ] = useState([]); @@ -67,19 +70,16 @@ export const CatalogLayoutSpacesView: FC = props = const product = ((activeOffer && activeOffer.products[0]) || null); return ( - - -
- { groupNames.map((name, index) => - { - return - })} -
+ + + + { groupNames.map((name, index) => )} + -
- + + - -
+ + ); } diff --git a/src/views/catalog/views/page/layout/trophies/CatalogLayoutTrophiesView.tsx b/src/components/catalog/views/page/layout/trophies/CatalogLayoutTrophiesView.tsx similarity index 68% rename from src/views/catalog/views/page/layout/trophies/CatalogLayoutTrophiesView.tsx rename to src/components/catalog/views/page/layout/trophies/CatalogLayoutTrophiesView.tsx index 86d0e7ba..f107834b 100644 --- a/src/views/catalog/views/page/layout/trophies/CatalogLayoutTrophiesView.tsx +++ b/src/components/catalog/views/page/layout/trophies/CatalogLayoutTrophiesView.tsx @@ -1,11 +1,12 @@ import { FC, useState } from 'react'; -import { NitroLayoutGrid, NitroLayoutGridColumn } from '../../../../../../layout'; +import { Column } from '../../../../../../common/Column'; +import { Grid } from '../../../../../../common/Grid'; import { useCatalogContext } from '../../../../context/CatalogContext'; import { CatalogPageOffersView } from '../../offers/CatalogPageOffersView'; import { CatalogProductPreviewView } from '../../product-preview/CatalogProductPreviewView'; -import { CatalogLayoutTrophiesViewProps } from './CatalogLayoutTrophiesView.types'; +import { CatalogLayoutProps } from '../CatalogLayout.types'; -export const CatalogLayoutTrophiesView: FC = props => +export const CatalogLayoutTrophiesView: FC = props => { const { roomPreviewer = null, pageParser = null } = props; const { catalogState = null, dispatchCatalogState = null } = useCatalogContext(); @@ -15,14 +16,14 @@ export const CatalogLayoutTrophiesView: FC = pro const product = ((activeOffer && activeOffer.products[0]) || null); return ( - - + +