Page MenuHomePhabricator

D6646.id22299.diff
No OneTemporary

D6646.id22299.diff

diff --git a/web/selectors/calendar-selectors.js b/web/selectors/calendar-selectors.js
--- a/web/selectors/calendar-selectors.js
+++ b/web/selectors/calendar-selectors.js
@@ -54,9 +54,15 @@
},
);
+function useCommunityIsPicked(communityID: string): boolean {
+ const communityIDFilter = useSelector(state => state.communityIDFilter);
+ return communityID === communityIDFilter;
+}
+
export {
useFilterThreadInfos,
useFilterThreadSearchIndex,
threadIDsBelongingToCommunitySelector,
threadIDsBelongingToCommunity,
+ useCommunityIsPicked,
};
diff --git a/web/sidebar/community-drawer-item-handlers.react.js b/web/sidebar/community-drawer-item-handlers.react.js
--- a/web/sidebar/community-drawer-item-handlers.react.js
+++ b/web/sidebar/community-drawer-item-handlers.react.js
@@ -3,12 +3,10 @@
import * as React from 'react';
import { useDispatch } from 'react-redux';
-import {
- updateCalendarThreadFilter,
- calendarThreadFilterTypes,
-} from 'lib/types/filter-types';
import type { ThreadInfo } from 'lib/types/thread-types';
+import { updateCalendarCommunityFilter } from '../redux/action-types';
+import { useCommunityIsPicked } from '../selectors/calendar-selectors';
import {
useOnClickThread,
useThreadIsActive,
@@ -41,18 +39,13 @@
const { setHandler, threadInfo } = props;
const dispatch = useDispatch();
- const onClick = React.useCallback(
- () =>
- dispatch({
- type: updateCalendarThreadFilter,
- payload: {
- type: calendarThreadFilterTypes.THREAD_LIST,
- threadIDs: [threadInfo.id],
- },
- }),
- [dispatch, threadInfo.id],
- );
- const isActive = false;
+ const onClick = React.useCallback(() => {
+ dispatch({
+ type: updateCalendarCommunityFilter,
+ payload: threadInfo.id,
+ });
+ }, [dispatch, threadInfo.id]);
+ const isActive = useCommunityIsPicked(threadInfo.id);
const handler = React.useMemo(() => ({ onClick, isActive }), [
onClick,

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 5:45 AM (17 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686513
Default Alt Text
D6646.id22299.diff (1 KB)

Event Timeline