mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 15:36:18 +00:00
style(navigator): unify room-settings tabs with section cards
Introduce a reusable NavigatorRoomSettingsSectionView card (rounded bg-gray-100 panel with a bold-small title) and apply it across the Access, VIP/Chat, Moderation and Rights tabs so every room-settings screen matches the Base and Misc tab styling. Pure visual restyle — handleChange wiring, events, composers and validations are unchanged.
This commit is contained in:
+51
-52
@@ -3,6 +3,7 @@ import { FC, useEffect, useRef, useState } from 'react';
|
||||
import { IRoomData, LocalizeText, SendMessageComposer } from '../../../../api';
|
||||
import { Button, Column, Flex, Grid, Text, UserProfileIconView } from '../../../../common';
|
||||
import { useFriends, useMessageEvent } from '../../../../hooks';
|
||||
import { NavigatorRoomSettingsSectionView } from './NavigatorRoomSettingsSectionView';
|
||||
|
||||
interface NavigatorRoomSettingsTabViewProps
|
||||
{
|
||||
@@ -105,74 +106,72 @@ export const NavigatorRoomSettingsRightsTabView: FC<NavigatorRoomSettingsTabView
|
||||
return (
|
||||
<Grid>
|
||||
<Column size={ 6 }>
|
||||
<Text bold>
|
||||
{ LocalizeText(
|
||||
<NavigatorRoomSettingsSectionView gap={ 1 } className="h-full"
|
||||
title={ LocalizeText(
|
||||
'navigator.flatctrls.userswithrights',
|
||||
[ 'displayed', 'total' ],
|
||||
[
|
||||
filteredUsersWithRights.size.toString(),
|
||||
filteredUsersWithRights.size.toString()
|
||||
]
|
||||
) }
|
||||
</Text>
|
||||
) }>
|
||||
<Flex overflow="hidden" className="nitro-card-panel p-2 list-container">
|
||||
<Column fullWidth overflow="auto" gap={ 1 }>
|
||||
{ Array.from(filteredUsersWithRights.entries()).map(([ id, name ], index) =>
|
||||
{
|
||||
return (
|
||||
<Flex key={ `${id}-${index}` } shrink alignItems="center" gap={ 1 } overflow="hidden">
|
||||
<UserProfileIconView userId={ id } />
|
||||
<Text
|
||||
pointer
|
||||
grow
|
||||
onClick={ () => guardedSend(`take_${id}`, new RoomTakeRightsComposer(id)) }>
|
||||
{ name }
|
||||
</Text>
|
||||
</Flex>
|
||||
);
|
||||
}) }
|
||||
</Column>
|
||||
</Flex>
|
||||
|
||||
<Flex overflow="hidden" className="nitro-card-panel p-2 list-container">
|
||||
<Column fullWidth overflow="auto" gap={ 1 }>
|
||||
{ Array.from(filteredUsersWithRights.entries()).map(([ id, name ], index) =>
|
||||
{
|
||||
return (
|
||||
<Flex key={ `${id}-${index}` } shrink alignItems="center" gap={ 1 } overflow="hidden">
|
||||
<UserProfileIconView userId={ id } />
|
||||
<Text
|
||||
pointer
|
||||
grow
|
||||
onClick={ () => guardedSend(`take_${id}`, new RoomTakeRightsComposer(id)) }>
|
||||
{ name }
|
||||
</Text>
|
||||
</Flex>
|
||||
);
|
||||
}) }
|
||||
</Column>
|
||||
</Flex>
|
||||
|
||||
<Button
|
||||
variant="danger"
|
||||
disabled={ !filteredUsersWithRights.size }
|
||||
onClick={ () => roomData && guardedSend('removeAll', new RemoveAllRightsMessageComposer(roomData.roomId)) }>
|
||||
{ LocalizeText('navigator.flatctrls.clear') }
|
||||
</Button>
|
||||
<Button
|
||||
variant="danger"
|
||||
disabled={ !filteredUsersWithRights.size }
|
||||
onClick={ () => roomData && guardedSend('removeAll', new RemoveAllRightsMessageComposer(roomData.roomId)) }>
|
||||
{ LocalizeText('navigator.flatctrls.clear') }
|
||||
</Button>
|
||||
</NavigatorRoomSettingsSectionView>
|
||||
</Column>
|
||||
|
||||
<Column size={ 6 }>
|
||||
<Text bold>
|
||||
{ LocalizeText(
|
||||
<NavigatorRoomSettingsSectionView gap={ 1 } className="h-full"
|
||||
title={ LocalizeText(
|
||||
'navigator.flatctrls.friends',
|
||||
[ 'displayed', 'total' ],
|
||||
[
|
||||
friendsWithoutRights.length.toString(),
|
||||
allFriends.length.toString()
|
||||
]
|
||||
) }
|
||||
</Text>
|
||||
|
||||
<Flex overflow="hidden" className="nitro-card-panel p-2 list-container">
|
||||
<Column fullWidth overflow="auto" gap={ 1 }>
|
||||
{ friendsWithoutRights.map((friend, index) =>
|
||||
{
|
||||
return (
|
||||
<Flex key={ `${friend.id}-${index}` } shrink alignItems="center" gap={ 1 } overflow="hidden">
|
||||
<UserProfileIconView userId={ friend.id } />
|
||||
<Text
|
||||
pointer
|
||||
grow
|
||||
onClick={ () => guardedSend(`give_${friend.id}`, new RoomGiveRightsComposer(friend.id)) }>
|
||||
{ friend.name }
|
||||
</Text>
|
||||
</Flex>
|
||||
);
|
||||
}) }
|
||||
</Column>
|
||||
</Flex>
|
||||
) }>
|
||||
<Flex overflow="hidden" className="nitro-card-panel p-2 list-container">
|
||||
<Column fullWidth overflow="auto" gap={ 1 }>
|
||||
{ friendsWithoutRights.map((friend, index) =>
|
||||
{
|
||||
return (
|
||||
<Flex key={ `${friend.id}-${index}` } shrink alignItems="center" gap={ 1 } overflow="hidden">
|
||||
<UserProfileIconView userId={ friend.id } />
|
||||
<Text
|
||||
pointer
|
||||
grow
|
||||
onClick={ () => guardedSend(`give_${friend.id}`, new RoomGiveRightsComposer(friend.id)) }>
|
||||
{ friend.name }
|
||||
</Text>
|
||||
</Flex>
|
||||
);
|
||||
}) }
|
||||
</Column>
|
||||
</Flex>
|
||||
</NavigatorRoomSettingsSectionView>
|
||||
</Column>
|
||||
</Grid>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user