Fix room settings

This commit is contained in:
Bill 2022-08-01 12:05:00 -04:00
parent 474f8944e2
commit 9af557cb3f

View File

@ -1,4 +1,4 @@
import { BannedUserData, BannedUsersFromRoomEvent, RoomBannedUsersComposer, RoomUnbanUserComposer } from '@nitrots/nitro-renderer'; import { BannedUserData, BannedUsersFromRoomEvent, RoomBannedUsersComposer, RoomModerationSettings, RoomUnbanUserComposer } from '@nitrots/nitro-renderer';
import { FC, useCallback, useEffect, useState } from 'react'; import { FC, useCallback, useEffect, useState } from 'react';
import { IRoomData, LocalizeText, SendMessageComposer } from '../../../../api'; import { IRoomData, LocalizeText, SendMessageComposer } from '../../../../api';
import { Button, Column, Flex, Grid, Text, UserProfileIconView } from '../../../../common'; import { Button, Column, Flex, Grid, Text, UserProfileIconView } from '../../../../common';
@ -73,25 +73,25 @@ export const NavigatorRoomSettingsModTabView: FC<NavigatorRoomSettingsTabViewPro
<Column gap={ 1 }> <Column gap={ 1 }>
<Text bold>{ LocalizeText('navigator.roomsettings.moderation.mute.header') }</Text> <Text bold>{ LocalizeText('navigator.roomsettings.moderation.mute.header') }</Text>
<Flex alignItems="center" gap={ 1 }> <Flex alignItems="center" gap={ 1 }>
<input className="form-check-input" type="checkbox" checked={ (roomData.moderationSettings.allowMute === 1) } onChange={ event => handleChange('moderation_mute', (event.target.checked ? 1 : 0)) } /> <input className="form-check-input" type="checkbox" checked={ (roomData.moderationSettings.allowMute === RoomModerationSettings.MODERATION_LEVEL_USER_WITH_RIGHTS) } onChange={ event => handleChange('moderation_mute', (event.target.checked ? RoomModerationSettings.MODERATION_LEVEL_USER_WITH_RIGHTS : RoomModerationSettings.MODERATION_LEVEL_NONE)) } />
<Text>{ LocalizeText('navigator.roomsettings.moderation.rights') }</Text> <Text>{ LocalizeText('navigator.roomsettings.moderation.rights') }</Text>
</Flex> </Flex>
</Column> </Column>
<Column gap={ 1 }> <Column gap={ 1 }>
<Text bold>{ LocalizeText('navigator.roomsettings.moderation.kick.header') }</Text> <Text bold>{ LocalizeText('navigator.roomsettings.moderation.kick.header') }</Text>
<Flex alignItems="center" gap={ 1 }> <Flex alignItems="center" gap={ 1 }>
<input className="form-check-input" type="checkbox" checked={ (roomData.moderationSettings.allowKick === 0) } onChange={ event => handleChange('moderation_kick', (event.target.checked ? 0 : 2)) } /> <input className="form-check-input" type="checkbox" checked={ (roomData.moderationSettings.allowKick === RoomModerationSettings.MODERATION_LEVEL_ALL) } onChange={ event => handleChange('moderation_kick', (event.target.checked ? RoomModerationSettings.MODERATION_LEVEL_ALL : RoomModerationSettings.MODERATION_LEVEL_NONE)) } />
<Text>{ LocalizeText('navigator.roomsettings.moderation.all') }</Text> <Text>{ LocalizeText('navigator.roomsettings.moderation.all') }</Text>
</Flex> </Flex>
<Flex alignItems="center" gap={ 1 }> <Flex alignItems="center" gap={ 1 }>
<input className="form-check-input" type="checkbox" checked={ ((roomData.moderationSettings.allowKick === 1) || (roomData.moderationSettings.allowKick === 0)) } disabled={ (roomData.moderationSettings.allowKick === 0) } onChange={ event => handleChange('moderation_kick', (event.target.checked ? 1 : 2)) } /> <input className="form-check-input" type="checkbox" checked={ (roomData.moderationSettings.allowKick >= RoomModerationSettings.MODERATION_LEVEL_USER_WITH_RIGHTS) } disabled={ (roomData.moderationSettings.allowKick === RoomModerationSettings.MODERATION_LEVEL_ALL) } onChange={ event => handleChange('moderation_kick', (event.target.checked ? RoomModerationSettings.MODERATION_LEVEL_USER_WITH_RIGHTS : RoomModerationSettings.MODERATION_LEVEL_NONE)) } />
<Text>{ LocalizeText('navigator.roomsettings.moderation.rights') }</Text> <Text>{ LocalizeText('navigator.roomsettings.moderation.rights') }</Text>
</Flex> </Flex>
</Column> </Column>
<Column gap={ 1 }> <Column gap={ 1 }>
<Text bold>{ LocalizeText('navigator.roomsettings.moderation.ban.header') }</Text> <Text bold>{ LocalizeText('navigator.roomsettings.moderation.ban.header') }</Text>
<Flex alignItems="center" gap={ 1 }> <Flex alignItems="center" gap={ 1 }>
<input className="form-check-input" type="checkbox" checked={ (roomData.moderationSettings.allowBan === 1) } onChange={ event => handleChange('moderation_ban', (event.target.checked ? 1 : 0)) } /> <input className="form-check-input" type="checkbox" checked={ (roomData.moderationSettings.allowBan === RoomModerationSettings.MODERATION_LEVEL_USER_WITH_RIGHTS) } onChange={ event => handleChange('moderation_ban', (event.target.checked ? RoomModerationSettings.MODERATION_LEVEL_USER_WITH_RIGHTS : RoomModerationSettings.MODERATION_LEVEL_NONE)) } />
<Text>{ LocalizeText('navigator.roomsettings.moderation.rights') }</Text> <Text>{ LocalizeText('navigator.roomsettings.moderation.rights') }</Text>
</Flex> </Flex>
</Column> </Column>