mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 13:26:27 +01:00
Fix toolbar my rooms, profile user rooms
This commit is contained in:
parent
546696b204
commit
c02f088045
@ -4,7 +4,7 @@ import { FC, useCallback, useEffect, useMemo, useReducer, useState } from 'react
|
||||
import { AddEventLinkTracker, GoToDesktop, LocalizeText, RemoveLinkEventTracker, SendMessageComposer, TryVisitRoom } from '../../api';
|
||||
import { Column, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
||||
import { NavigatorEvent, UpdateDoorStateEvent } from '../../events';
|
||||
import { UseMountEffect, UseRoomSessionManagerEvent, UseUiEvent } from '../../hooks';
|
||||
import { BatchUpdates, UseMountEffect, UseRoomSessionManagerEvent, UseUiEvent } from '../../hooks';
|
||||
import { NavigatorContextProvider } from './NavigatorContext';
|
||||
import { NavigatorMessageHandler } from './NavigatorMessageHandler';
|
||||
import { initialNavigator, NavigatorActions, NavigatorReducer } from './reducers/NavigatorReducer';
|
||||
@ -154,11 +154,29 @@ export const NavigatorView: FC<{}> = props =>
|
||||
}
|
||||
return;
|
||||
case 'create':
|
||||
setIsVisible(true);
|
||||
setCreatorOpen(true);
|
||||
BatchUpdates(() =>
|
||||
{
|
||||
setIsVisible(true);
|
||||
setCreatorOpen(true);
|
||||
});
|
||||
return;
|
||||
case 'search':
|
||||
if(parts.length > 2)
|
||||
{
|
||||
const topLevelContextCode = parts[2];
|
||||
|
||||
let searchValue = '';
|
||||
|
||||
if(parts.length > 3) searchValue = parts[3];
|
||||
|
||||
console.log(searchValue, topLevelContextCode)
|
||||
|
||||
setIsVisible(true);
|
||||
sendSearch(searchValue, topLevelContextCode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}, [ goToHomeRoom ]);
|
||||
}, [ goToHomeRoom, sendSearch ]);
|
||||
|
||||
const closePendingDoorState = useCallback((state: string) =>
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import React, { FC, KeyboardEvent, useCallback, useState } from 'react';
|
||||
import React, { FC, KeyboardEvent, useCallback, useEffect, useState } from 'react';
|
||||
import { LocalizeText } from '../../../../api';
|
||||
import { Button } from '../../../../common/Button';
|
||||
import { Flex } from '../../../../common/Flex';
|
||||
@ -18,7 +18,7 @@ export const NavigatorSearchView: FC<NavigatorSearchViewProps> = props =>
|
||||
const [ searchValue, setSearchValue ] = useState('');
|
||||
const [ lastSearchQuery, setLastSearchQuery ] = useState('');
|
||||
const { navigatorState = null } = useNavigatorContext();
|
||||
const { topLevelContext = null } = navigatorState;
|
||||
const { topLevelContext = null, searchResult = null } = navigatorState;
|
||||
|
||||
const processSearch = useCallback(() =>
|
||||
{
|
||||
@ -43,6 +43,19 @@ export const NavigatorSearchView: FC<NavigatorSearchViewProps> = props =>
|
||||
processSearch();
|
||||
};
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
const searchResultDataParts = searchResult.data.split(':');
|
||||
|
||||
if(searchResultDataParts.length === 2)
|
||||
{
|
||||
let searchFilterIndex = SearchFilterOptions.findIndex(option => (option.query === searchResultDataParts[0]));
|
||||
|
||||
if(searchFilterIndex > -1) setSearchFilterIndex(searchFilterIndex);
|
||||
setSearchValue(searchResultDataParts[1]);
|
||||
}
|
||||
}, [ searchResult ]);
|
||||
|
||||
return (
|
||||
<Flex fullWidth gap={ 1 }>
|
||||
<Flex shrink>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RoomObjectCategory } from '@nitrots/nitro-renderer';
|
||||
import { FC, useEffect } from 'react';
|
||||
import { GetRoomEngine, GetRoomSession } from '../../api';
|
||||
import { CreateLinkEvent, GetRoomEngine, GetRoomSession } from '../../api';
|
||||
import { Base, Flex, LayoutItemCountView } from '../../common';
|
||||
import { ToolbarViewItems } from './common/ToolbarViewItems';
|
||||
|
||||
@ -27,15 +27,15 @@ export const ToolbarMeView: FC<ToolbarMeViewProps> = props =>
|
||||
return (
|
||||
<Flex alignItems="center" className="nitro-toolbar-me p-2" gap={ 2 }>
|
||||
{ useGuideTool &&
|
||||
<Base pointer className="navigation-item icon icon-me-helper-tool" onClick={ () => handleToolbarItemClick(ToolbarViewItems.GUIDE_TOOL_ITEM) } /> }
|
||||
<Base pointer className="navigation-item icon icon-me-achievements" onClick={ () => handleToolbarItemClick(ToolbarViewItems.ACHIEVEMENTS_ITEM) }>
|
||||
<Base pointer className="navigation-item icon icon-me-helper-tool" onClick={ event => handleToolbarItemClick(ToolbarViewItems.GUIDE_TOOL_ITEM) } /> }
|
||||
<Base pointer className="navigation-item icon icon-me-achievements" onClick={ event => handleToolbarItemClick(ToolbarViewItems.ACHIEVEMENTS_ITEM) }>
|
||||
{ (unseenAchievementCount > 0) &&
|
||||
<LayoutItemCountView count={ unseenAchievementCount } /> }
|
||||
</Base>
|
||||
<Base pointer className="navigation-item icon icon-me-profile" onClick={ () => handleToolbarItemClick(ToolbarViewItems.PROFILE_ITEM) } />
|
||||
<Base pointer className="navigation-item icon icon-me-rooms" />
|
||||
<Base pointer className="navigation-item icon icon-me-clothing" onClick={ () => handleToolbarItemClick(ToolbarViewItems.CLOTHING_ITEM) } />
|
||||
<Base pointer className="navigation-item icon icon-me-settings" onClick={ () => handleToolbarItemClick(ToolbarViewItems.SETTINGS_ITEM) } />
|
||||
<Base pointer className="navigation-item icon icon-me-profile" onClick={ event => handleToolbarItemClick(ToolbarViewItems.PROFILE_ITEM) } />
|
||||
<Base pointer className="navigation-item icon icon-me-rooms" onClick={ event => CreateLinkEvent('navigator/search/myworld_view')} />
|
||||
<Base pointer className="navigation-item icon icon-me-clothing" onClick={ event => handleToolbarItemClick(ToolbarViewItems.CLOTHING_ITEM) } />
|
||||
<Base pointer className="navigation-item icon icon-me-settings" onClick={ event => handleToolbarItemClick(ToolbarViewItems.SETTINGS_ITEM) } />
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RelationshipStatusInfoEvent, RelationshipStatusInfoMessageParser, RoomEngineObjectEvent, RoomObjectCategory, RoomObjectType, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserProfileEvent, UserProfileParser, UserRelationshipsComposer } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useState } from 'react';
|
||||
import { GetRoomSession, GetSessionDataManager, GetUserProfile, LocalizeText, SendMessageComposer } from '../../api';
|
||||
import { CreateLinkEvent, GetRoomSession, GetSessionDataManager, GetUserProfile, LocalizeText, SendMessageComposer } from '../../api';
|
||||
import { Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common';
|
||||
import { BatchUpdates, UseMessageEventHook, UseRoomEngineEvent } from '../../hooks';
|
||||
import { BadgesContainerView } from './views/BadgesContainerView';
|
||||
@ -104,7 +104,7 @@ export const UserProfileView: FC<{}> = props =>
|
||||
</Column>
|
||||
</Grid>
|
||||
<Flex alignItems="center" className="rooms-button-container px-2 py-1">
|
||||
<Flex alignItems="center" gap={ 1 }>
|
||||
<Flex alignItems="center" gap={ 1 } onClick={ event => CreateLinkEvent(`navigator/search/hotel_view/owner:${ userProfile.username }`)}>
|
||||
<i className="icon icon-rooms" />
|
||||
<Text bold underline pointer>{ LocalizeText('extendedprofile.rooms') }</Text>
|
||||
</Flex>
|
||||
|
Loading…
Reference in New Issue
Block a user