From 2a11ee50bac3b29f7e261d7627122e0ecb1d8cc6 Mon Sep 17 00:00:00 2001 From: Tiago Evangelista Pinto Date: Fri, 2 Apr 2021 20:59:48 -0300 Subject: [PATCH 1/2] remove from all presence icons the prop size --- client/components/UserStatus.js | 11 +++++------ client/hooks/useRoomIcon.tsx | 4 ++-- client/sidebar/RoomList.js | 8 ++++---- client/sidebar/search/SearchList.js | 5 ++--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/client/components/UserStatus.js b/client/components/UserStatus.js index 8fcc400c8a458..0a579294f280f 100644 --- a/client/components/UserStatus.js +++ b/client/components/UserStatus.js @@ -5,19 +5,18 @@ import { useTranslation } from '../contexts/TranslationContext'; import { usePresence } from '../hooks/usePresence'; export const UserStatus = React.memo(({ small, status, ...props }) => { - const size = small ? 'small' : 'large'; const t = useTranslation(); switch (status) { case 'online': - return ; + return ; case 'busy': - return ; + return ; case 'away': - return ; + return ; case 'offline': - return ; + return ; default: - return ; + return ; } }); diff --git a/client/hooks/useRoomIcon.tsx b/client/hooks/useRoomIcon.tsx index 549df497af964..103c46bcea150 100644 --- a/client/hooks/useRoomIcon.tsx +++ b/client/hooks/useRoomIcon.tsx @@ -11,7 +11,7 @@ export const colors = { offline: 'neutral-600', }; -export const useRoomIcon = (room: IRoom, small = true): JSX.Element | { name: string; color?: string } | null => { +export const useRoomIcon = (room: IRoom): JSX.Element | { name: string; color?: string } | null => { if (room.prid) { return { name: 'baloons' }; } @@ -33,7 +33,7 @@ export const useRoomIcon = (room: IRoom, small = true): JSX.Element | { name: st return { name: 'balloon' }; } if (direct.uids && direct.uids.length > 0) { - return uid !== room.u._id)[0] || room.u._id } as any } />; + return uid !== room.u._id)[0] || room.u._id } as any } />; } return { name: 'at' }; default: diff --git a/client/sidebar/RoomList.js b/client/sidebar/RoomList.js index 67e42e1061924..a70174ca24fb4 100644 --- a/client/sidebar/RoomList.js +++ b/client/sidebar/RoomList.js @@ -37,8 +37,8 @@ export const itemSizeMap = (sidebarViewMode) => { } }; -const SidebarIcon = ({ room, small }) => { - const icon = useRoomIcon(room, small); +const SidebarIcon = ({ room }) => { + const icon = useRoomIcon(room); return {!icon.name && icon} @@ -150,9 +150,9 @@ const getMessage = (room, lastMessage, t) => { return `${ lastMessage.u.name || lastMessage.u.username }: ${ normalizeSidebarMessage(lastMessage, t) }`; }; -export const SideBarItemTemplateWithData = React.memo(function SideBarItemTemplateWithData({ room, id, extended, selected, SideBarItemTemplate, AvatarTemplate, t, style, sidebarViewMode, isAnonymous }) { +export const SideBarItemTemplateWithData = React.memo(function SideBarItemTemplateWithData({ room, id, extended, selected, SideBarItemTemplate, AvatarTemplate, t, style, isAnonymous }) { const title = roomTypes.getRoomName(room.t, room); - const icon = ; + const icon = ; const href = roomTypes.getRouteLink(room.t, room); const { diff --git a/client/sidebar/search/SearchList.js b/client/sidebar/search/SearchList.js index 5d6574ff18ee7..d12bd41737fcb 100644 --- a/client/sidebar/search/SearchList.js +++ b/client/sidebar/search/SearchList.js @@ -39,10 +39,9 @@ const Row = React.memo(({ item, data }) => { return ; }); -const UserItem = React.memo(({ item, id, style, t, SideBarItemTemplate, AvatarTemplate, useRealName, sidebarViewMode }) => { +const UserItem = React.memo(({ item, id, style, t, SideBarItemTemplate, AvatarTemplate, useRealName }) => { const title = useRealName ? item.fname || item.name : item.name || item.fname; - const small = sidebarViewMode !== 'medium'; - const icon = ; + const icon = ; const href = roomTypes.getRouteLink(item.t, item); return Date: Tue, 20 Apr 2021 00:45:58 -0300 Subject: [PATCH 2/2] Update SidebarIcon.js --- client/sidebar/RoomList/SidebarIcon.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/sidebar/RoomList/SidebarIcon.js b/client/sidebar/RoomList/SidebarIcon.js index 1a2658aa1b64e..8eedb10f05416 100644 --- a/client/sidebar/RoomList/SidebarIcon.js +++ b/client/sidebar/RoomList/SidebarIcon.js @@ -3,8 +3,8 @@ import React from 'react'; import { useRoomIcon } from '../../hooks/useRoomIcon'; -const SidebarIcon = ({ room, small }) => { - const icon = useRoomIcon(room, small); +const SidebarIcon = ({ room }) => { + const icon = useRoomIcon(room); return {!icon.name && icon}; };