diff --git a/src/app/molecules/sidebar-avatar/SidebarAvatar.jsx b/src/app/molecules/sidebar-avatar/SidebarAvatar.jsx
index 39238a5..7b28145 100644
--- a/src/app/molecules/sidebar-avatar/SidebarAvatar.jsx
+++ b/src/app/molecules/sidebar-avatar/SidebarAvatar.jsx
@@ -4,16 +4,13 @@ import './SidebarAvatar.scss';
import { twemojify } from '../../../util/twemojify';
-import Avatar from '../../atoms/avatar/Avatar';
import Text from '../../atoms/text/Text';
import Tooltip from '../../atoms/tooltip/Tooltip';
-import NotificationBadge from '../../atoms/badge/NotificationBadge';
import { blurOnBubbling } from '../../atoms/button/script';
const SidebarAvatar = React.forwardRef(({
- tooltip, text, bgColor, imageSrc,
- iconSrc, active, onClick, onContextMenu,
- isUnread, notificationCount, isAlert,
+ tooltip, active, onClick, onContextMenu,
+ avatar, notificationBadge,
}, ref) => {
let activeClass = '';
if (active) activeClass = ' sidebar-avatar--active';
@@ -30,51 +27,26 @@ const SidebarAvatar = React.forwardRef(({
onClick={onClick}
onContextMenu={onContextMenu}
>
-
- { isUnread && (
-
- )}
+ {avatar}
+ {notificationBadge}
);
});
SidebarAvatar.defaultProps = {
- text: null,
- bgColor: 'transparent',
- iconSrc: null,
- imageSrc: null,
active: false,
onClick: null,
onContextMenu: null,
- isUnread: false,
- notificationCount: 0,
- isAlert: false,
+ notificationBadge: null,
};
SidebarAvatar.propTypes = {
tooltip: PropTypes.string.isRequired,
- text: PropTypes.string,
- bgColor: PropTypes.string,
- imageSrc: PropTypes.string,
- iconSrc: PropTypes.string,
active: PropTypes.bool,
onClick: PropTypes.func,
onContextMenu: PropTypes.func,
- isUnread: PropTypes.bool,
- notificationCount: PropTypes.oneOfType([
- PropTypes.string,
- PropTypes.number,
- ]),
- isAlert: PropTypes.bool,
+ avatar: PropTypes.node.isRequired,
+ notificationBadge: PropTypes.node,
};
export default SidebarAvatar;
diff --git a/src/app/organisms/navigation/SideBar.jsx b/src/app/organisms/navigation/SideBar.jsx
index 8ddcd3b..d811f61 100644
--- a/src/app/organisms/navigation/SideBar.jsx
+++ b/src/app/organisms/navigation/SideBar.jsx
@@ -10,6 +10,8 @@ import {
} from '../../../client/action/navigation';
import { abbreviateNumber, getEventCords } from '../../../util/common';
+import Avatar from '../../atoms/avatar/Avatar';
+import NotificationBadge from '../../atoms/badge/NotificationBadge';
import ScrollView from '../../atoms/scroll/ScrollView';
import SidebarAvatar from '../../molecules/sidebar-avatar/SidebarAvatar';
import SpaceOptions from '../../molecules/space-options/SpaceOptions';
@@ -52,9 +54,14 @@ function ProfileAvatarMenu() {
+ )}
/>
);
}
@@ -150,22 +157,28 @@ function SideBar() {
selectTab(cons.tabs.HOME)}
- tooltip="Home"
- iconSrc={HomeIC}
- isUnread={homeNoti !== null}
- notificationCount={homeNoti !== null ? abbreviateNumber(homeNoti.total) : 0}
- isAlert={homeNoti?.highlight > 0}
+ avatar={}
+ notificationBadge={homeNoti ? (
+ 0}
+ content={abbreviateNumber(homeNoti.total) || null}
+ />
+ ) : null}
/>
selectTab(cons.tabs.DIRECTS)}
- tooltip="People"
- iconSrc={UserIC}
- isUnread={dmsNoti !== null}
- notificationCount={dmsNoti !== null ? abbreviateNumber(dmsNoti.total) : 0}
- isAlert={dmsNoti?.highlight > 0}
+ avatar={}
+ notificationBadge={dmsNoti ? (
+ 0}
+ content={abbreviateNumber(dmsNoti.total) || null}
+ />
+ ) : null}
/>
@@ -179,22 +192,30 @@ function SideBar() {
active={selectedTab === sRoomId}
key={sRoomId}
tooltip={room.name}
- bgColor={colorMXID(room.roomId)}
- imageSrc={room.getAvatarUrl(initMatrix.matrixClient.baseUrl, 42, 42, 'crop') || null}
- text={room.name}
- isUnread={notifications.hasNoti(sRoomId)}
- notificationCount={abbreviateNumber(notifications.getTotalNoti(sRoomId))}
- isAlert={notifications.getHighlightNoti(sRoomId) !== 0}
onClick={() => selectTab(shortcut)}
onContextMenu={(e) => openSpaceOptions(e, sRoomId)}
+ avatar={(
+
+ )}
+ notificationBadge={notifications.hasNoti(sRoomId) ? (
+
0}
+ content={abbreviateNumber(notifications.getTotalNoti(sRoomId)) || null}
+ />
+ ) : null}
/>
);
})
}
openShortcutSpaces()}
tooltip="Pin spaces"
- iconSrc={AddPinIC}
+ onClick={() => openShortcutSpaces()}
+ avatar={}
/>
@@ -204,18 +225,16 @@ function SideBar() {
openSearch()}
tooltip="Search"
- iconSrc={SearchIC}
+ onClick={() => openSearch()}
+ avatar={}
/>
{ totalInvites !== 0 && (
openInviteList()}
tooltip="Invites"
- iconSrc={InviteIC}
+ onClick={() => openInviteList()}
+ avatar={}
+ notificationBadge={}
/>
)}