diff --git a/web/avatars/edit-user-avatar-menu.react.js b/web/avatars/edit-user-avatar-menu.react.js
index 411ff1f41..cd448fc9d 100644
--- a/web/avatars/edit-user-avatar-menu.react.js
+++ b/web/avatars/edit-user-avatar-menu.react.js
@@ -1,34 +1,53 @@
// @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';
import Menu from '../components/menu.react.js';
const editIcon = ;
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(
() => ,
[],
);
const imageMenuItem = React.useMemo(
() => ,
[],
);
const removeMenuItem = React.useMemo(
- () => ,
- [],
+ () => (
+
+ ),
+ [removeUserAvatar],
);
const menuItems = React.useMemo(
() => [emojiMenuItem, imageMenuItem, removeMenuItem],
[emojiMenuItem, imageMenuItem, removeMenuItem],
);
return
;
}
export default EditUserAvatarMenu;