Changeset View
Changeset View
Standalone View
Standalone View
web/navigation-panels/app-switcher.react.js
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | if (boundUnreadCount > 0) { | ||||
chatBadge = <span className={css.chatBadge}>{boundUnreadCount}</span>; | chatBadge = <span className={css.chatBadge}>{boundUnreadCount}</span>; | ||||
} | } | ||||
const chatNavigationItem = React.useMemo( | const chatNavigationItem = React.useMemo( | ||||
() => ( | () => ( | ||||
<NavigationPanel.Item tab="chat"> | <NavigationPanel.Item tab="chat"> | ||||
<a className={css.navigationPanelTab} onClick={onClickChat}> | <a className={css.navigationPanelTab} onClick={onClickChat}> | ||||
<span className={css.chatIconWrapper}> | <span className={css.chatIconWrapper}> | ||||
<SWMansionIcon icon="message-square" size={24} /> | <SWMansionIcon icon="message-square" size={20} /> | ||||
{chatBadge} | {chatBadge} | ||||
</span> | </span> | ||||
<p>Chat</p> | <p>Chat</p> | ||||
</a> | </a> | ||||
</NavigationPanel.Item> | </NavigationPanel.Item> | ||||
), | ), | ||||
[chatBadge, onClickChat], | [chatBadge, onClickChat], | ||||
); | ); | ||||
Show All 12 Lines | function AppSwitcher(): React.Node { | ||||
const isCalendarEnabled = useSelector(state => state.enabledApps.calendar); | const isCalendarEnabled = useSelector(state => state.enabledApps.calendar); | ||||
const calendarNavigationItem = React.useMemo(() => { | const calendarNavigationItem = React.useMemo(() => { | ||||
if (!isCalendarEnabled) { | if (!isCalendarEnabled) { | ||||
return null; | return null; | ||||
} | } | ||||
return ( | return ( | ||||
<NavigationPanel.Item tab="calendar"> | <NavigationPanel.Item tab="calendar"> | ||||
<a className={css.navigationPanelTab} onClick={onClickCalendar}> | <a className={css.navigationPanelTab} onClick={onClickCalendar}> | ||||
<SWMansionIcon icon="calendar" size={24} /> | <SWMansionIcon icon="calendar" size={20} /> | ||||
<p>Calendar</p> | <p>Calendar</p> | ||||
</a> | </a> | ||||
</NavigationPanel.Item> | </NavigationPanel.Item> | ||||
); | ); | ||||
}, [isCalendarEnabled, onClickCalendar]); | }, [isCalendarEnabled, onClickCalendar]); | ||||
return ( | return ( | ||||
<NavigationPanel.Container tabSelector={navTabSelector} horizontal={true}> | <NavigationPanel.Container tabSelector={navTabSelector} horizontal={true}> | ||||
{chatNavigationItem} | {chatNavigationItem} | ||||
{calendarNavigationItem} | {calendarNavigationItem} | ||||
</NavigationPanel.Container> | </NavigationPanel.Container> | ||||
); | ); | ||||
} | } | ||||
export default AppSwitcher; | export default AppSwitcher; |