Skip to content

Commit

Permalink
chore: remove sidepanel item warnings (RocketChat#34084)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti authored Nov 29, 2024
1 parent ff35b89 commit 90a2c3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions apps/meteor/client/sidebarv2/Item/Condensed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type CondensedProps = {
clickable?: boolean;
} & Omit<HTMLAttributes<HTMLAnchorElement>, 'is'>;

const Condensed = ({ icon, title, avatar, actions, href, unread, menu, badges, selected, ...props }: CondensedProps) => {
const Condensed = ({ icon, title, avatar, actions, unread, menu, badges, ...props }: CondensedProps) => {
const [menuVisibility, setMenuVisibility] = useState(!!window.DISABLE_ANIMATION);

const isReduceMotionEnabled = usePrefersReducedMotion();
Expand All @@ -32,7 +32,7 @@ const Condensed = ({ icon, title, avatar, actions, href, unread, menu, badges, s
};

return (
<SidebarV2Item href={href} selected={selected} {...props}>
<SidebarV2Item {...props}>
{avatar && <SidebarV2ItemAvatarWrapper>{avatar}</SidebarV2ItemAvatarWrapper>}
{icon && icon}
<SidebarV2ItemTitle unread={unread}>{title}</SidebarV2ItemTitle>
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/sidebarv2/Item/Medium.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type MediumProps = {
menuOptions?: any;
} & Omit<HTMLAttributes<HTMLElement>, 'is'>;

const Medium = ({ icon, title, avatar, actions, href, badges, unread, menu, selected, ...props }: MediumProps) => {
const Medium = ({ icon, title, avatar, actions, badges, unread, menu, ...props }: MediumProps) => {
const [menuVisibility, setMenuVisibility] = useState(!!window.DISABLE_ANIMATION);

const isReduceMotionEnabled = usePrefersReducedMotion();
Expand All @@ -31,7 +31,7 @@ const Medium = ({ icon, title, avatar, actions, href, badges, unread, menu, sele
};

return (
<SidebarV2Item href={href} selected={selected} {...props}>
<SidebarV2Item {...props}>
<SidebarV2ItemAvatarWrapper>{avatar}</SidebarV2ItemAvatarWrapper>
{icon && icon}
<SidebarV2ItemTitle unread={unread}>{title}</SidebarV2ItemTitle>
Expand Down
5 changes: 2 additions & 3 deletions apps/meteor/client/views/room/Sidepanel/hooks/useItemData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const useItemData = (
[highlighted, room],
);
const time = 'lastMessage' in room ? room.lastMessage?.ts : undefined;
const message = viewMode === 'extended' && getMessage(room, room.lastMessage, t);
const message = viewMode === 'extended' ? getMessage(room, room.lastMessage, t) : undefined;

const badges = useMemo(
() => (
Expand All @@ -42,7 +42,6 @@ export const useItemData = (
() => ({
unread: highlighted,
selected: room.rid === openedRoom,
t,
href: roomCoordinator.getRouteLink(room.t, room) || '',
title: roomCoordinator.getRoomName(room.t, room) || '',
icon,
Expand All @@ -51,7 +50,7 @@ export const useItemData = (
avatar: AvatarTemplate && <AvatarTemplate {...room} />,
subtitle: message,
}),
[AvatarTemplate, badges, highlighted, icon, message, openedRoom, room, t, time],
[AvatarTemplate, badges, highlighted, icon, message, openedRoom, room, time],
);

return itemData;
Expand Down

0 comments on commit 90a2c3c

Please sign in to comment.