Page MenuHomePhorge

D6975.1765301647.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D6975.1765301647.diff

diff --git a/web/sidebar/community-drawer-item-handler.react.js b/web/sidebar/community-drawer-item-handler.react.js
--- a/web/sidebar/community-drawer-item-handler.react.js
+++ b/web/sidebar/community-drawer-item-handler.react.js
@@ -2,6 +2,8 @@
export type CommunityDrawerItemHandler = {
+onClick: (event: SyntheticEvent<HTMLElement>) => void,
+ +expanded: boolean,
+ +toggleExpanded: () => void,
+isActive: boolean,
};
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
@@ -1,9 +1,7 @@
// @flow
import * as React from 'react';
-import { useDispatch } from 'react-redux';
-import { updateCalendarCommunityFilter } from 'lib/actions/community-actions.js';
import type { ThreadInfo } from 'lib/types/thread-types.js';
import type { CommunityDrawerItemHandler } from './community-drawer-item-handler.react.js';
@@ -24,9 +22,14 @@
const onClick = useOnClickThread(threadInfo);
const isActive = useThreadIsActive(threadInfo.id);
+ const [expanded, setExpanded] = React.useState(false);
+ const toggleExpanded = React.useCallback(() => {
+ setExpanded(isExpanded => !isExpanded);
+ }, []);
+
const handler = React.useMemo(
- () => ({ onClick, isActive }),
- [isActive, onClick],
+ () => ({ onClick, isActive, expanded, toggleExpanded }),
+ [expanded, isActive, onClick, toggleExpanded],
);
React.useEffect(() => {
setHandler(handler);
@@ -35,21 +38,18 @@
return null;
}
+const onClick = () => {};
+const expanded = false;
+const toggleExpanded = () => {};
+
function CalendarDrawerItemHandler(props: HandlerProps): React.Node {
const { setHandler, threadInfo } = props;
- const dispatch = useDispatch();
-
- const onClick = React.useCallback(() => {
- dispatch({
- type: updateCalendarCommunityFilter,
- payload: threadInfo.id,
- });
- }, [dispatch, threadInfo.id]);
+
const isActive = useCommunityIsPickedCalendar(threadInfo.id);
const handler = React.useMemo(
- () => ({ onClick, isActive }),
- [onClick, isActive],
+ () => ({ onClick, isActive, expanded, toggleExpanded }),
+ [isActive],
);
React.useEffect(() => {
setHandler(handler);

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 9, 5:34 PM (13 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5856195
Default Alt Text
D6975.1765301647.diff (2 KB)

Event Timeline