diff --git a/src/components/navigator/NavigatorView.tsx b/src/components/navigator/NavigatorView.tsx index 4afb0c98..004e4bc9 100644 --- a/src/components/navigator/NavigatorView.tsx +++ b/src/components/navigator/NavigatorView.tsx @@ -1,7 +1,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { ConvertGlobalRoomIdMessageComposer, HabboWebTools, ILinkEventTracker, LegacyExternalInterface, NavigatorInitComposer, NavigatorSearchComposer, RoomDataParser, RoomSessionEvent } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useReducer, useState } from 'react'; -import { AddEventLinkTracker, GoToDesktop, LocalizeText, RemoveLinkEventTracker, SendMessageComposer, TryVisitRoom } from '../../api'; +import { AddEventLinkTracker, CreateLinkEvent, GoToDesktop, LocalizeText, RemoveLinkEventTracker, SendMessageComposer, TryVisitRoom } from '../../api'; import { Column, NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../common'; import { NavigatorEvent, UpdateDoorStateEvent } from '../../events'; import { BatchUpdates, UseMountEffect, UseRoomSessionManagerEvent, UseUiEvent } from '../../hooks'; @@ -15,7 +15,7 @@ import { NavigatorRoomLinkView } from './views/room-link/NavigatorRoomLinkView'; import { NavigatorRoomPasswordView } from './views/room-password/NavigatorRoomPasswordView'; import { NavigatorRoomSettingsView } from './views/room-settings/NavigatorRoomSettingsView'; import { NavigatorSearchResultView } from './views/search-result/NavigatorSearchResultView'; -import { NavigatorSearchView } from './views/search/NavigatorSearchView'; +import { LAST_SEARCH, NavigatorSearchView } from './views/search/NavigatorSearchView'; export const NavigatorView: FC<{}> = props => { @@ -169,8 +169,6 @@ export const NavigatorView: FC<{}> = props => if(parts.length > 3) searchValue = parts[3]; - console.log(searchValue, topLevelContextCode) - setIsVisible(true); sendSearch(searchValue, topLevelContextCode); } @@ -233,6 +231,15 @@ export const NavigatorView: FC<{}> = props => sendSearch('', topLevelContexts[0].code); }, [ topLevelContexts, sendSearch ]); + useEffect(() => + { + if(!isVisible || !LAST_SEARCH || !LAST_SEARCH.length) return; + + console.log(LAST_SEARCH) + + CreateLinkEvent(`navigator/search/${ LAST_SEARCH }`); + }, [ isVisible ]); + const getRoomDoorState = useMemo(() => { if(!pendingDoorState) return null; diff --git a/src/components/navigator/views/room-settings/NavigatorRoomSettingsView.tsx b/src/components/navigator/views/room-settings/NavigatorRoomSettingsView.tsx index cd126339..1a884233 100644 --- a/src/components/navigator/views/room-settings/NavigatorRoomSettingsView.tsx +++ b/src/components/navigator/views/room-settings/NavigatorRoomSettingsView.tsx @@ -231,7 +231,7 @@ export const NavigatorRoomSettingsView: FC<{}> = props => { currentTab === TABS[0] && - } + processAction('close') } /> } { currentTab === TABS[1] && } { currentTab === TABS[2] && diff --git a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsAccessTabView.tsx b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsAccessTabView.tsx index 418202c6..7df8020d 100644 --- a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsAccessTabView.tsx +++ b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsAccessTabView.tsx @@ -1,7 +1,13 @@ import { FC, useCallback } from 'react'; import { LocalizeText } from '../../../../../api'; import { Column, Flex, Text } from '../../../../../common'; -import { NavigatorRoomSettingsTabViewProps } from './NavigatorRoomSettingsTabViewProps.types'; +import RoomSettingsData from '../../../common/RoomSettingsData'; + +interface NavigatorRoomSettingsTabViewProps +{ + roomSettingsData: RoomSettingsData; + handleChange: (field: string, value: string | number | boolean) => void; +} export const NavigatorRoomSettingsAccessTabView: FC = props => { diff --git a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx index 4b48e1bb..1fdc29e7 100644 --- a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx +++ b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx @@ -1,17 +1,25 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { RoomDeleteComposer } from '@nitrots/nitro-renderer'; import { FC, useState } from 'react'; -import { LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../api'; +import { CreateLinkEvent, LocalizeText, NotificationUtilities, SendMessageComposer } from '../../../../../api'; import { Base, Flex, Text } from '../../../../../common'; +import RoomSettingsData from '../../../common/RoomSettingsData'; import { GetMaxVisitorsList } from '../../../common/RoomSettingsUtils'; import { useNavigatorContext } from '../../../NavigatorContext'; -import { NavigatorRoomSettingsTabViewProps } from './NavigatorRoomSettingsTabViewProps.types'; const DESC_MAX_LENGTH = 255; +interface NavigatorRoomSettingsTabViewProps +{ + roomSettingsData: RoomSettingsData; + handleChange: (field: string, value: string | number | boolean) => void; + close: () => void; +} + + export const NavigatorRoomSettingsBasicTabView: FC = props => { - const { roomSettingsData = null, handleChange = null } = props; + const { roomSettingsData = null, handleChange = null, close = null } = props; const [ maxVisitorsList, setMaxVisitorsList ] = useState(GetMaxVisitorsList()); const { navigatorState = null } = useNavigatorContext(); const { categories = null } = navigatorState; @@ -21,6 +29,10 @@ export const NavigatorRoomSettingsBasicTabView: FC { SendMessageComposer(new RoomDeleteComposer(roomSettingsData.roomId)); + + if(close) close(); + + CreateLinkEvent('navigator/search/myworld_view'); }, null, null, null, LocalizeText('navigator.roomsettings.deleteroom.confirm.title')); } diff --git a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsModTabView.tsx b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsModTabView.tsx index d11ee777..488155bc 100644 --- a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsModTabView.tsx +++ b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsModTabView.tsx @@ -2,7 +2,13 @@ import { RoomUnbanUserComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback, useState } from 'react'; import { LocalizeText, SendMessageComposer } from '../../../../../api'; import { Base, Button, Column, Grid, Text } from '../../../../../common'; -import { NavigatorRoomSettingsTabViewProps } from './NavigatorRoomSettingsTabViewProps.types'; +import RoomSettingsData from '../../../common/RoomSettingsData'; + +interface NavigatorRoomSettingsTabViewProps +{ + roomSettingsData: RoomSettingsData; + handleChange: (field: string, value: string | number | boolean) => void; +} export const NavigatorRoomSettingsModTabView: FC = props => { diff --git a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsRightsTabView.tsx b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsRightsTabView.tsx index 0014543c..eed23f68 100644 --- a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsRightsTabView.tsx +++ b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsRightsTabView.tsx @@ -2,7 +2,13 @@ import { RemoveAllRightsMessageComposer, RoomTakeRightsComposer } from '@nitrots import { FC, useCallback } from 'react'; import { LocalizeText, SendMessageComposer } from '../../../../../api'; import { Button, Column, Flex, Grid, Text, UserProfileIconView } from '../../../../../common'; -import { NavigatorRoomSettingsTabViewProps } from './NavigatorRoomSettingsTabViewProps.types'; +import RoomSettingsData from '../../../common/RoomSettingsData'; + +interface NavigatorRoomSettingsTabViewProps +{ + roomSettingsData: RoomSettingsData; + handleChange: (field: string, value: string | number | boolean) => void; +} export const NavigatorRoomSettingsRightsTabView: FC = props => { diff --git a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsTabViewProps.types.ts b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsTabViewProps.types.ts deleted file mode 100644 index 39db7e2c..00000000 --- a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsTabViewProps.types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import RoomSettingsData from '../../../common/RoomSettingsData'; - -export class NavigatorRoomSettingsTabViewProps -{ - roomSettingsData: RoomSettingsData; - handleChange: (field: string, value: string | number | boolean) => void; -} diff --git a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsVipChatTabView.tsx b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsVipChatTabView.tsx index 9d09b0ea..391ddada 100644 --- a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsVipChatTabView.tsx +++ b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsVipChatTabView.tsx @@ -1,10 +1,13 @@ import { FC } from 'react'; import { LocalizeText } from '../../../../../api'; -import { Column } from '../../../../../common/Column'; -import { Flex } from '../../../../../common/Flex'; -import { Grid } from '../../../../../common/Grid'; -import { Text } from '../../../../../common/Text'; -import { NavigatorRoomSettingsTabViewProps } from './NavigatorRoomSettingsTabViewProps.types'; +import { Column, Flex, Grid, Text } from '../../../../../common'; +import RoomSettingsData from '../../../common/RoomSettingsData'; + +interface NavigatorRoomSettingsTabViewProps +{ + roomSettingsData: RoomSettingsData; + handleChange: (field: string, value: string | number | boolean) => void; +} export const NavigatorRoomSettingsVipChatTabView: FC = props => { diff --git a/src/components/navigator/views/search/NavigatorSearchView.tsx b/src/components/navigator/views/search/NavigatorSearchView.tsx index ecc73e0b..9f975150 100644 --- a/src/components/navigator/views/search/NavigatorSearchView.tsx +++ b/src/components/navigator/views/search/NavigatorSearchView.tsx @@ -11,6 +11,8 @@ export interface NavigatorSearchViewProps sendSearch: (searchValue: string, contextCode: string) => void; } +export let LAST_SEARCH: string = null; + export const NavigatorSearchView: FC = props => { const { sendSearch = null } = props; @@ -47,6 +49,8 @@ export const NavigatorSearchView: FC = props => { const searchResultDataParts = searchResult.data.split(':'); + LAST_SEARCH = `${ topLevelContext.code }/${ searchResult.data }`; + if(searchResultDataParts.length === 2) { let searchFilterIndex = SearchFilterOptions.findIndex(option => (option.query === searchResultDataParts[0])); @@ -54,7 +58,7 @@ export const NavigatorSearchView: FC = props => if(searchFilterIndex > -1) setSearchFilterIndex(searchFilterIndex); setSearchValue(searchResultDataParts[1]); } - }, [ searchResult ]); + }, [ searchResult, topLevelContext ]); return (