mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +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 { AddEventLinkTracker, GoToDesktop, LocalizeText, RemoveLinkEventTracker, SendMessageComposer, TryVisitRoom } from '../../api';
|
||||||
import { Column, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
import { Column, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common';
|
||||||
import { NavigatorEvent, UpdateDoorStateEvent } from '../../events';
|
import { NavigatorEvent, UpdateDoorStateEvent } from '../../events';
|
||||||
import { UseMountEffect, UseRoomSessionManagerEvent, UseUiEvent } from '../../hooks';
|
import { BatchUpdates, UseMountEffect, UseRoomSessionManagerEvent, UseUiEvent } from '../../hooks';
|
||||||
import { NavigatorContextProvider } from './NavigatorContext';
|
import { NavigatorContextProvider } from './NavigatorContext';
|
||||||
import { NavigatorMessageHandler } from './NavigatorMessageHandler';
|
import { NavigatorMessageHandler } from './NavigatorMessageHandler';
|
||||||
import { initialNavigator, NavigatorActions, NavigatorReducer } from './reducers/NavigatorReducer';
|
import { initialNavigator, NavigatorActions, NavigatorReducer } from './reducers/NavigatorReducer';
|
||||||
@ -154,11 +154,29 @@ export const NavigatorView: FC<{}> = props =>
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 'create':
|
case 'create':
|
||||||
setIsVisible(true);
|
BatchUpdates(() =>
|
||||||
setCreatorOpen(true);
|
{
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}, [ goToHomeRoom ]);
|
}, [ goToHomeRoom, sendSearch ]);
|
||||||
|
|
||||||
const closePendingDoorState = useCallback((state: string) =>
|
const closePendingDoorState = useCallback((state: string) =>
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
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 { LocalizeText } from '../../../../api';
|
||||||
import { Button } from '../../../../common/Button';
|
import { Button } from '../../../../common/Button';
|
||||||
import { Flex } from '../../../../common/Flex';
|
import { Flex } from '../../../../common/Flex';
|
||||||
@ -18,7 +18,7 @@ export const NavigatorSearchView: FC<NavigatorSearchViewProps> = props =>
|
|||||||
const [ searchValue, setSearchValue ] = useState('');
|
const [ searchValue, setSearchValue ] = useState('');
|
||||||
const [ lastSearchQuery, setLastSearchQuery ] = useState('');
|
const [ lastSearchQuery, setLastSearchQuery ] = useState('');
|
||||||
const { navigatorState = null } = useNavigatorContext();
|
const { navigatorState = null } = useNavigatorContext();
|
||||||
const { topLevelContext = null } = navigatorState;
|
const { topLevelContext = null, searchResult = null } = navigatorState;
|
||||||
|
|
||||||
const processSearch = useCallback(() =>
|
const processSearch = useCallback(() =>
|
||||||
{
|
{
|
||||||
@ -43,6 +43,19 @@ export const NavigatorSearchView: FC<NavigatorSearchViewProps> = props =>
|
|||||||
processSearch();
|
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 (
|
return (
|
||||||
<Flex fullWidth gap={ 1 }>
|
<Flex fullWidth gap={ 1 }>
|
||||||
<Flex shrink>
|
<Flex shrink>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
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 { CreateLinkEvent, GetRoomEngine, GetRoomSession } from '../../api';
|
||||||
import { Base, Flex, LayoutItemCountView } from '../../common';
|
import { Base, Flex, LayoutItemCountView } from '../../common';
|
||||||
import { ToolbarViewItems } from './common/ToolbarViewItems';
|
import { ToolbarViewItems } from './common/ToolbarViewItems';
|
||||||
|
|
||||||
@ -27,15 +27,15 @@ export const ToolbarMeView: FC<ToolbarMeViewProps> = props =>
|
|||||||
return (
|
return (
|
||||||
<Flex alignItems="center" className="nitro-toolbar-me p-2" gap={ 2 }>
|
<Flex alignItems="center" className="nitro-toolbar-me p-2" gap={ 2 }>
|
||||||
{ useGuideTool &&
|
{ 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-helper-tool" onClick={ event => 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-achievements" onClick={ event => handleToolbarItemClick(ToolbarViewItems.ACHIEVEMENTS_ITEM) }>
|
||||||
{ (unseenAchievementCount > 0) &&
|
{ (unseenAchievementCount > 0) &&
|
||||||
<LayoutItemCountView count={ unseenAchievementCount } /> }
|
<LayoutItemCountView count={ unseenAchievementCount } /> }
|
||||||
</Base>
|
</Base>
|
||||||
<Base pointer className="navigation-item icon icon-me-profile" onClick={ () => handleToolbarItemClick(ToolbarViewItems.PROFILE_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" />
|
<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={ () => handleToolbarItemClick(ToolbarViewItems.CLOTHING_ITEM) } />
|
<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={ () => handleToolbarItemClick(ToolbarViewItems.SETTINGS_ITEM) } />
|
<Base pointer className="navigation-item icon icon-me-settings" onClick={ event => handleToolbarItemClick(ToolbarViewItems.SETTINGS_ITEM) } />
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { RelationshipStatusInfoEvent, RelationshipStatusInfoMessageParser, RoomEngineObjectEvent, RoomObjectCategory, RoomObjectType, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserProfileEvent, UserProfileParser, UserRelationshipsComposer } from '@nitrots/nitro-renderer';
|
import { RelationshipStatusInfoEvent, RelationshipStatusInfoMessageParser, RoomEngineObjectEvent, RoomObjectCategory, RoomObjectType, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserProfileEvent, UserProfileParser, UserRelationshipsComposer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
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 { Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common';
|
||||||
import { BatchUpdates, UseMessageEventHook, UseRoomEngineEvent } from '../../hooks';
|
import { BatchUpdates, UseMessageEventHook, UseRoomEngineEvent } from '../../hooks';
|
||||||
import { BadgesContainerView } from './views/BadgesContainerView';
|
import { BadgesContainerView } from './views/BadgesContainerView';
|
||||||
@ -104,7 +104,7 @@ export const UserProfileView: FC<{}> = props =>
|
|||||||
</Column>
|
</Column>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Flex alignItems="center" className="rooms-button-container px-2 py-1">
|
<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" />
|
<i className="icon icon-rooms" />
|
||||||
<Text bold underline pointer>{ LocalizeText('extendedprofile.rooms') }</Text>
|
<Text bold underline pointer>{ LocalizeText('extendedprofile.rooms') }</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user