diff --git a/src/components/friends/views/friends-bar/FriendsBarView.tsx b/src/components/friends/views/friends-bar/FriendsBarView.tsx index 52055d5..62c371e 100644 --- a/src/components/friends/views/friends-bar/FriendsBarView.tsx +++ b/src/components/friends/views/friends-bar/FriendsBarView.tsx @@ -38,7 +38,7 @@ export const FriendBarView: FC<{ onlineFriends: MessengerFriend[]; requestsCount { (requestsCount > 0) && - { requestsCount } richieste + { requestsCount } { LocalizeText('friendbar.requests.title') } } diff --git a/src/components/toolbar/ToolbarView.tsx b/src/components/toolbar/ToolbarView.tsx index 3e7b98d..38758cd 100644 --- a/src/components/toolbar/ToolbarView.tsx +++ b/src/components/toolbar/ToolbarView.tsx @@ -3,15 +3,28 @@ import { AnimatePresence, motion } from 'framer-motion'; import { FC, useEffect, useState } from 'react'; import { GetConfigurationValue, MessengerIconState, OpenMessengerChat, setYoutubeRoomEnabled, VisitDesktop } from '../../api'; import { Flex, LayoutAvatarImageView, LayoutItemCountView } from '../../common'; -import { useAchievements, useFriends, useInventoryUnseenTracker, useMessageEvent, useMessenger, useNitroEvent, useSessionInfo } from '../../hooks'; +import { useAchievements, useFriends, useInventoryUnseenTracker, useMessageEvent, useMessenger, useNitroEvent, useSessionInfo, useWiredTools } from '../../hooks'; import { ToolbarItemView } from './ToolbarItemView'; import { ToolbarMeView } from './ToolbarMeView'; import { YouTubePlayerView } from './YouTubePlayerView'; +const containerVariants = { + hidden: {}, + visible: { transition: { staggerChildren: 0.05 } }, + exit: { transition: { staggerChildren: 0.03, staggerDirection: -1 as const } } +}; + +const itemVariants = { + hidden: { opacity: 0, y: 10, scale: 0.8 }, + visible: { opacity: 1, y: 0, scale: 1, transition: { type: 'spring', stiffness: 400, damping: 22 } }, + exit: { opacity: 0, y: 6, scale: 0.85, transition: { duration: 0.1 } } +}; + export const ToolbarView: FC<{ isInRoom: boolean }> = props => { const { isInRoom } = props; const [ isMeExpanded, setMeExpanded ] = useState(false); + const [ isToolbarOpen, setIsToolbarOpen ] = useState(false); const [ useGuideTool, setUseGuideTool ] = useState(false); const [ youtubeEnabled, setYoutubeEnabled ] = useState(false); const { userFigure = null } = useSessionInfo(); @@ -19,7 +32,10 @@ export const ToolbarView: FC<{ isInRoom: boolean }> = props => const { getTotalUnseen = 0 } = useAchievements(); const { requests = [] } = useFriends(); const { iconState = MessengerIconState.HIDDEN } = useMessenger(); + const { openMonitor, showToolbarButton } = useWiredTools(); const isMod = GetSessionDataManager().isModerator; + const hasDesktopUnifiedShell = (isInRoom && isToolbarOpen); + const showDesktopShell = (isToolbarOpen || !isInRoom); useMessageEvent(YouTubeRoomSettingsEvent, event => { @@ -62,13 +78,11 @@ export const ToolbarView: FC<{ isInRoom: boolean }> = props => const targetBounds = target.getBoundingClientRect(); const imageBounds = image.getBoundingClientRect(); - const left = (imageBounds.x - targetBounds.x); const top = (imageBounds.y - targetBounds.y); const squared = Math.sqrt(((left * left) + (top * top))); const wait = (500 - Math.abs(((((1 / squared) * 100) * 500) * 0.5))); const height = 20; - const motionName = (`ToolbarBouncing[${ iconName }]`); if(!Motions.getMotionByTag(motionName)) @@ -87,55 +101,220 @@ export const ToolbarView: FC<{ isInRoom: boolean }> = props => return ( <> { youtubeEnabled && } - { isMeExpanded && ( - - )} - - - - - { - setMeExpanded(!isMeExpanded); - event.stopPropagation(); - } }> - - { (getTotalUnseen > 0) && - } - - { isInRoom && - VisitDesktop() } /> } - { !isInRoom && - CreateLinkEvent('navigator/goto/home') } /> } - CreateLinkEvent('navigator/toggle') } /> - { GetConfigurationValue('game.center.enabled') && - CreateLinkEvent('games/toggle') } /> } - CreateLinkEvent('catalog/toggle') } /> - CreateLinkEvent('inventory/toggle') }> - { (getFullCount > 0) && - } - - { isInRoom && - CreateLinkEvent('camera/toggle') } /> } - { youtubeEnabled && - } - { isMod && - CreateLinkEvent('mod-tools/toggle') } /> } - { isMod && - CreateLinkEvent('furni-editor/toggle') } /> } - - - - - CreateLinkEvent('friends/toggle') }> - { (requests.length > 0) && - } - - { ((iconState === MessengerIconState.SHOW) || (iconState === MessengerIconState.UNREAD)) && - OpenMessengerChat() } /> } - - - - + + { isInRoom && + + setIsToolbarOpen(value => !value) } + whileTap={ { scale: 0.9 } }> + + + + + + + CreateLinkEvent('friends/toggle') } className="tb-icon" /> + { (requests.length > 0) && + } + + } + + + { (isToolbarOpen || !isInRoom) && + <> + { showDesktopShell && + } + + + + + { isInRoom + ? VisitDesktop() } className="tb-icon" /> + : CreateLinkEvent('navigator/goto/home') } className="tb-icon" /> } + + + CreateLinkEvent('navigator/toggle') } className="tb-icon" /> + + { GetConfigurationValue('game.center.enabled') && + + CreateLinkEvent('games/toggle') } className="tb-icon" /> + } + + CreateLinkEvent('catalog/toggle/normal') } className="tb-icon" /> + + + CreateLinkEvent('catalog/toggle/builder') } className="tb-icon" /> + + + CreateLinkEvent('inventory/toggle') } className="tb-icon" /> + { (getFullCount > 0) && + } + + + + { isMeExpanded && + + + } + + { setMeExpanded(value => !value); event.stopPropagation(); } }> + + + { (getTotalUnseen > 0) && + } + + { (isInRoom && showToolbarButton) && + + + } + { isInRoom && + + CreateLinkEvent('camera/toggle') } className="tb-icon" /> + } + { youtubeEnabled && + + + } + { isMod && + + CreateLinkEvent('mod-tools/toggle') } className="tb-icon" /> + } + { isMod && + + CreateLinkEvent('furni-editor/toggle') } className="tb-icon" /> + } + + + + + + + CreateLinkEvent('friends/toggle') } className="tb-icon" /> + { (requests.length > 0) && + } + + { ((iconState === MessengerIconState.SHOW) || (iconState === MessengerIconState.UNREAD)) && + + OpenMessengerChat() } /> + } + + + + + + + + + { isInRoom + ? VisitDesktop() } className="tb-icon" /> + : CreateLinkEvent('navigator/goto/home') } className="tb-icon" /> } + + + CreateLinkEvent('navigator/toggle') } className="tb-icon" /> + + { GetConfigurationValue('game.center.enabled') && + + CreateLinkEvent('games/toggle') } className="tb-icon" /> + } + + CreateLinkEvent('catalog/toggle/normal') } className="tb-icon" /> + + + CreateLinkEvent('catalog/toggle/builder') } className="tb-icon" /> + + + CreateLinkEvent('inventory/toggle') } className="tb-icon" /> + { (getFullCount > 0) && + } + + + + + { isMeExpanded && + + + } + + { setMeExpanded(value => !value); event.stopPropagation(); } }> + + + { (getTotalUnseen > 0) && + } + + + { (isInRoom && showToolbarButton) && + + + } + { isInRoom && + + CreateLinkEvent('camera/toggle') } className="tb-icon" /> + } + { youtubeEnabled && + + + } + { isMod && + + CreateLinkEvent('mod-tools/toggle') } className="tb-icon" /> + } + { isMod && + + CreateLinkEvent('furni-editor/toggle') } className="tb-icon" /> + } + { !isInRoom && + + CreateLinkEvent('friends/toggle') } className="tb-icon" /> + { (requests.length > 0) && + } + } + + + > } + > ); }; diff --git a/src/css/toolbar/ToolBar.css b/src/css/toolbar/ToolBar.css new file mode 100644 index 0000000..0e9f766 --- /dev/null +++ b/src/css/toolbar/ToolBar.css @@ -0,0 +1,56 @@ +.tb-icon { + opacity: 1; + cursor: pointer; + transition: transform 0.15s ease; + + &:hover { + transform: translateY(-2px); + } + + &:active { + transform: translateY(0); + } +} + +.tb-toggle { + display: flex; + width: 32px; + height: 32px; + flex-shrink: 0; + align-items: center; + justify-content: center; + cursor: pointer; + border-radius: 9px; + background: rgba(18, 16, 14, 0.80); + backdrop-filter: blur(16px); + -webkit-backdrop-filter: blur(16px); + border: 1px solid rgba(255, 255, 255, 0.08); + box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5); + transition: background 0.15s, border-color 0.15s; + + &:hover { + background: rgba(30, 26, 20, 0.88); + border-color: rgba(255, 255, 255, 0.13); + } +} + +.tb-bar-scroll { + overflow-x: auto; + overflow-y: visible; + flex-wrap: nowrap; + scrollbar-width: none; + -ms-overflow-style: none; + + &::-webkit-scrollbar { + display: none; + } +} + +.tb-open-shell { + scrollbar-width: none; + -ms-overflow-style: none; + + &::-webkit-scrollbar { + display: none; + } +} diff --git a/src/index.tsx b/src/index.tsx index 5ce3538..066ba96 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -32,6 +32,8 @@ import './css/room/RoomWidgets.css'; import './css/slider.css'; +import './css/toolbar/ToolBar.css'; + import './css/widgets/FurnitureWidgets.css'; createRoot(document.getElementById('root')).render();