diff --git a/src/components/navigator/views/room-settings/NavigatorRoomSettingsRightsTabView.tsx b/src/components/navigator/views/room-settings/NavigatorRoomSettingsRightsTabView.tsx index ac17d13f..8a435035 100644 --- a/src/components/navigator/views/room-settings/NavigatorRoomSettingsRightsTabView.tsx +++ b/src/components/navigator/views/room-settings/NavigatorRoomSettingsRightsTabView.tsx @@ -1,8 +1,8 @@ -import { FlatControllerAddedEvent, FlatControllerRemovedEvent, FlatControllersEvent, RemoveAllRightsMessageComposer, RoomTakeRightsComposer, RoomUsersWithRightsComposer } from '@nitrots/nitro-renderer'; +import { FlatControllerAddedEvent, FlatControllerRemovedEvent, FlatControllersEvent, RemoveAllRightsMessageComposer, RoomGiveRightsComposer, RoomTakeRightsComposer, RoomUsersWithRightsComposer } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; -import { IRoomData, LocalizeText, SendMessageComposer } from '../../../../api'; +import { IRoomData, LocalizeText, MessengerFriend, SendMessageComposer } from '../../../../api'; import { Button, Column, Flex, Grid, Text, UserProfileIconView } from '../../../../common'; -import { useMessageEvent } from '../../../../hooks'; +import { useFriends, useMessageEvent } from '../../../../hooks'; interface NavigatorRoomSettingsTabViewProps { @@ -14,6 +14,7 @@ export const NavigatorRoomSettingsRightsTabView: FC>(new Map()); + const { friends = [] } = useFriends(); useMessageEvent(FlatControllersEvent, event => { @@ -53,7 +54,7 @@ export const NavigatorRoomSettingsRightsTabView: FC @@ -61,6 +62,8 @@ export const NavigatorRoomSettingsRightsTabView: FC friend ).filter(friend => friend.id !== -1 && !Array.from(usersWithRights.keys()).includes(friend.id)); + return ( @@ -73,18 +76,36 @@ export const NavigatorRoomSettingsRightsTabView: FC - + SendMessageComposer(new RoomTakeRightsComposer(id)) }> { name } ); }) } + + + - - + + + { LocalizeText('navigator.flatctrls.friends', [ 'displayed', 'total' ], [ friendsWithoutRights.length.toString(), friendsWithoutRights.length.toString() ]) } + + + + { friendsWithoutRights && friendsWithoutRights.map((friend: MessengerFriend, index) => + { + return ( + + + SendMessageComposer(new RoomGiveRightsComposer(friend.id)) }> { friend.name } + + ); + }) } + + );