Update toolbar

This commit is contained in:
Bill 2022-02-22 01:40:22 -05:00
parent 3cf0fed1ef
commit 13da75c105
5 changed files with 90 additions and 216 deletions

View File

@ -54,7 +54,7 @@ export const Base: FC<BaseProps<HTMLDivElement>> = props =>
if(className.length) newClassName += (' ' + className); if(className.length) newClassName += (' ' + className);
return newClassName; return newClassName.trim();
}, [ getClassNames, className ]); }, [ getClassNames, className ]);
const getStyle = useMemo(() => const getStyle = useMemo(() =>

View File

@ -1,6 +1,7 @@
import { RoomObjectCategory } from '@nitrots/nitro-renderer'; import { RoomObjectCategory } from '@nitrots/nitro-renderer';
import { FC, useEffect } from 'react'; import { FC, useEffect } from 'react';
import { GetRoomEngine, GetRoomSession } from '../../api'; import { GetRoomEngine, GetRoomSession } from '../../api';
import { Base, Flex } from '../../common';
import { ItemCountView } from '../../views/shared/item-count/ItemCountView'; import { ItemCountView } from '../../views/shared/item-count/ItemCountView';
import { ToolbarViewItems } from './common/ToolbarViewItems'; import { ToolbarViewItems } from './common/ToolbarViewItems';
@ -24,35 +25,15 @@ export const ToolbarMeView: FC<ToolbarMeViewProps> = props =>
}, []); }, []);
return ( return (
<div className="d-flex nitro-toolbar-me px-1 py-2"> <Flex alignItems="center" className="nitro-toolbar-me p-2" gap={ 2 }>
<div className="navigation-items"> <Base pointer className="navigation-item icon icon-me-achievements" onClick={ () => handleToolbarItemClick(ToolbarViewItems.ACHIEVEMENTS_ITEM) }>
<div className="navigation-item"> { (unseenAchievementCount > 0) &&
<i className="icon icon-me-talents"></i> <ItemCountView count={ unseenAchievementCount } /> }
</div> </Base>
<div className="navigation-item"> <Base pointer className="navigation-item icon icon-me-profile" onClick={ () => handleToolbarItemClick(ToolbarViewItems.PROFILE_ITEM) } />
<i className="icon icon-me-helper-tool"></i> <Base pointer className="navigation-item icon icon-me-rooms" />
</div> <Base pointer className="navigation-item icon icon-me-clothing" onClick={ () => handleToolbarItemClick(ToolbarViewItems.CLOTHING_ITEM) } />
<div className="navigation-item" onClick={ () => handleToolbarItemClick(ToolbarViewItems.ACHIEVEMENTS_ITEM) }> <Base pointer className="navigation-item icon icon-me-settings" onClick={ () => handleToolbarItemClick(ToolbarViewItems.SETTINGS_ITEM) } />
<i className="icon icon-me-achievements"></i> </Flex>
{ (unseenAchievementCount > 0) &&
<ItemCountView count={ unseenAchievementCount } /> }
</div>
<div className="navigation-item" onClick={ () => handleToolbarItemClick(ToolbarViewItems.PROFILE_ITEM) }>
<i className="icon icon-me-profile"></i>
</div>
<div className="navigation-item">
<i className="icon icon-me-rooms"></i>
</div>
<div className="navigation-item" onClick={ () => handleToolbarItemClick(ToolbarViewItems.CLOTHING_ITEM) }>
<i className="icon icon-me-clothing"></i>
</div>
<div className="navigation-item">
<i className="icon icon-me-forums"></i>
</div>
<div className="navigation-item" onClick={ () => handleToolbarItemClick(ToolbarViewItems.SETTINGS_ITEM) }>
<i className="icon icon-me-settings"></i>
</div>
</div>
</div>
); );
} }

View File

