diff --git a/web/sidebar/app-switcher.react.js b/web/sidebar/app-switcher.react.js index f486b7a69..963234f49 100644 --- a/web/sidebar/app-switcher.react.js +++ b/web/sidebar/app-switcher.react.js @@ -1,110 +1,110 @@ // @flow import classNames from 'classnames'; import invariant from 'invariant'; import * as React from 'react'; import { useDispatch } from 'react-redux'; import { mostRecentReadThreadSelector, unreadCount, } from 'lib/selectors/thread-selectors'; import { useSelector } from '../redux/redux-utils'; import SWMansionIcon from '../SWMansionIcon.react'; import getTitle from '../title/getTitle'; import { updateNavInfoActionType } from '../types/nav-types'; import css from './left-layout-aside.css'; function AppSwitcher(): React.Node { const activeChatThreadID = useSelector( state => state.navInfo.activeChatThreadID, ); const navInfo = useSelector(state => state.navInfo); const mostRecentReadThread = useSelector(mostRecentReadThreadSelector); const activeThreadCurrentlyUnread = useSelector( state => !activeChatThreadID || !!state.threadStore.threadInfos[activeChatThreadID]?.currentUser.unread, ); const viewerID = useSelector( state => state.currentUserInfo && state.currentUserInfo.id, ); const boundUnreadCount = useSelector(unreadCount); React.useEffect(() => { document.title = getTitle(boundUnreadCount); }, [boundUnreadCount]); const dispatch = useDispatch(); const onClickCalendar = React.useCallback( (event: SyntheticEvent) => { event.preventDefault(); dispatch({ type: updateNavInfoActionType, payload: { tab: 'calendar' }, }); }, [dispatch], ); const onClickChat = React.useCallback( (event: SyntheticEvent) => { event.preventDefault(); dispatch({ type: updateNavInfoActionType, payload: { tab: 'chat', activeChatThreadID: activeThreadCurrentlyUnread ? mostRecentReadThread : activeChatThreadID, }, }); }, [ dispatch, activeThreadCurrentlyUnread, mostRecentReadThread, activeChatThreadID, ], ); invariant(viewerID, 'should be set'); let chatBadge = null; if (boundUnreadCount > 0) { chatBadge =
{boundUnreadCount}
; } const calendarNavClasses = classNames({ [css['current-tab']]: navInfo.tab === 'calendar', }); const chatNavClasses = classNames({ [css['current-tab']]: navInfo.tab === 'chat', }); return ( -
+
); } export default AppSwitcher; diff --git a/web/sidebar/left-layout-aside.css b/web/sidebar/left-layout-aside.css index cd5b0481a..065a74e5c 100644 --- a/web/sidebar/left-layout-aside.css +++ b/web/sidebar/left-layout-aside.css @@ -1,65 +1,68 @@ .container { grid-area: sBar; background: var(--bg); color: var(--color); border-right: 1px solid var(--border-color); display: flex; - width: 100%; +} + +.appSwitcherContainer { + width: 160px; } .container ul { list-style-type: none; padding-top: 24px; padding-left: 28px; } .container ul li { cursor: pointer; padding-bottom: 24px; line-height: 0; } .container p { display: flex; align-content: center; } .container ul a { color: var(--color-disabled); } .container svg { color: var(--color-disabled); padding-right: 12px; } .chatIconWrapper { position: relative; } div.chatBadge { position: absolute; top: -4px; left: 13px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; color: var(--fg); background: var(--unread-bg); border-radius: 13px; font-size: 8px; line-height: 1.25; } p.current-tab svg { color: var(--fg); } p.current-tab a, p.current-tab svg { fill: var(--fg); color: var(--fg); }