diff --git a/src/common/layout/LayoutRoomPreviewerView.tsx b/src/common/layout/LayoutRoomPreviewerView.tsx index 8fe3b44c..8a5e4185 100644 --- a/src/common/layout/LayoutRoomPreviewerView.tsx +++ b/src/common/layout/LayoutRoomPreviewerView.tsx @@ -1,16 +1,12 @@ import { GetRenderer, GetTicker, NitroTicker, RoomPreviewer, TextureUtils } from '@nitrots/nitro-renderer'; -import { FC, MouseEvent, ReactNode, useEffect, useRef } from 'react'; +import { FC, MouseEvent, useEffect, useRef } from 'react'; -export interface LayoutRoomPreviewerViewProps -{ +export const LayoutRoomPreviewerView: FC<{ roomPreviewer: RoomPreviewer; height?: number; - children?: ReactNode; -} - -export const LayoutRoomPreviewerView: FC = props => +}> = props => { - const { roomPreviewer = null, height = 0, children = null } = props; + const { roomPreviewer = null, height = 0 } = props; const elementRef = useRef(); const onClick = (event: MouseEvent) => @@ -80,9 +76,14 @@ export const LayoutRoomPreviewerView: FC = props = }, [ roomPreviewer, elementRef, height ]); return ( -
-
- { children } -
+
); } diff --git a/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx b/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx index 0e460e54..345d7474 100644 --- a/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx +++ b/src/components/catalog/views/catalog-room-previewer/CatalogRoomPreviewerView.tsx @@ -1,10 +1,13 @@ -import { GetEventDispatcher, NitroToolbarAnimateIconEvent, TextureUtils, ToolbarIconEnum } from '@nitrots/nitro-renderer'; +import { GetEventDispatcher, NitroToolbarAnimateIconEvent, RoomPreviewer, TextureUtils, ToolbarIconEnum } from '@nitrots/nitro-renderer'; import { FC, useRef } from 'react'; -import { LayoutRoomPreviewerView, LayoutRoomPreviewerViewProps } from '../../../../common'; +import { LayoutRoomPreviewerView } from '../../../../common'; import { CatalogPurchasedEvent } from '../../../../events'; import { useUiEvent } from '../../../../hooks'; -export const CatalogRoomPreviewerView: FC = props => +export const CatalogRoomPreviewerView: FC<{ + roomPreviewer: RoomPreviewer; + height?: number; +}> = props => { const { roomPreviewer = null } = props; const elementRef = useRef(null); diff --git a/src/components/inventory/views/badge/InventoryBadgeItemView.tsx b/src/components/inventory/views/badge/InventoryBadgeItemView.tsx index 459679f5..d355ae4a 100644 --- a/src/components/inventory/views/badge/InventoryBadgeItemView.tsx +++ b/src/components/inventory/views/badge/InventoryBadgeItemView.tsx @@ -1,7 +1,8 @@ import { FC, PropsWithChildren } from 'react'; import { UnseenItemCategory } from '../../../../api'; -import { LayoutBadgeImageView, LayoutGridItem } from '../../../../common'; +import { LayoutBadgeImageView } from '../../../../common'; import { useInventoryBadges, useInventoryUnseenTracker } from '../../../../hooks'; +import { InfiniteGrid } from '../../../../layout'; export const InventoryBadgeItemView: FC> = props => { @@ -11,9 +12,9 @@ export const InventoryBadgeItemView: FC const unseen = isUnseen(UnseenItemCategory.BADGE, getBadgeId(badgeCode)); return ( - toggleBadge(selectedBadgeCode) } onMouseDown={ event => setSelectedBadgeCode(badgeCode) } { ...rest }> + toggleBadge(selectedBadgeCode) } onMouseDown={ event => setSelectedBadgeCode(badgeCode) } { ...rest }> { children } - + ); -} \ No newline at end of file +} diff --git a/src/components/inventory/views/badge/InventoryBadgeView.tsx b/src/components/inventory/views/badge/InventoryBadgeView.tsx index a67cd171..7c635ac2 100644 --- a/src/components/inventory/views/badge/InventoryBadgeView.tsx +++ b/src/components/inventory/views/badge/InventoryBadgeView.tsx @@ -1,7 +1,8 @@ import { FC, useEffect, useState } from 'react'; import { LocalizeBadgeName, LocalizeText, UnseenItemCategory } from '../../../../api'; -import { AutoGrid, Button, Column, Grid, LayoutBadgeImageView, Text } from '../../../../common'; +import { LayoutBadgeImageView } from '../../../../common'; import { useInventoryBadges, useInventoryUnseenTracker } from '../../../../hooks'; +import { InfiniteGrid, NitroButton } from '../../../../layout'; import { InventoryBadgeItemView } from './InventoryBadgeItemView'; export const InventoryBadgeView: FC<{}> = props => @@ -34,33 +35,36 @@ export const InventoryBadgeView: FC<{}> = props => }, []); return ( - - - - { badgeCodes && (badgeCodes.length > 0) && badgeCodes.map((badgeCode, index) => - { - if(isWearingBadge(badgeCode)) return null; - - return - }) } - - - - - { LocalizeText('inventory.badges.activebadges') } - - { activeBadgeCodes && (activeBadgeCodes.length > 0) && activeBadgeCodes.map((badgeCode, index) => ) } - - +
+
+ + columnCount={ 5 } + estimateSize={ 50 } + itemRender={ item => } + items={ badgeCodes.filter(code => !isWearingBadge(code)) } /> +
+
+
+ { LocalizeText('inventory.badges.activebadges') } + + columnCount={ 3 } + estimateSize={ 50 } + itemRender={ item => } + items={ activeBadgeCodes } /> +
{ !!selectedBadgeCode && - +
- { LocalizeBadgeName(selectedBadgeCode) } + { LocalizeBadgeName(selectedBadgeCode) }
- - } - - + toggleBadge(selectedBadgeCode) }> + { LocalizeText(isWearingBadge(selectedBadgeCode) ? 'inventory.badges.clearbadge' : 'inventory.badges.wearbadge') } + +
} +
+
); } diff --git a/src/components/inventory/views/bot/InventoryBotItemView.tsx b/src/components/inventory/views/bot/InventoryBotItemView.tsx index 79775fe4..03a085eb 100644 --- a/src/components/inventory/views/bot/InventoryBotItemView.tsx +++ b/src/components/inventory/views/bot/InventoryBotItemView.tsx @@ -1,10 +1,13 @@ import { MouseEventType } from '@nitrots/nitro-renderer'; import { FC, MouseEvent, PropsWithChildren, useState } from 'react'; -import { attemptBotPlacement, IBotItem, UnseenItemCategory } from '../../../../api'; -import { LayoutAvatarImageView, LayoutGridItem } from '../../../../common'; +import { IBotItem, UnseenItemCategory, attemptBotPlacement } from '../../../../api'; +import { LayoutAvatarImageView } from '../../../../common'; import { useInventoryBots, useInventoryUnseenTracker } from '../../../../hooks'; +import { InfiniteGrid } from '../../../../layout'; -export const InventoryBotItemView: FC> = props => +export const InventoryBotItemView: FC> = props => { const { botItem = null, children = null, ...rest } = props; const [ isMouseDown, setMouseDown ] = useState(false); @@ -35,9 +38,9 @@ export const InventoryBotItemView: FC> } return ( - + { children } - + ); } diff --git a/src/components/inventory/views/bot/InventoryBotView.tsx b/src/components/inventory/views/bot/InventoryBotView.tsx index f4bfe62e..3cf55734 100644 --- a/src/components/inventory/views/bot/InventoryBotView.tsx +++ b/src/components/inventory/views/bot/InventoryBotView.tsx @@ -1,18 +1,16 @@ import { GetRoomEngine, IRoomSession, RoomObjectVariable, RoomPreviewer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; -import { LocalizeText, UnseenItemCategory, attemptBotPlacement } from '../../../../api'; -import { AutoGrid, Button, Column, Grid, LayoutRoomPreviewerView, Text } from '../../../../common'; +import { IBotItem, LocalizeText, UnseenItemCategory, attemptBotPlacement } from '../../../../api'; +import { LayoutRoomPreviewerView } from '../../../../common'; import { useInventoryBots, useInventoryUnseenTracker } from '../../../../hooks'; +import { InfiniteGrid, NitroButton } from '../../../../layout'; import { InventoryCategoryEmptyView } from '../InventoryCategoryEmptyView'; import { InventoryBotItemView } from './InventoryBotItemView'; -interface InventoryBotViewProps -{ +export const InventoryBotView: FC<{ roomSession: IRoomSession; roomPreviewer: RoomPreviewer; -} - -export const InventoryBotView: FC = props => +}> = props => { const { roomSession = null, roomPreviewer = null } = props; const [ isVisible, setIsVisible ] = useState(false); @@ -67,25 +65,26 @@ export const InventoryBotView: FC = props => if(!botItems || !botItems.length) return ; return ( - - - - { botItems && (botItems.length > 0) && botItems.map(item => ) } - - - - +
+
+ + columnCount={ 6 } + itemRender={ item => } + items={ botItems } /> +
+
+
- +
{ selectedBot && - - { selectedBot.botData.name } +
+ { selectedBot.botData.name } { !!roomSession && - } - } - - + } +
} +
+
); } diff --git a/src/components/inventory/views/furniture/InventoryFurnitureItemView.tsx b/src/components/inventory/views/furniture/InventoryFurnitureItemView.tsx index 7bab7b67..2b9f3dd6 100644 --- a/src/components/inventory/views/furniture/InventoryFurnitureItemView.tsx +++ b/src/components/inventory/views/furniture/InventoryFurnitureItemView.tsx @@ -4,7 +4,9 @@ import { GroupItem, attemptItemPlacement } from '../../../../api'; import { useInventoryFurni } from '../../../../hooks'; import { InfiniteGrid, classNames } from '../../../../layout'; -export const InventoryFurnitureItemView: FC<{ groupItem: GroupItem }> = props => +export const InventoryFurnitureItemView: FC<{ + groupItem: GroupItem +}> = props => { const { groupItem = null, ...rest } = props; const [ isMouseDown, setMouseDown ] = useState(false); diff --git a/src/components/inventory/views/furniture/InventoryFurnitureSearchView.tsx b/src/components/inventory/views/furniture/InventoryFurnitureSearchView.tsx index 27b29015..5584220c 100644 --- a/src/components/inventory/views/furniture/InventoryFurnitureSearchView.tsx +++ b/src/components/inventory/views/furniture/InventoryFurnitureSearchView.tsx @@ -1,15 +1,12 @@ import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'; import { FaSearch } from 'react-icons/fa'; import { GroupItem, LocalizeText } from '../../../../api'; -import { Button } from '../../../../common'; +import { NitroButton, NitroInput } from '../../../../layout'; -export interface InventoryFurnitureSearchViewProps -{ +export const InventoryFurnitureSearchView: FC<{ groupItems: GroupItem[]; setGroupItems: Dispatch>; -} - -export const InventoryFurnitureSearchView: FC = props => +}> = props => { const { groupItems = [], setGroupItems = null } = props; const [ searchValue, setSearchValue ] = useState(''); @@ -38,10 +35,13 @@ export const InventoryFurnitureSearchView: FC return (
- setSearchValue(event.target.value) } /> - +
); } diff --git a/src/components/inventory/views/furniture/InventoryFurnitureView.tsx b/src/components/inventory/views/furniture/InventoryFurnitureView.tsx index d1bc3836..54fd7e61 100644 --- a/src/components/inventory/views/furniture/InventoryFurnitureView.tsx +++ b/src/components/inventory/views/furniture/InventoryFurnitureView.tsx @@ -2,19 +2,14 @@ import { InfiniteGrid } from '@layout/InfiniteGrid'; import { GetRoomEngine, GetSessionDataManager, IRoomSession, RoomObjectVariable, RoomPreviewer, Vector3d } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; import { DispatchUiEvent, FurniCategory, GroupItem, LocalizeText, UnseenItemCategory, attemptItemPlacement } from '../../../../api'; -import { Button, LayoutLimitedEditionCompactPlateView, LayoutRarityLevelView, LayoutRoomPreviewerView } from '../../../../common'; +import { LayoutLimitedEditionCompactPlateView, LayoutRarityLevelView, LayoutRoomPreviewerView } from '../../../../common'; import { CatalogPostMarketplaceOfferEvent } from '../../../../events'; import { useInventoryFurni, useInventoryUnseenTracker } from '../../../../hooks'; +import { NitroButton } from '../../../../layout'; import { InventoryCategoryEmptyView } from '../InventoryCategoryEmptyView'; import { InventoryFurnitureItemView } from './InventoryFurnitureItemView'; import { InventoryFurnitureSearchView } from './InventoryFurnitureSearchView'; -interface InventoryFurnitureViewProps -{ - roomSession: IRoomSession; - roomPreviewer: RoomPreviewer; -} - const attemptPlaceMarketplaceOffer = (groupItem: GroupItem) => { const item = groupItem.getLastItem(); @@ -26,7 +21,10 @@ const attemptPlaceMarketplaceOffer = (groupItem: GroupItem) => DispatchUiEvent(new CatalogPostMarketplaceOfferEvent(item)); } -export const InventoryFurnitureView: FC = props => +export const InventoryFurnitureView: FC<{ + roomSession: IRoomSession; + roomPreviewer: RoomPreviewer; +}> = props => { const { roomSession = null, roomPreviewer = null } = props; const [ isVisible, setIsVisible ] = useState(false); @@ -112,7 +110,7 @@ export const InventoryFurnitureView: FC = props => if(!groupItems || !groupItems.length) return ; return ( -
+
@@ -120,8 +118,8 @@ export const InventoryFurnitureView: FC = props => itemRender={ item => } items={ filteredGroupItems } />
-
-
+
+
{ selectedItem && selectedItem.stuffData.isUnique && } @@ -130,16 +128,16 @@ export const InventoryFurnitureView: FC = props =>
{ selectedItem &&
- { selectedItem.name } + { selectedItem.name }
{ !!roomSession && - } + } { (selectedItem && selectedItem.isSellable) && - } + }
}
diff --git a/src/components/inventory/views/pet/InventoryPetItemView.tsx b/src/components/inventory/views/pet/InventoryPetItemView.tsx index 0859fe46..18e89e28 100644 --- a/src/components/inventory/views/pet/InventoryPetItemView.tsx +++ b/src/components/inventory/views/pet/InventoryPetItemView.tsx @@ -1,8 +1,9 @@ import { MouseEventType } from '@nitrots/nitro-renderer'; import { FC, MouseEvent, PropsWithChildren, useState } from 'react'; -import { attemptPetPlacement, IPetItem, UnseenItemCategory } from '../../../../api'; -import { LayoutGridItem, LayoutPetImageView } from '../../../../common'; +import { IPetItem, UnseenItemCategory, attemptPetPlacement } from '../../../../api'; +import { LayoutPetImageView } from '../../../../common'; import { useInventoryPets, useInventoryUnseenTracker } from '../../../../hooks'; +import { InfiniteGrid } from '../../../../layout'; export const InventoryPetItemView: FC> = props => { @@ -35,9 +36,9 @@ export const InventoryPetItemView: FC> } return ( - + { children } - + ); } diff --git a/src/components/inventory/views/pet/InventoryPetView.tsx b/src/components/inventory/views/pet/InventoryPetView.tsx index 8c40e040..3181c38d 100644 --- a/src/components/inventory/views/pet/InventoryPetView.tsx +++ b/src/components/inventory/views/pet/InventoryPetView.tsx @@ -1,18 +1,16 @@ import { GetRoomEngine, IRoomSession, RoomObjectVariable, RoomPreviewer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; -import { LocalizeText, UnseenItemCategory, attemptPetPlacement } from '../../../../api'; -import { AutoGrid, Button, Column, Grid, LayoutRoomPreviewerView, Text } from '../../../../common'; +import { IPetItem, LocalizeText, UnseenItemCategory, attemptPetPlacement } from '../../../../api'; +import { LayoutRoomPreviewerView } from '../../../../common'; import { useInventoryPets, useInventoryUnseenTracker } from '../../../../hooks'; +import { InfiniteGrid, NitroButton } from '../../../../layout'; import { InventoryCategoryEmptyView } from '../InventoryCategoryEmptyView'; import { InventoryPetItemView } from './InventoryPetItemView'; -interface InventoryPetViewProps -{ +export const InventoryPetView: FC<{ roomSession: IRoomSession; roomPreviewer: RoomPreviewer; -} - -export const InventoryPetView: FC = props => +}> = props => { const { roomSession = null, roomPreviewer = null } = props; const [ isVisible, setIsVisible ] = useState(false); @@ -66,25 +64,26 @@ export const InventoryPetView: FC = props => if(!petItems || !petItems.length) return ; return ( - - - - { petItems && (petItems.length > 0) && petItems.map(item => ) } - - - - +
+
+ + columnCount={ 6 } + itemRender={ item => } + items={ petItems } /> +
+
+
- +
{ selectedPet && selectedPet.petData && - - { selectedPet.petData.name } +
+ { selectedPet.petData.name } { !!roomSession && - } - } - - + } +
} +
+
); } diff --git a/src/layout/InfiniteGrid.tsx b/src/layout/InfiniteGrid.tsx index 40ba1f90..19ec5880 100644 --- a/src/layout/InfiniteGrid.tsx +++ b/src/layout/InfiniteGrid.tsx @@ -69,9 +69,10 @@ const InfiniteGridRoot = (props: Props) =>
{ Array.from(Array(columnCount)).map((e,i) => @@ -142,7 +143,7 @@ const InfiniteGridItem = forwardRef 0)) && 'unique-item', itemUniqueSoldout && 'sold-out', diff --git a/src/layout/NitroButton.tsx b/src/layout/NitroButton.tsx new file mode 100644 index 00000000..2835ecc6 --- /dev/null +++ b/src/layout/NitroButton.tsx @@ -0,0 +1,44 @@ +import { ButtonHTMLAttributes, DetailedHTMLProps, forwardRef, PropsWithChildren } from 'react'; +import { classNames } from './classNames'; + +const classes = { + base: 'inline-flex justify-center items-center gap-2 transition-[background-color] duration-300 transform tracking-wide rounded-md', + disabled: '', + size: { + default: 'px-2 py-0.5 text-sm font-medium', + lg: 'px-5 py-3 text-base font-medium', + xl: 'px-6 py-3.5 text-base font-medium', + }, + outline: { + default: 'text-blue-700 hover:text-white border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:border-blue-500 dark:text-blue-500 dark:hover:text-white dark:hover:bg-blue-600 dark:focus:ring-blue-800' + }, + color: { + default: 'bg-button-gradient-gray border border-gray-500', + } +} + +export const NitroButton = forwardRef & DetailedHTMLProps, HTMLButtonElement>>((props, ref) => +{ + const { color = 'default', size = 'default', outline = false, disabled = false, type = 'button', className = null, ...rest } = props; + + return ( +