@ -1,111 +1,67 @@
.nitro-toolbar-container { .nitro-toolbar {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: $toolbar-height; height: $toolbar-height;
z-index: $toolbar-zindex; z-index: $toolbar-zindex;
pointer-events: all;
background: rgba($dark, 0.95);
box-shadow: inset 0px 5px lighten(rgba($dark, 0.6), 2.5),
inset 0 -4px darken(rgba($dark, 0.6), 4);
.nitro-toolbar { .navigation-item {
height: 100%;
pointer-events: all;
background: rgba($dark, 0.95);
box-shadow: inset 0px 5px lighten(rgba($dark, 0.6), 2.5),
inset 0 -4px darken(rgba($dark, 0.6), 4);
#toolbar-chat-input-container { &.item-avatar {
margin: 0 10px; width: 50px;
height: 45px;
@include media-breakpoint-down(sm) { overflow: hidden;
width: 0px;
height: 0px; .avatar-image {
margin-left: -5px;
margin-top: 25px;
} }
} }
.navigation-items { &:hover {
display: flex; -webkit-transform: translate(-1px, -1px);
align-items: center; transform: translate(-1px, -1px);
filter: drop-shadow(2px 2px 0 rgba($black, 0.8));
&.navigation-avatar {
border-right: 1px solid rgba(0, 0, 0, 0.3);
}
.navigation-item {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
//margin: 0 1px;
position: relative;
&.item-avatar {
width: 50px;
height: 45px;
overflow: hidden;
.avatar-image {
margin-left: -5px;
margin-top: 25px;
}
}
.icon,
&.item-avatar {
position: relative;
//transition: transform .2s ease-out;
&:hover,
&.active {
-webkit-transform: translate(-1px, -1px);
transform: translate(-1px, -1px);
filter: drop-shadow(2px 2px 0 rgba($black, 0.8));
}
}
.avatar-image {
pointer-events: none;
}
.chat-input-container {
left: 60px;
}
}
} }
.nitro-toolbar-me-menu { &.active,
bottom: 77px; &:active {
left: 200px; -webkit-transform: translate(0px, 0px);
position: absolute; transform: translate(0px, 0px);
font-size: 12px; filter: drop-shadow(2px 2px 0 rgba($black, 0.8));
z-index: $toolbar-memenu-zindex; }
}
.list-group { #toolbar-chat-input-container {
.list-group-item {
min-width: 70px;
transition: all 0.3s;
font-size: 10px;
text-align: center;
i { @include media-breakpoint-down(sm) {
filter: grayscale(1); width: 0px;
} height: 0px;
}
}
}
&:hover { .nitro-toolbar-me {
color: $cyan; position: absolute;
text-decoration: underline; bottom: 60px;
left: 15px;
z-index: $toolbar-memenu-zindex;
background: rgba(20, 20, 20, .95);
border: 1px solid #101010;
box-shadow: inset 2px 2px rgba(255, 255, 255, .1), inset -2px -2px rgba(255, 255, 255, .1);
border-radius: $border-radius;
i { .navigation-item {
filter: grayscale(0); transition: filter .2s ease-out;
} filter: grayscale(1);
}
.count { &:hover {
top: 0px; filter: grayscale(0) drop-shadow(2px 2px 0 rgba($black, 0.8));
right: 5px;
font-size: 10px;
}
}
}
} }
} }
} }
@ -122,45 +78,3 @@
drop-shadow(-2px 1px 0 rgba($white, 1)) drop-shadow(-2px 1px 0 rgba($white, 1))
drop-shadow(0 -2px 0 rgba($white, 1)); drop-shadow(0 -2px 0 rgba($white, 1));
} }
.nitro-toolbar-me {
position: absolute;
bottom: 65px;
left: 15px;
z-index: $toolbar-me-zindex;
background: rgba(20, 20, 20, .95);
border: 1px solid #101010;
box-shadow: inset 2px 2px rgba(255, 255, 255, .1), inset -2px -2px rgba(255, 255, 255, .1);
border-radius: $border-radius;
.navigation-items {
display: flex;
align-items: center;
&.navigation-avatar {
border-right: 1px solid rgba(0, 0, 0, .3);
}
.navigation-item {
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
cursor: pointer;
width: 50px;
font-size: 11px;
.icon {
transition: filter .2s ease-out;
filter: grayscale(1);
}
&:hover {
.icon {
filter: grayscale(0) drop-shadow(2px 2px 0 rgba($black, 0.8));
}
}
}
}
}

View File

