function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import { View } from 'react-native';
import MenuButton from '../../../../../elements/MenuButton';
import MenuAction from '../../../../../elements/MenuAction';
import { CopyLinkAction } from '../../../../../elements/CopyLinkAction';
import { ShareAction } from '../../../../../elements/ShareAction';
import { PageID } from '../../../../../enums';
import { useMenu } from './hooks/useMenu';
export function Menu({
  userId,
  displayName
}) {
  const {
    actions,
    shareLink,
    menuButtonId,
    openBottomSheet,
    bottomSheetHeight
  } = useMenu({
    userId,
    displayName
  });
  const items = [...actions.map(({
    visible,
    ...action
  }) => ({
    visible,
    action: /*#__PURE__*/React.createElement(MenuAction, _extends({
      gap: "small"
    }, action, {
      key: action.label
    }))
  })), {
    visible: !!shareLink,
    action: /*#__PURE__*/React.createElement(CopyLinkAction, {
      key: "copy",
      link: shareLink ?? '',
      pageId: PageID.user_profile_page
    })
  }, {
    visible: !!shareLink,
    action: /*#__PURE__*/React.createElement(ShareAction, {
      key: "share",
      link: shareLink ?? '',
      pageId: PageID.user_profile_page
    })
  }].filter(({
    visible
  }) => visible);
  return /*#__PURE__*/React.createElement(MenuButton, {
    testID: menuButtonId,
    accessibilityLabel: "User profile menu",
    onPress: () => {
      openBottomSheet({
        height: bottomSheetHeight[items.length],
        content: /*#__PURE__*/React.createElement(View, null, items.map(({
          action
        }) => action))
      });
    }
  });
}
//# sourceMappingURL=Menu.js.map