Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32322667
D6975.1765301647.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6975.1765301647.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6975: [web] Add expanded and toggleExpanded to CommunityDrawerItemHandler type
Attached
Detach File
Event Timeline
Log In to Comment