@ -1,6 +1,7 @@
import { Dispose, DropBounce, EaseOut, FigureUpdateEvent, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserInfoDataParser, UserInfoEvent, Wait } from '@nitrots/nitro-renderer'; import { Dispose, DropBounce, EaseOut, FigureUpdateEvent, JumpBy, Motions, NitroToolbarAnimateIconEvent, Queue, UserInfoDataParser, UserInfoEvent, Wait } from '@nitrots/nitro-renderer';
import { FC, useCallback, useState } from 'react'; import { FC, useCallback, useState } from 'react';
import { CreateLinkEvent, GetRoomSession, GetRoomSessionManager, GetSessionDataManager, GetUserProfile, GoToDesktop, OpenMessengerChat } from '../../api'; import { CreateLinkEvent, GetRoomSession, GetRoomSessionManager, GetSessionDataManager, GetUserProfile, GoToDesktop, OpenMessengerChat } from '../../api';
import { Base, Flex } from '../../common';
import { AvatarEditorEvent, FriendsEvent, FriendsMessengerIconEvent, FriendsRequestCountEvent, InventoryEvent, NavigatorEvent, RoomWidgetCameraEvent } from '../../events'; import { AvatarEditorEvent, FriendsEvent, FriendsMessengerIconEvent, FriendsRequestCountEvent, InventoryEvent, NavigatorEvent, RoomWidgetCameraEvent } from '../../events';
import { AchievementsUIEvent, AchievementsUIUnseenCountEvent } from '../../events/achievements'; import { AchievementsUIEvent, AchievementsUIUnseenCountEvent } from '../../events/achievements';
import { UnseenItemTrackerUpdateEvent } from '../../events/inventory/UnseenItemTrackerUpdateEvent'; import { UnseenItemTrackerUpdateEvent } from '../../events/inventory/UnseenItemTrackerUpdateEvent';
@ -181,64 +182,47 @@ export const ToolbarView: FC<ToolbarViewProps> = props =>
}, []); }, []);
return ( return (
<div className="nitro-toolbar-container"> <>
<TransitionAnimation type={ TransitionAnimationTypes.FADE_IN } inProp={ isMeExpanded } timeout={ 300 }> <TransitionAnimation type={ TransitionAnimationTypes.FADE_IN } inProp={ isMeExpanded } timeout={ 300 }>
<ToolbarMeView unseenAchievementCount={ unseenAchievementCount } handleToolbarItemClick={ handleToolbarItemClick } /> <ToolbarMeView unseenAchievementCount={ unseenAchievementCount } handleToolbarItemClick={ handleToolbarItemClick } />
</TransitionAnimation> </TransitionAnimation>
<div className="d-flex justify-content-between align-items-center nitro-toolbar py-1 px-3"> <Flex alignItems="center" justifyContent="between" gap={ 2 } className="nitro-toolbar py-1 px-3">
<div className="d-flex align-items-center"> <Flex gap={ 2 } alignItems="center">
<div className="navigation-items gap-2"> <Flex alignItems="center" gap={ 2 }>
<div className={ 'navigation-item item-avatar ' + (isMeExpanded ? 'active ' : '') } onClick={ event => setMeExpanded(!isMeExpanded) }> <Flex center pointer className={ 'navigation-item item-avatar ' + (isMeExpanded ? 'active ' : '') } onClick={ event => setMeExpanded(!isMeExpanded) }>
<AvatarImageView figure={ userFigure } direction={ 2 } /> <AvatarImageView figure={ userFigure } direction={ 2 } />
{ (unseenAchievementCount > 0) && { (unseenAchievementCount > 0) &&
<ItemCountView count={ unseenAchievementCount } /> } <ItemCountView count={ unseenAchievementCount } /> }
</div> </Flex>
{ isInRoom && ( { isInRoom &&
<div className="navigation-item" onClick={ visitDesktop }> <Base pointer className="navigation-item icon icon-habbo" onClick={ visitDesktop } /> }
<i className="icon icon-habbo"></i> { !isInRoom &&
</div>) } <Base pointer className="navigation-item icon icon-house" onClick={ event => CreateLinkEvent('navigator/goto/home') } /> }
{ !isInRoom && ( <Base pointer className="navigation-item icon icon-rooms" onClick={ event => handleToolbarItemClick(ToolbarViewItems.NAVIGATOR_ITEM) } />
<div className="navigation-item" onClick={ event => CreateLinkEvent('navigator/goto/home') }> <Base pointer className="navigation-item icon icon-catalog" onClick={ event => handleToolbarItemClick(ToolbarViewItems.CATALOG_ITEM) } />
<i className="icon icon-house"></i> <Base pointer className="navigation-item icon icon-inventory" onClick={ event => handleToolbarItemClick(ToolbarViewItems.INVENTORY_ITEM) }>
</div>) }
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.NAVIGATOR_ITEM) }>
<i className="icon icon-rooms"></i>
</div>
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.CATALOG_ITEM) }>
<i className="icon icon-catalog"></i>
</div>
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.INVENTORY_ITEM) }>
<i className="icon icon-inventory"></i>
{ (unseenInventoryCount > 0) && { (unseenInventoryCount > 0) &&
<ItemCountView count={ unseenInventoryCount } /> } <ItemCountView count={ unseenInventoryCount } /> }
</div> </Base>
{ isInRoom && ( { isInRoom &&
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.CAMERA_ITEM) }> <Base pointer className="navigation-item icon icon-camera" onClick={ event => handleToolbarItemClick(ToolbarViewItems.CAMERA_ITEM) } /> }
<i className="icon icon-camera"></i> { isMod &&
</div>) } <Base pointer className="navigation-item icon icon-modtools" onClick={ event => handleToolbarItemClick(ToolbarViewItems.MOD_TOOLS_ITEM) } /> }
{ isMod && ( </Flex>
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.MOD_TOOLS_ITEM) }> <Flex alignItems="center" id="toolbar-chat-input-container" />
<i className="icon icon-modtools"></i> </Flex>
</div>) } <Flex alignItems="center" gap={ 2 }>
</div> <Flex gap={ 2 }>
<div id="toolbar-chat-input-container" className="d-flex align-items-center" /> <Base pointer className="navigation-item icon icon-friendall" onClick={ event => handleToolbarItemClick(ToolbarViewItems.FRIEND_LIST_ITEM) }>
</div>
<div className="d-flex align-items-center gap-2">
<div className="navigation-items gap-2">
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.FRIEND_LIST_ITEM) }>
<i className="icon icon-friendall"></i>
{ (unseenFriendRequestCount > 0) && { (unseenFriendRequestCount > 0) &&
<ItemCountView count={ unseenFriendRequestCount } /> } <ItemCountView count={ unseenFriendRequestCount } /> }
</div> </Base>
{ ((chatIconType === CHAT_ICON_SHOWING) || (chatIconType === CHAT_ICON_UNREAD)) && { ((chatIconType === CHAT_ICON_SHOWING) || (chatIconType === CHAT_ICON_UNREAD)) &&
<div className="navigation-item" onClick={ event => handleToolbarItemClick(ToolbarViewItems.FRIEND_CHAT_ITEM) }> <Base pointer className={ `navigation-item icon icon-message ${ (chatIconType === CHAT_ICON_UNREAD) && 'is-unread' }` } onClick={ event => handleToolbarItemClick(ToolbarViewItems.FRIEND_CHAT_ITEM) } /> }
{ (chatIconType === CHAT_ICON_SHOWING) && <i className="icon icon-message" /> } </Flex>
{ (chatIconType === CHAT_ICON_UNREAD) && <i className="icon icon-message is-unseen" /> } <Base id="toolbar-friend-bar-container" className="d-none d-lg-block" />
</div> } </Flex>
</div> </Flex>
<div id="toolbar-friend-bar-container" className="d-none d-lg-block" /> </>
</div>
</div>
</div>
); );
} }

View File

@ -1,8 +1,3 @@
export interface ToolbarViewProps
{
isInRoom: boolean;
}
export class ToolbarViewItems export class ToolbarViewItems
{ {
public static NAVIGATOR_ITEM: string = 'TVI_NAVIGATOR_ITEM'; public static NAVIGATOR_ITEM: string = 'TVI_NAVIGATOR_ITEM';