diff --git a/webapp/channels/src/components/channel_info_rhs/channel_info_rhs.tsx b/webapp/channels/src/components/channel_info_rhs/channel_info_rhs.tsx index 289c647f33..22ce139a5c 100644 --- a/webapp/channels/src/components/channel_info_rhs/channel_info_rhs.tsx +++ b/webapp/channels/src/components/channel_info_rhs/channel_info_rhs.tsx @@ -42,19 +42,15 @@ export interface Props { channelStats: ChannelStats; currentUser: UserProfile; currentTeam: Team; - isArchived: boolean; isFavorite: boolean; isMuted: boolean; isInvitingPeople: boolean; isMobile: boolean; - canManageMembers: boolean; canManageProperties: boolean; - dmUser?: DMUser; channelMembers: UserProfile[]; - actions: { closeRightHandSide: () => void; unfavoriteChannel: (channelId: string) => void; @@ -155,36 +151,26 @@ const ChannelInfoRhs = ({ isMobile={isMobile} onClose={actions.closeRightHandSide} /> - - - - void; } -const menuItem = ({icon, text, className, opensSubpanel, badge, onClick}: MenuItemProps) => { +function MenuItem(props: MenuItemProps) { + const {icon, text, opensSubpanel, badge, onClick} = props; const hasRightSide = (badge !== undefined) || opensSubpanel; return ( -
- - {icon} - - {text} - - - {hasRightSide && ( - - {badge !== undefined && ( - {badge} - )} - {opensSubpanel && ( - - )} - - )} - -
+ + {icon} + {text} + {hasRightSide && ( + + {badge !== undefined && ( + {badge} + )} + {opensSubpanel && ( + + )} + + )} + ); -}; - -const MenuItem = styled(menuItem)` - display: flex; - width: 100%; - height: 40px; - flex-direction: row; - align-items: center; - cursor: pointer; - - &:hover { - background: rgba(var(--center-channel-color-rgb), 0.08); - - ${Icon} { - color: rgba(var(--center-channel-color-rgb), var(--icon-opacity-hover)); - } - } -`; +} interface MenuProps { channel: Channel; @@ -107,8 +112,16 @@ interface MenuProps { }; } -const Menu = ({channel, channelStats, isArchived, className, actions}: MenuProps) => { +export default function Menu(props: MenuProps) { const {formatMessage} = useIntl(); + const { + channel, + channelStats, + isArchived, + className, + actions, + } = props; + const [loadingStats, setLoadingStats] = useState(true); const showNotificationPreferences = channel.type !== Constants.DM_CHANNEL && !isArchived; @@ -125,21 +138,31 @@ const Menu = ({channel, channelStats, isArchived, className, actions}: MenuProps }, [channel.id]); return ( -
{showNotificationPreferences && ( } - text={formatMessage({id: 'channel_info_rhs.menu.notification_preferences', defaultMessage: 'Notification Preferences'})} + text={formatMessage({ + id: 'channel_info_rhs.menu.notification_preferences', + defaultMessage: 'Notification Preferences', + })} onClick={actions.openNotificationSettings} /> )} {showMembers && ( } - text={formatMessage({id: 'channel_info_rhs.menu.members', defaultMessage: 'Members'})} + text={formatMessage({ + id: 'channel_info_rhs.menu.members', + defaultMessage: 'Members', + })} opensSubpanel={true} badge={channelStats.member_count} onClick={() => actions.showChannelMembers(channel.id)} @@ -147,31 +170,24 @@ const Menu = ({channel, channelStats, isArchived, className, actions}: MenuProps )} } - text={formatMessage({id: 'channel_info_rhs.menu.pinned', defaultMessage: 'Pinned messages'})} + text={formatMessage({ + id: 'channel_info_rhs.menu.pinned', + defaultMessage: 'Pinned messages', + })} opensSubpanel={true} badge={channelStats?.pinnedpost_count} onClick={() => actions.showPinnedPosts(channel.id)} /> } - text={formatMessage({id: 'channel_info_rhs.menu.files', defaultMessage: 'Files'})} + text={formatMessage({ + id: 'channel_info_rhs.menu.files', + defaultMessage: 'Files', + })} opensSubpanel={true} badge={loadingStats ? : fileCount} onClick={() => actions.showChannelFiles(channel.id)} /> -
+ ); -}; - -const StyledMenu = styled(Menu)` - display: flex; - flex-direction: column; - align-items: flex-start; - padding: 16px 0; - - font-size: 14px; - line-height: 20px; - color: rgb(var(--center-channel-color-rgb)); -`; - -export default StyledMenu; +} diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index 4cf2cb70f1..9baf47447a 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -3261,6 +3261,7 @@ "channel_info_rhs.menu.members": "Members", "channel_info_rhs.menu.notification_preferences": "Notification Preferences", "channel_info_rhs.menu.pinned": "Pinned messages", + "channel_info_rhs.menu.title": "Channel Info Actions", "channel_info_rhs.top_buttons.add_people": "Add People", "channel_info_rhs.top_buttons.add_people.tooltip": "Add team members to this channel", "channel_info_rhs.top_buttons.copied": "Copied",