Add suggested room label in manage rooms

Signed-off-by: ajbura <ajbura@gmail.com>
This commit is contained in:
ajbura 2022-02-19 13:40:32 +05:30
parent 86bbaa437e
commit d87e40ada5
2 changed files with 14 additions and 3 deletions

View file

@ -69,10 +69,11 @@ function SpaceManageItem({
const { directs } = initMatrix.roomList;
const mx = initMatrix.matrixClient;
const parentRoom = mx.getRoom(parentId);
const canManage = parentRoom?.currentState.maySendStateEvent('m.space.child', mx.getUserId()) || false;
const isSpace = roomInfo.room_type === 'm.space';
const roomId = roomInfo.room_id;
const canManage = parentRoom?.currentState.maySendStateEvent('m.space.child', mx.getUserId()) || false;
const isSuggested = parentRoom?.currentState.getStateEvents('m.space.child', roomId)?.getContent().suggested === true;
const room = mx.getRoom(roomId);
const isJoined = !!(room?.getMyMembership() === 'join' || null);
const name = room?.name || roomInfo.name || roomInfo.canonical_alias || roomId;
@ -135,6 +136,7 @@ function SpaceManageItem({
>
{roomAvatarJSX}
{roomNameJSX}
{isSuggested && <Text variant="b2">Suggested</Text>}
</button>
{roomInfo.topic && expandBtnJsx}
{

View file

@ -106,15 +106,24 @@
&__btn {
@extend .cp-fx__item-one;
display: flex;
align-items: center;
& .avatar__border--active {
box-shadow: none;
}
& .text {
& > .text-b1 {
@extend .cp-fx__item-one;
@extend .cp-txt__ellipsis;
min-width: 0;
margin: 0 var(--sp-extra-tight);
}
& > .text-b2 {
margin: 0 var(--sp-extra-tight);
padding: 1px var(--sp-ultra-tight);
color: var(--bg-positive);
box-shadow: var(--bs-positive-border);
border-radius: 4px;
}
}
& .ic-btn {