Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3530010
D8260.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
D8260.diff
View Options
diff --git a/web/avatars/edit-user-avatar-menu.react.js b/web/avatars/edit-user-avatar-menu.react.js
--- a/web/avatars/edit-user-avatar-menu.react.js
+++ b/web/avatars/edit-user-avatar-menu.react.js
@@ -1,7 +1,9 @@
// @flow
+import invariant from 'invariant';
import * as React from 'react';
+import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js';
import SWMansionIcon from 'lib/components/SWMansionIcon.react.js';
import MenuItem from '../components/menu-item.react.js';
@@ -10,6 +12,16 @@
const editIcon = <SWMansionIcon icon="edit-2" size={20} />;
function EditUserAvatarMenu(): React.Node {
+ const editUserAvatarContext = React.useContext(EditUserAvatarContext);
+ invariant(editUserAvatarContext, 'editUserAvatarContext should be set');
+
+ const { setUserAvatar } = editUserAvatarContext;
+
+ const removeUserAvatar = React.useCallback(
+ () => setUserAvatar({ type: 'remove' }),
+ [setUserAvatar],
+ );
+
const emojiMenuItem = React.useMemo(
() => <MenuItem key="emoji" text="Select emoji" icon="emote-smile" />,
[],
@@ -19,8 +31,15 @@
[],
);
const removeMenuItem = React.useMemo(
- () => <MenuItem key="remove" text="Reset to default" icon="trash-2" />,
- [],
+ () => (
+ <MenuItem
+ key="remove"
+ text="Reset to default"
+ icon="trash-2"
+ onClick={removeUserAvatar}
+ />
+ ),
+ [removeUserAvatar],
);
const menuItems = React.useMemo(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 10:50 PM (11 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2703361
Default Alt Text
D8260.diff (1 KB)
Attached To
Mode
D8260: [web] Add `removeUserAvatar` to `EditUserAvatarMenu`
Attached
Detach File
Event Timeline
Log In to Comment