diff --git a/src/common/AutoGrid.tsx b/src/common/AutoGrid.tsx new file mode 100644 index 00000000..b4618080 --- /dev/null +++ b/src/common/AutoGrid.tsx @@ -0,0 +1,28 @@ +import { CSSProperties, FC, useMemo } from 'react'; +import { Grid, GridProps } from './Grid'; + +export interface AutoGridProps extends GridProps +{ + columnMinWidth?: number; + columnMinHeight?: number; +} + +export const AutoGrid: FC = props => +{ + const { columnMinWidth = 40, columnMinHeight = 40, columnCount = 0, fullHeight = false, overflow = 'auto', style = {}, ...rest } = props; + + const getStyle = useMemo(() => + { + let newStyle: CSSProperties = {}; + + newStyle['--nitro-grid-column-min-height'] = (columnMinHeight + 'px'); + + if(columnCount > 1) newStyle.gridTemplateColumns = `repeat(auto-fill, minmax(${ columnMinWidth }px, 1fr))`; + + if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; + + return newStyle; + }, [ columnMinWidth, columnMinHeight, columnCount, style ]); + + return ; +} diff --git a/src/common/Grid.tsx b/src/common/Grid.tsx index 3062e0e6..5fd3d5b0 100644 --- a/src/common/Grid.tsx +++ b/src/common/Grid.tsx @@ -1,22 +1,20 @@ -import { CSSProperties, FC, useMemo } from 'react'; +import { FC, useMemo } from 'react'; +import { CSSProperties } from 'styled-components'; import { Base, BaseProps } from './Base'; import { GridContextProvider } from './GridContext'; import { SpacingType } from './types'; export interface GridProps extends BaseProps { - columnCount?: number; - columnMinWidth?: number; - columnMinHeight?: number; - grow?: boolean; inline?: boolean; gap?: SpacingType; maxContent?: boolean; + columnCount?: number; } export const Grid: FC = props => { - const { columnCount = 0, columnMinWidth = 40, columnMinHeight = 40, grow = false, fullHeight = undefined, inline = false, gap = 2, maxContent = false, classNames = [], style = {}, ...rest } = props; + const { inline = false, gap = 2, maxContent = false, columnCount = 0, fullHeight = true, classNames = [], style = {}, ...rest } = props; const getClassNames = useMemo(() => { @@ -37,28 +35,18 @@ export const Grid: FC = props => { let newStyle: CSSProperties = {}; - if(columnCount) - { - newStyle['--bs-columns'] = columnCount.toString(); - } - - if(grow && (!columnCount || (columnCount > 1))) - { - newStyle['--nitro-grid-column-min-width'] = (columnMinWidth + 'px'); - newStyle['--nitro-grid-column-min-height'] = (columnMinHeight + 'px'); - newStyle.gridTemplateColumns = 'repeat(auto-fill, minmax(var(--nitro-grid-column-min-width, 45px), 1fr)'; - } + if(columnCount) newStyle['--bs-columns'] = columnCount.toString(); if(maxContent) newStyle.gridTemplateRows = 'max-content'; if(Object.keys(style).length) newStyle = { ...newStyle, ...style }; return newStyle; - }, [ columnCount, columnMinWidth, columnMinHeight, grow, maxContent, style ]); + }, [ columnCount, maxContent, style ]); return ( - + ); } diff --git a/src/components/achievements/AchievementsView.tsx b/src/components/achievements/AchievementsView.tsx index c7ae6633..3b659190 100644 --- a/src/components/achievements/AchievementsView.tsx +++ b/src/components/achievements/AchievementsView.tsx @@ -229,7 +229,7 @@ export const AchievementsView: FC<{}> = props => { !getSelectedCategory && <> - + { LocalizeText('achievements.categories.totalprogress', [ 'progress', 'limit' ], [ getProgress.toString(), getMaxProgress.toString() ]) } diff --git a/src/components/achievements/views/achievement-list/AchievementListView.tsx b/src/components/achievements/views/achievement-list/AchievementListView.tsx index 030d79fd..d0441aad 100644 --- a/src/components/achievements/views/achievement-list/AchievementListView.tsx +++ b/src/components/achievements/views/achievement-list/AchievementListView.tsx @@ -1,9 +1,9 @@ import { AchievementData } from '@nitrots/nitro-renderer'; import { Dispatch, FC, SetStateAction } from 'react'; -import { Grid, GridProps } from '../../../../common/Grid'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { AchievementListItemView } from './AchievementListItemView'; -export interface AchievementListViewProps extends GridProps +export interface AchievementListViewProps { achievements: AchievementData[]; selectedAchievementId: number; @@ -12,15 +12,15 @@ export interface AchievementListViewProps extends GridProps export const AchievementListView: FC = props => { - const { achievements = null, selectedAchievementId = 0, setSelectedAchievementId = null, children = null, ...rest } = props; + const { achievements = null, selectedAchievementId = 0, setSelectedAchievementId = null, children = null } = props; return ( - + { achievements && (achievements.length > 0) && achievements.map((achievement, index) => { return setSelectedAchievementId(achievement.achievementId) } />; }) } { children } - + ); } diff --git a/src/components/achievements/views/category-list/AchievementsCategoryListView.tsx b/src/components/achievements/views/category-list/AchievementsCategoryListView.tsx index e5d47325..9b2b1ceb 100644 --- a/src/components/achievements/views/category-list/AchievementsCategoryListView.tsx +++ b/src/components/achievements/views/category-list/AchievementsCategoryListView.tsx @@ -1,9 +1,9 @@ import { Dispatch, FC, SetStateAction } from 'react'; -import { Grid, GridProps } from '../../../../common/Grid'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { AchievementCategory } from '../../common/AchievementCategory'; import { AchievementsCategoryListItemView } from './AchievementsCategoryListItemView'; -export interface AchievementsCategoryListViewProps extends GridProps +export interface AchievementsCategoryListViewProps { categories: AchievementCategory[]; selectedCategoryCode: string; @@ -12,12 +12,12 @@ export interface AchievementsCategoryListViewProps extends GridProps export const AchievementsCategoryListView: FC = props => { - const { categories = null, selectedCategoryCode = null, setSelectedCategoryCode = null, children = null, ...rest } = props; + const { categories = null, selectedCategoryCode = null, setSelectedCategoryCode = null, children = null } = props; return ( - + { categories && (categories.length > 0) && categories.map((category, index) => setSelectedCategoryCode(category.code) } /> ) } { children } - + ); }; diff --git a/src/components/avatar-editor/views/figure-set/AvatarEditorFigureSetView.tsx b/src/components/avatar-editor/views/figure-set/AvatarEditorFigureSetView.tsx index 4092696e..484f2990 100644 --- a/src/components/avatar-editor/views/figure-set/AvatarEditorFigureSetView.tsx +++ b/src/components/avatar-editor/views/figure-set/AvatarEditorFigureSetView.tsx @@ -1,5 +1,5 @@ import { Dispatch, FC, SetStateAction, useCallback } from 'react'; -import { Grid } from '../../../../common/Grid'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { AvatarEditorGridPartItem } from '../../common/AvatarEditorGridPartItem'; import { CategoryData } from '../../common/CategoryData'; import { IAvatarEditorCategoryModel } from '../../common/IAvatarEditorCategoryModel'; @@ -30,9 +30,9 @@ export const AvatarEditorFigureSetView: FC = pro }, [ model, category, setMaxPaletteCount ]); return ( - + { (category.parts.length > 0) && category.parts.map((item, index) => selectPart(item) } />) } - + ); } diff --git a/src/components/avatar-editor/views/palette-set/AvatarEditorPaletteSetView.tsx b/src/components/avatar-editor/views/palette-set/AvatarEditorPaletteSetView.tsx index 0fbb7a0c..f9b3137f 100644 --- a/src/components/avatar-editor/views/palette-set/AvatarEditorPaletteSetView.tsx +++ b/src/components/avatar-editor/views/palette-set/AvatarEditorPaletteSetView.tsx @@ -1,5 +1,5 @@ import { FC, useCallback } from 'react'; -import { Grid } from '../../../../common/Grid'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { AvatarEditorGridColorItem } from '../../common/AvatarEditorGridColorItem'; import { CategoryData } from '../../common/CategoryData'; import { IAvatarEditorCategoryModel } from '../../common/IAvatarEditorCategoryModel'; @@ -27,9 +27,9 @@ export const AvatarEditorPaletteSetView: FC = p }, [ model, category, paletteSet, paletteIndex ]); return ( - + { (paletteSet.length > 0) && paletteSet.map((item, index) => selectColor(item) } />) } - + ); } diff --git a/src/components/avatar-editor/views/wardrobe/AvatarEditorWardrobeView.tsx b/src/components/avatar-editor/views/wardrobe/AvatarEditorWardrobeView.tsx index f1a20a5d..b484e57c 100644 --- a/src/components/avatar-editor/views/wardrobe/AvatarEditorWardrobeView.tsx +++ b/src/components/avatar-editor/views/wardrobe/AvatarEditorWardrobeView.tsx @@ -2,7 +2,7 @@ import { IAvatarFigureContainer, SaveWardrobeOutfitMessageComposer } from '@nitr import { Dispatch, FC, SetStateAction, useCallback, useMemo } from 'react'; import { Button } from 'react-bootstrap'; import { GetAvatarRenderManager, GetSessionDataManager } from '../../../../api'; -import { Grid } from '../../../../common/Grid'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { LayoutGridItem } from '../../../../common/layout/LayoutGridItem'; import { SendMessageHook } from '../../../../hooks'; import { AvatarImageView } from '../../../../views/shared/avatar-image/AvatarImageView'; @@ -74,8 +74,8 @@ export const AvatarEditorWardrobeView: FC = props }, [ savedFigures, saveFigureAtWardrobeIndex, wearFigureAtIndex ]); return ( - + { figures } - + ); } diff --git a/src/components/camera/views/editor/effect-list/CameraWidgetEffectListView.tsx b/src/components/camera/views/editor/effect-list/CameraWidgetEffectListView.tsx index b9349aac..3c007676 100644 --- a/src/components/camera/views/editor/effect-list/CameraWidgetEffectListView.tsx +++ b/src/components/camera/views/editor/effect-list/CameraWidgetEffectListView.tsx @@ -1,6 +1,6 @@ import { IRoomCameraWidgetEffect, IRoomCameraWidgetSelectedEffect } from '@nitrots/nitro-renderer'; import { FC } from 'react'; -import { Grid } from '../../../../../common/Grid'; +import { AutoGrid } from '../../../../../common/AutoGrid'; import { CameraPictureThumbnail } from '../../../common/CameraPictureThumbnail'; import { CameraWidgetEffectListItemView } from './CameraWidgetEffectListItemView'; @@ -18,7 +18,7 @@ export const CameraWidgetEffectListView: FC = p const { myLevel = 0, selectedEffects = [], effects = [], thumbnails = [], processAction = null } = props; return ( - + { effects && (effects.length > 0) && effects.map((effect, index) => { const thumbnailUrl = (thumbnails.find(thumbnail => (thumbnail.effectName === effect.name))); @@ -26,6 +26,6 @@ export const CameraWidgetEffectListView: FC = p return myLevel) } selectEffect={ () => processAction('select_effect', effect.name) } removeEffect={ () => processAction('remove_effect', effect.name) } /> }) } - + ); } diff --git a/src/components/catalog/views/navigation/CatalogNavigationView.tsx b/src/components/catalog/views/navigation/CatalogNavigationView.tsx index 320da3cc..6f89c40e 100644 --- a/src/components/catalog/views/navigation/CatalogNavigationView.tsx +++ b/src/components/catalog/views/navigation/CatalogNavigationView.tsx @@ -21,7 +21,7 @@ export const CatalogNavigationView: FC = props => <> - + { searchResult && (searchResult.filteredNodes.length > 0) && searchResult.filteredNodes.map((n, index) => { return ; diff --git a/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx b/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx index 33b61f1f..01616a57 100644 --- a/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx +++ b/src/components/catalog/views/page/layout/CatalogLayoutVipBuyView.tsx @@ -1,6 +1,7 @@ import { ClubOfferData, GetClubOffersMessageComposer, PurchaseFromCatalogComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { LocalizeText } from '../../../../../api'; +import { AutoGrid } from '../../../../../common/AutoGrid'; import { Button } from '../../../../../common/Button'; import { Column } from '../../../../../common/Column'; import { Flex } from '../../../../../common/Flex'; @@ -147,7 +148,7 @@ export const CatalogLayoutVipBuyView: FC = props => return ( - + { clubOffers && (clubOffers.length > 0) && clubOffers.map((offer, index) => { return ( @@ -171,7 +172,7 @@ export const CatalogLayoutVipBuyView: FC = props => ); }) } - + diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx index 94f94ef1..22ee1f34 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplaceOwnItemsView.tsx @@ -106,7 +106,7 @@ export const CatalogLayoutMarketplaceOwnItemsView: FC = prop { LocalizeText('catalog.marketplace.items_found', [ 'count' ], [ offers.length.toString() ]) } - + { (offers.length > 0) && offers.map(offer => ) } diff --git a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx index 0493c33a..2ad20abb 100644 --- a/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx +++ b/src/components/catalog/views/page/layout/marketplace/CatalogLayoutMarketplacePublicItemsView.tsx @@ -163,7 +163,7 @@ export const CatalogLayoutMarketplacePublicItemsView: FC { LocalizeText('catalog.marketplace.items_found', [ 'count' ], [ offers.size.toString() ]) } - + { Array.from(offers.values()).map( (entry, index) => ) } diff --git a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx index ed24bc07..e18f6220 100644 --- a/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx +++ b/src/components/catalog/views/page/layout/pets/CatalogLayoutPetView.tsx @@ -2,6 +2,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { ApproveNameMessageComposer, ColorConverter, GetSellablePetPalettesComposer, PurchaseFromCatalogComposer, SellablePetPaletteData } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { LocalizeText } from '../../../../../../api'; +import { AutoGrid } from '../../../../../../common/AutoGrid'; import { Base } from '../../../../../../common/Base'; import { Button } from '../../../../../../common/Button'; import { Column } from '../../../../../../common/Column'; @@ -218,7 +219,7 @@ export const CatalogLayoutPetView: FC = props => return ( - + { !colorsShowing && (sellablePalettes.length > 0) && sellablePalettes.map((palette, index) => { return ( @@ -228,7 +229,7 @@ export const CatalogLayoutPetView: FC = props => ); })} { colorsShowing && (sellableColors.length > 0) && sellableColors.map((colorSet, index) => setSelectedColorIndex(index) } />) } - + { !currentOffer && diff --git a/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx b/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx index 6e7f95b3..0de56d15 100644 --- a/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx +++ b/src/components/catalog/views/page/layout/vip-gifts/CatalogLayoutVipGiftsView.tsx @@ -45,7 +45,7 @@ export const CatalogLayoutVipGiftsView: FC = props => return ( <> { giftsAvailable() } - + { (clubGifts.offers.length > 0) && clubGifts.offers.map(offer => 0)) } onSelect={ selectGift }/>) } diff --git a/src/components/catalog/views/page/widgets/CatalogBadgeSelectorWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogBadgeSelectorWidgetView.tsx index 56c51eff..cc1c42ab 100644 --- a/src/components/catalog/views/page/widgets/CatalogBadgeSelectorWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogBadgeSelectorWidgetView.tsx @@ -1,6 +1,6 @@ import { StringDataType } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useState } from 'react'; -import { Grid, GridProps } from '../../../../../common/Grid'; +import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid'; import { LayoutGridItem } from '../../../../../common/layout/LayoutGridItem'; import { InventoryBadgesUpdatedEvent } from '../../../../../events'; import { InventoryBadgesRequestEvent } from '../../../../../events/inventory/InventoryBadgesRequestEvent'; @@ -10,7 +10,7 @@ import { useCatalogContext } from '../../../CatalogContext'; const EXCLUDED_BADGE_CODES: string[] = []; -interface CatalogBadgeSelectorWidgetViewProps extends GridProps +interface CatalogBadgeSelectorWidgetViewProps extends AutoGridProps { } @@ -59,7 +59,7 @@ export const CatalogBadgeSelectorWidgetView: FC + { badges && (badges.length > 0) && badges.map(code => { return ( @@ -68,6 +68,6 @@ export const CatalogBadgeSelectorWidgetView: FC ); }) } - + ); } diff --git a/src/components/catalog/views/page/widgets/CatalogBundleGridWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogBundleGridWidgetView.tsx index acf5f909..cfbbccd4 100644 --- a/src/components/catalog/views/page/widgets/CatalogBundleGridWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogBundleGridWidgetView.tsx @@ -1,9 +1,9 @@ import { FC } from 'react'; -import { Grid, GridProps } from '../../../../../common/Grid'; +import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid'; import { LayoutGridItem } from '../../../../../common/layout/LayoutGridItem'; import { useCatalogContext } from '../../../CatalogContext'; -interface CatalogBundleGridWidgetViewProps extends GridProps +interface CatalogBundleGridWidgetViewProps extends AutoGridProps { } @@ -16,9 +16,9 @@ export const CatalogBundleGridWidgetView: FC = if(!currentOffer) return null; return ( - + { currentOffer.products && (currentOffer.products.length > 0) && currentOffer.products.map((product, index) => ) } { children } - + ); } diff --git a/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx index 99c98a4d..e41ff311 100644 --- a/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogItemGridWidgetView.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { Grid, GridProps } from '../../../../../common/Grid'; +import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid'; import { CatalogSetExtraPurchaseParameterEvent } from '../../../../../events'; import { dispatchUiEvent } from '../../../../../hooks'; import { useCatalogContext } from '../../../CatalogContext'; @@ -7,14 +7,14 @@ import { IPurchasableOffer } from '../../../common/IPurchasableOffer'; import { ProductTypeEnum } from '../../../common/ProductTypeEnum'; import { CatalogGridOfferView } from '../common/CatalogGridOfferView'; -interface CatalogItemGridWidgetViewProps extends GridProps +interface CatalogItemGridWidgetViewProps extends AutoGridProps { } export const CatalogItemGridWidgetView: FC = props => { - const { children = null, ...rest } = props; + const { columnCount = 5, children = null, ...rest } = props; const { currentOffer = null, setCurrentOffer = null, currentPage = null } = useCatalogContext(); if(!currentPage) return null; @@ -30,12 +30,12 @@ export const CatalogItemGridWidgetView: FC = pro } return ( - + { currentPage.offers && (currentPage.offers.length > 0) && currentPage.offers.map((offer, index) => { return selectOffer(offer) } />; }) } { children } - + ); } diff --git a/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx index 08c2f145..746a11bb 100644 --- a/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogSpacesWidgetView.tsx @@ -1,8 +1,8 @@ import { FC, useEffect, useState } from 'react'; import { LocalizeText } from '../../../../../api'; +import { AutoGrid, AutoGridProps } from '../../../../../common/AutoGrid'; import { Button } from '../../../../../common/Button'; import { ButtonGroup } from '../../../../../common/ButtonGroup'; -import { Grid, GridProps } from '../../../../../common/Grid'; import { BatchUpdates } from '../../../../../hooks'; import { useCatalogContext } from '../../../CatalogContext'; import { IPurchasableOffer } from '../../../common/IPurchasableOffer'; @@ -10,7 +10,7 @@ import { Offer } from '../../../common/Offer'; import { ProductTypeEnum } from '../../../common/ProductTypeEnum'; import { CatalogGridOfferView } from '../common/CatalogGridOfferView'; -interface CatalogSpacesWidgetViewProps extends GridProps +interface CatalogSpacesWidgetViewProps extends AutoGridProps { } @@ -19,7 +19,7 @@ const SPACES_GROUP_NAMES = [ 'floors', 'walls', 'views' ]; export const CatalogSpacesWidgetView: FC = props => { - const { children = null, ...rest } = props; + const { columnCount = 5, children = null, ...rest } = props; const [ groupedOffers, setGroupedOffers ] = useState(null); const [ selectedGroupIndex, setSelectedGroupIndex ] = useState(-1); const [ selectedOfferForGroup, setSelectedOfferForGroup ] = useState(null); @@ -93,7 +93,7 @@ export const CatalogSpacesWidgetView: FC = props = { SPACES_GROUP_NAMES.map((name, index) => ) } - + { offers && (offers.length > 0) && offers.map((offer, index) => { const setSelectedOffer = () => @@ -111,7 +111,7 @@ export const CatalogSpacesWidgetView: FC = props = return ; }) } { children } - + ); } diff --git a/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx index e3a98a13..e2ad9bc1 100644 --- a/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogViewProductWidgetView.tsx @@ -1,8 +1,8 @@ import { Vector3d } from '@nitrots/nitro-renderer'; import { FC, useEffect } from 'react'; import { GetAvatarRenderManager, GetSessionDataManager } from '../../../../../api'; +import { AutoGrid } from '../../../../../common/AutoGrid'; import { Column } from '../../../../../common/Column'; -import { Grid } from '../../../../../common/Grid'; import { LayoutGridItem } from '../../../../../common/layout/LayoutGridItem'; import { RoomPreviewerView } from '../../../../../views/shared/room-previewer/RoomPreviewerView'; import { useCatalogContext } from '../../../CatalogContext'; @@ -92,12 +92,12 @@ export const CatalogViewProductWidgetView: FC<{}> = props => { return ( - + { (currentOffer.products.length > 0) && currentOffer.products.map((product, index) => { return ; }) } - + ); } diff --git a/src/components/inventory/InventoryView.scss b/src/components/inventory/InventoryView.scss index 2cb695c0..8796e67f 100644 --- a/src/components/inventory/InventoryView.scss +++ b/src/components/inventory/InventoryView.scss @@ -12,5 +12,6 @@ min-height: 0; font-size: 8px; padding: 1px 2px; + z-index: 5; } } diff --git a/src/components/inventory/views/badge/InventoryBadgeView.tsx b/src/components/inventory/views/badge/InventoryBadgeView.tsx index 085af1e3..73300e10 100644 --- a/src/components/inventory/views/badge/InventoryBadgeView.tsx +++ b/src/components/inventory/views/badge/InventoryBadgeView.tsx @@ -1,6 +1,7 @@ import { RequestBadgesComposer } from '@nitrots/nitro-renderer'; import { FC, useEffect } from 'react'; import { LocalizeBadgeName, LocalizeText } from '../../../../api'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { Button } from '../../../../common/Button'; import { Column } from '../../../../common/Column'; import { Flex } from '../../../../common/Flex'; @@ -77,21 +78,21 @@ export const InventoryBadgeView: FC = props => return ( - + { badges && (badges.length > 0) && badges.map((code, index) => { if(activeBadges.indexOf(code) >= 0) return null; return }) } - + { LocalizeText('inventory.badges.activebadges') } - + { activeBadges && (activeBadges.length > 0) && activeBadges.map((code, index) => ) } - + { badge && (badge.length > 0) && diff --git a/src/components/inventory/views/bot/InventoryBotView.tsx b/src/components/inventory/views/bot/InventoryBotView.tsx index eff4a3c7..5a37f30f 100644 --- a/src/components/inventory/views/bot/InventoryBotView.tsx +++ b/src/components/inventory/views/bot/InventoryBotView.tsx @@ -1,6 +1,7 @@ import { GetBotInventoryComposer, IRoomSession, RoomObjectVariable, RoomPreviewer } from '@nitrots/nitro-renderer'; import { FC, useEffect } from 'react'; import { GetRoomEngine, LocalizeText } from '../../../../api'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { Button } from '../../../../common/Button'; import { Column } from '../../../../common/Column'; import { Grid } from '../../../../common/Grid'; @@ -77,9 +78,9 @@ export const InventoryBotView: FC = props => return ( - + { botItems && (botItems.length > 0) && botItems.map(item => ) } - + diff --git a/src/components/inventory/views/furniture/InventoryFurnitureView.tsx b/src/components/inventory/views/furniture/InventoryFurnitureView.tsx index 7e6c0894..d266e1d6 100644 --- a/src/components/inventory/views/furniture/InventoryFurnitureView.tsx +++ b/src/components/inventory/views/furniture/InventoryFurnitureView.tsx @@ -1,6 +1,7 @@ import { FurnitureListComposer, IRoomSession, RoomObjectVariable, RoomPreviewer, Vector3d } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import { GetRoomEngine, GetSessionDataManager, LocalizeText } from '../../../../api'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { Button } from '../../../../common/Button'; import { Column } from '../../../../common/Column'; import { Grid } from '../../../../common/Grid'; @@ -114,9 +115,9 @@ export const InventoryFurnitureView: FC = props => - + { filteredGroupItems && (filteredGroupItems.length > 0) && filteredGroupItems.map((item, index) => ) } - + diff --git a/src/components/inventory/views/pet/InventoryPetView.tsx b/src/components/inventory/views/pet/InventoryPetView.tsx index 50bd8e71..411e9cb8 100644 --- a/src/components/inventory/views/pet/InventoryPetView.tsx +++ b/src/components/inventory/views/pet/InventoryPetView.tsx @@ -1,6 +1,7 @@ import { IRoomSession, RequestPetsComposer, RoomObjectVariable, RoomPreviewer } from '@nitrots/nitro-renderer'; import { FC, useEffect } from 'react'; import { GetRoomEngine, LocalizeText } from '../../../../api'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { Button } from '../../../../common/Button'; import { Column } from '../../../../common/Column'; import { Grid } from '../../../../common/Grid'; @@ -76,9 +77,9 @@ export const InventoryPetView: FC = props => return ( - + { petItems && (petItems.length > 0) && petItems.map(item => ) } - + diff --git a/src/components/inventory/views/trade/InventoryTradeView.tsx b/src/components/inventory/views/trade/InventoryTradeView.tsx index f85a81f9..cccb32df 100644 --- a/src/components/inventory/views/trade/InventoryTradeView.tsx +++ b/src/components/inventory/views/trade/InventoryTradeView.tsx @@ -2,6 +2,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FurnitureListComposer, IObjectData, TradingAcceptComposer, TradingConfirmationComposer, TradingListAddItemComposer, TradingListAddItemsComposer, TradingListItemRemoveComposer, TradingUnacceptComposer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import { LocalizeText } from '../../../../api'; +import { AutoGrid } from '../../../../common/AutoGrid'; import { Base } from '../../../../common/Base'; import { Button } from '../../../../common/Button'; import { Column } from '../../../../common/Column'; @@ -229,7 +230,7 @@ export const InventoryTradeView: FC = props => - + { filteredGroupItems && (filteredGroupItems.length > 0) && filteredGroupItems.map((item, index) => { const count = item.getUnlockedCount(); @@ -243,7 +244,7 @@ export const InventoryTradeView: FC = props => ); }) } - + { groupItem ? groupItem.name : LocalizeText('catalog_selectproduct') } @@ -256,7 +257,7 @@ export const InventoryTradeView: FC = props => { LocalizeText('inventory.trading.you') } { LocalizeText('inventory.trading.areoffering') }: { getLockIcon(tradeData.ownUser.accepts) } - + { Array.from(Array(MAX_ITEMS_TO_TRADE), (e, i) => { const item = (tradeData.ownUser.items.getWithIndex(i) || null); @@ -272,7 +273,7 @@ export const InventoryTradeView: FC = props => ); }) } - + { ownGroupItem ? ownGroupItem.name : LocalizeText('catalog_selectproduct') } @@ -282,7 +283,7 @@ export const InventoryTradeView: FC = props => { tradeData.otherUser.userName } { LocalizeText('inventory.trading.isoffering') }: { getLockIcon(tradeData.otherUser.accepts) } - + { Array.from(Array(MAX_ITEMS_TO_TRADE), (e, i) => { const item = (tradeData.otherUser.items.getWithIndex(i) || null); @@ -291,7 +292,7 @@ export const InventoryTradeView: FC = props => return setOtherGroupItem(item) } />; }) } - + { otherGroupItem ? otherGroupItem.name : LocalizeText('catalog_selectproduct') } diff --git a/src/components/navigator/views/room-info/NavigatorRoomInfoView.tsx b/src/components/navigator/views/room-info/NavigatorRoomInfoView.tsx index d97cd1ba..cdc4f34f 100644 --- a/src/components/navigator/views/room-info/NavigatorRoomInfoView.tsx +++ b/src/components/navigator/views/room-info/NavigatorRoomInfoView.tsx @@ -160,13 +160,13 @@ export const NavigatorRoomInfoView: FC = props => }) } } - - processAction('set_home_room') } className={ 'flex-shrink-0 icon icon-house-small cursor-pointer' + classNames({ ' gray': homeRoomId !== roomInfoData.enteredGuestRoom.roomId }) } /> - dispatchUiEvent(new NavigatorEvent(NavigatorEvent.TOGGLE_ROOM_LINK)) } /> + + processAction('set_home_room') } className={ 'g-col-6 flex-shrink-0 icon icon-house-small cursor-pointer' + classNames({ ' gray': homeRoomId !== roomInfoData.enteredGuestRoom.roomId }) } /> + dispatchUiEvent(new NavigatorEvent(NavigatorEvent.TOGGLE_ROOM_LINK)) } /> { hasPermission('settings') && <> - processAction('open_room_settings') } /> - processAction('open_floorplan_editor') } /> + processAction('open_room_settings') } /> + processAction('open_floorplan_editor') } /> }