Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3488298
D3284.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3284.diff
View Options
diff --git a/web/sidebar/app-switcher.react.js b/web/sidebar/app-switcher.react.js
--- a/web/sidebar/app-switcher.react.js
+++ b/web/sidebar/app-switcher.react.js
@@ -32,6 +32,7 @@
);
const boundUnreadCount = useSelector(unreadCount);
+ const isCalendarEnabled = useSelector(state => state.enabledApps.calendar);
React.useEffect(() => {
document.title = getTitle(boundUnreadCount);
@@ -90,9 +91,6 @@
chatBadge = <div className={css.chatBadge}>{boundUnreadCount}</div>;
}
- const calendarNavClasses = classNames({
- [css['current-tab']]: navInfo.tab === 'calendar',
- });
const chatNavClasses = classNames({
[css['current-tab']]: navInfo.tab === 'chat',
});
@@ -100,6 +98,23 @@
[css['current-tab']]: navInfo.tab === 'apps',
});
+ const calendarLink = React.useMemo(() => {
+ if (!isCalendarEnabled) {
+ return null;
+ }
+ const calendarNavClasses = classNames({
+ [css['current-tab']]: navInfo.tab === 'calendar',
+ });
+ return (
+ <li>
+ <p className={calendarNavClasses}>
+ <SWMansionIcon icon="calendar" size={24} />
+ <a onClick={onClickCalendar}>Calendar</a>
+ </p>
+ </li>
+ );
+ }, [isCalendarEnabled, navInfo.tab, onClickCalendar]);
+
return (
<div className={css.appSwitcherContainer}>
<ul>
@@ -112,12 +127,7 @@
<a onClick={onClickChat}>Chat</a>
</p>
</li>
- <li>
- <p className={calendarNavClasses}>
- <SWMansionIcon icon="calendar" size={24} />
- <a onClick={onClickCalendar}>Calendar</a>
- </p>
- </li>
+ {calendarLink}
<li>
<p className={appsNavClasses}>
<SWMansionIcon icon="wrench" size={24} />
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 9:36 AM (21 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2676590
Default Alt Text
D3284.diff (1 KB)
Attached To
Mode
D3284: [web] Render calendar navigation tab conditionally
Attached
Detach File
Event Timeline
Log In to Comment