From a788c82791d8b8efb6b1a3ef3580659e09a57e54 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 1 Mar 2022 18:00:04 -0500 Subject: [PATCH] Fix delete room button --- .../navigator/{context => }/NavigatorContext.tsx | 4 ++-- .../navigator/NavigatorMessageHandler.tsx | 2 +- src/components/navigator/NavigatorView.tsx | 2 +- .../views/creator/NavigatorRoomCreatorView.tsx | 2 +- .../views/room-info/NavigatorRoomInfoView.tsx | 2 +- .../views/room-link/NavigatorRoomLinkView.tsx | 2 +- .../views/NavigatorRoomSettingsBasicTabView.tsx | 16 ++++++++++++++-- .../views/search/NavigatorSearchView.tsx | 2 +- 8 files changed, 22 insertions(+), 10 deletions(-) rename src/components/navigator/{context => }/NavigatorContext.tsx (83%) diff --git a/src/components/navigator/context/NavigatorContext.tsx b/src/components/navigator/NavigatorContext.tsx similarity index 83% rename from src/components/navigator/context/NavigatorContext.tsx rename to src/components/navigator/NavigatorContext.tsx index 1c2209a1..99fe9267 100644 --- a/src/components/navigator/context/NavigatorContext.tsx +++ b/src/components/navigator/NavigatorContext.tsx @@ -1,7 +1,7 @@ import { createContext, Dispatch, FC, ProviderProps, useContext } from 'react'; -import { INavigatorAction, INavigatorState } from '../reducers/NavigatorReducer'; +import { INavigatorAction, INavigatorState } from './reducers/NavigatorReducer'; -export interface INavigatorContext +interface INavigatorContext { navigatorState: INavigatorState; dispatchNavigatorState: Dispatch; diff --git a/src/components/navigator/NavigatorMessageHandler.tsx b/src/components/navigator/NavigatorMessageHandler.tsx index 2a1e88c3..11e41220 100644 --- a/src/components/navigator/NavigatorMessageHandler.tsx +++ b/src/components/navigator/NavigatorMessageHandler.tsx @@ -4,7 +4,7 @@ import { CreateRoomSession, GetSessionDataManager } from '../../api'; import { UpdateDoorStateEvent } from '../../events'; import { dispatchUiEvent } from '../../hooks'; import { CreateMessageHook, SendMessageHook } from '../../hooks/messages/message-event'; -import { useNavigatorContext } from './context/NavigatorContext'; +import { useNavigatorContext } from './NavigatorContext'; import { NavigatorActions } from './reducers/NavigatorReducer'; export const NavigatorMessageHandler: FC<{}> = props => diff --git a/src/components/navigator/NavigatorView.tsx b/src/components/navigator/NavigatorView.tsx index e8c47028..0b24a958 100644 --- a/src/components/navigator/NavigatorView.tsx +++ b/src/components/navigator/NavigatorView.tsx @@ -9,7 +9,7 @@ import { useRoomSessionManagerEvent } from '../../hooks/events/nitro/session/roo import { useUiEvent } from '../../hooks/events/ui/ui-event'; import { SendMessageHook } from '../../hooks/messages/message-event'; import { NitroCardContentView, NitroCardHeaderView, NitroCardTabsItemView, NitroCardTabsView, NitroCardView } from '../../layout'; -import { NavigatorContextProvider } from './context/NavigatorContext'; +import { NavigatorContextProvider } from './NavigatorContext'; import { NavigatorMessageHandler } from './NavigatorMessageHandler'; import { initialNavigator, NavigatorActions, NavigatorReducer } from './reducers/NavigatorReducer'; import { NavigatorRoomCreatorView } from './views/creator/NavigatorRoomCreatorView'; diff --git a/src/components/navigator/views/creator/NavigatorRoomCreatorView.tsx b/src/components/navigator/views/creator/NavigatorRoomCreatorView.tsx index dc904fb6..c9e6ebf7 100644 --- a/src/components/navigator/views/creator/NavigatorRoomCreatorView.tsx +++ b/src/components/navigator/views/creator/NavigatorRoomCreatorView.tsx @@ -12,7 +12,7 @@ import { BatchUpdates } from '../../../../hooks'; import { SendMessageHook } from '../../../../hooks/messages'; import { CurrencyIcon } from '../../../../views/shared/currency-icon/CurrencyIcon'; import { IRoomModel, RoomModels } from '../../common/RoomModels'; -import { useNavigatorContext } from '../../context/NavigatorContext'; +import { useNavigatorContext } from '../../NavigatorContext'; export const NavigatorRoomCreatorView: FC<{}> = props => { diff --git a/src/components/navigator/views/room-info/NavigatorRoomInfoView.tsx b/src/components/navigator/views/room-info/NavigatorRoomInfoView.tsx index cdc4f34f..db5ba852 100644 --- a/src/components/navigator/views/room-info/NavigatorRoomInfoView.tsx +++ b/src/components/navigator/views/room-info/NavigatorRoomInfoView.tsx @@ -17,7 +17,7 @@ import { SendMessageHook } from '../../../../hooks/messages'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView, UserProfileIconView } from '../../../../layout'; import { RoomThumbnailView } from '../../../../layout/room-thumbnail/RoomThumbnailView'; import { BadgeImageView } from '../../../../views/shared/badge-image/BadgeImageView'; -import { useNavigatorContext } from '../../context/NavigatorContext'; +import { useNavigatorContext } from '../../NavigatorContext'; import { NavigatorActions } from '../../reducers/NavigatorReducer'; export class NavigatorRoomInfoViewProps diff --git a/src/components/navigator/views/room-link/NavigatorRoomLinkView.tsx b/src/components/navigator/views/room-link/NavigatorRoomLinkView.tsx index 89f45b91..61d1b23e 100644 --- a/src/components/navigator/views/room-link/NavigatorRoomLinkView.tsx +++ b/src/components/navigator/views/room-link/NavigatorRoomLinkView.tsx @@ -5,7 +5,7 @@ import { Flex } from '../../../../common/Flex'; import { Text } from '../../../../common/Text'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../layout'; import { RoomThumbnailView } from '../../../../layout/room-thumbnail/RoomThumbnailView'; -import { useNavigatorContext } from '../../context/NavigatorContext'; +import { useNavigatorContext } from '../../NavigatorContext'; export class NavigatorRoomLinkViewProps { diff --git a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx index 43166e55..f22a075e 100644 --- a/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx +++ b/src/components/navigator/views/room-settings/views/NavigatorRoomSettingsBasicTabView.tsx @@ -1,11 +1,14 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { RoomDeleteComposer } from '@nitrots/nitro-renderer'; import { FC, useState } from 'react'; import { LocalizeText } from '../../../../../api'; import { Base } from '../../../../../common/Base'; import { Flex } from '../../../../../common/Flex'; import { Text } from '../../../../../common/Text'; +import { SendMessageHook } from '../../../../../hooks'; +import { NotificationUtilities } from '../../../../../views/notification-center/common/NotificationUtilities'; import { GetMaxVisitorsList } from '../../../common/RoomSettingsUtils'; -import { useNavigatorContext } from '../../../context/NavigatorContext'; +import { useNavigatorContext } from '../../../NavigatorContext'; import { NavigatorRoomSettingsTabViewProps } from './NavigatorRoomSettingsTabViewProps.types'; const DESC_MAX_LENGTH = 255; @@ -17,6 +20,15 @@ export const NavigatorRoomSettingsBasicTabView: FC + { + NotificationUtilities.confirm(LocalizeText('navigator.roomsettings.deleteroom.confirm.message'), () => + { + SendMessageHook(new RoomDeleteComposer(roomSettingsData.roomId)); + }, + null, null, null, LocalizeText('navigator.roomsettings.deleteroom.confirm.title')); + } + return ( <> @@ -58,7 +70,7 @@ export const NavigatorRoomSettingsBasicTabView: FC handleChange('allow_walkthrough', event.target.checked) } /> { LocalizeText('navigator.roomsettings.allow_walk_through') } - + { LocalizeText('navigator.roomsettings.delete') } diff --git a/src/components/navigator/views/search/NavigatorSearchView.tsx b/src/components/navigator/views/search/NavigatorSearchView.tsx index f4584701..df426603 100644 --- a/src/components/navigator/views/search/NavigatorSearchView.tsx +++ b/src/components/navigator/views/search/NavigatorSearchView.tsx @@ -4,7 +4,7 @@ import { LocalizeText } from '../../../../api'; import { Button } from '../../../../common/Button'; import { Flex } from '../../../../common/Flex'; import { SearchFilterOptions } from '../../common/SearchFilterOptions'; -import { useNavigatorContext } from '../../context/NavigatorContext'; +import { useNavigatorContext } from '../../NavigatorContext'; export interface NavigatorSearchViewProps {