mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-27 08:00:51 +01:00
Fix delete room button
This commit is contained in:
parent
7584163b94
commit
a788c82791
@ -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<INavigatorAction>;
|
@ -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 =>
|
||||
|
@ -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';
|
||||
|
@ -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 =>
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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<NavigatorRoomSettingsTabViewP
|
||||
const { navigatorState = null } = useNavigatorContext();
|
||||
const { categories = null } = navigatorState;
|
||||
|
||||
const deleteRoom = () =>
|
||||
{
|
||||
NotificationUtilities.confirm(LocalizeText('navigator.roomsettings.deleteroom.confirm.message'), () =>
|
||||
{
|
||||
SendMessageHook(new RoomDeleteComposer(roomSettingsData.roomId));
|
||||
},
|
||||
null, null, null, LocalizeText('navigator.roomsettings.deleteroom.confirm.title'));
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex alignItems="center" gap={ 1 }>
|
||||
@ -58,7 +70,7 @@ export const NavigatorRoomSettingsBasicTabView: FC<NavigatorRoomSettingsTabViewP
|
||||
<input className="form-check-input" type="checkbox" checked={ roomSettingsData.allowWalkthrough } onChange={ event => handleChange('allow_walkthrough', event.target.checked) } />
|
||||
<Text>{ LocalizeText('navigator.roomsettings.allow_walk_through') }</Text>
|
||||
</Flex>
|
||||
<Text variant="danger" underline bold pointer className="d-flex justify-content-center align-items-center gap-1 mt-2">
|
||||
<Text variant="danger" underline bold pointer className="d-flex justify-content-center align-items-center gap-1" onClick={ deleteRoom }>
|
||||
<FontAwesomeIcon icon="times" />
|
||||
{ LocalizeText('navigator.roomsettings.delete') }
|
||||
</Text>
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user