"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.HeaderRoomListMenu = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _icons = require("../../assets/icons");
var _reactRedux = require("react-redux");
var _chatSettingsSlice = require("../../roomStore/chatSettingsSlice");
var _MODAL_TYPES = require("../../helpers/constants/MODAL_TYPES");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const {
  width
} = _reactNative.Dimensions.get('window');
const HeaderRoomListMenu = ({
  isDrawerOpen,
  drawerAnimation,
  overlayAnimation,
  closeDrawer
}) => {
  const dispatch = (0, _reactRedux.useDispatch)();
  const drawerTranslateX = drawerAnimation.interpolate({
    inputRange: [0, 1],
    outputRange: [width, 0]
  });
  const menuOptions = (0, _react.useMemo)(() => [{
    label: 'New Chat',
    icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AddNewIcon, {
      color: "#8C8C8C"
    }),
    onClick: () => {
      dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.NEW_CHAT));
      console.log('New chat clicked');
    },
    styles: {
      color: '#141414'
    }
  }, {
    label: 'Profile',
    icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ProfileIcon, {
      color: "#8C8C8C"
    }),
    onClick: () => {
      dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.PROFILE));
      console.log('Profile clicked');
    }
  }, {
    label: 'Settings',
    icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SettingIcon, {
      color: "#8C8C8C"
    }),
    onClick: () => {
      dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.SETTINGS));
      console.log('Settings clicked');
    }
  }
  // {
  //   label: "Logout",
  //   onClick: handleLogout,
  // },
  ], []);
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
    children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
      style: [styles.drawer, {
        transform: [{
          translateX: drawerTranslateX
        }]
      }],
      children: menuOptions.map((option, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
        style: styles.menuItemWrapper,
        children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
          style: styles.menuItem,
          onPress: () => {
            option.onClick();
            closeDrawer();
          },
          children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
            style: {
              width: 22,
              alignItems: 'center'
            },
            children: option.icon
          }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
            style: [styles.label, option?.styles],
            children: option.label
          })]
        }), index < menuOptions.length - 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
          style: styles.divider
        })]
      }, index))
    }), isDrawerOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableWithoutFeedback, {
      onPress: closeDrawer,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
        style: [styles.overlay, {
          opacity: overlayAnimation
        }]
      })
    })]
  });
};
exports.HeaderRoomListMenu = HeaderRoomListMenu;
const styles = _reactNative.StyleSheet.create({
  menuItemWrapper: {
    display: 'flex',
    flexDirection: 'column'
  },
  menuItem: {
    flexDirection: 'row',
    alignItems: 'center',
    padding: 16
  },
  label: {
    fontSize: 16,
    marginLeft: 10
  },
  divider: {
    height: 1,
    width: '100%',
    backgroundColor: '#0052cd0d'
  },
  drawer: {
    position: 'absolute',
    top: 0,
    bottom: 0,
    right: 0,
    width: width * 0.7,
    backgroundColor: '#fff',
    padding: 20,
    shadowColor: '#000',
    shadowOpacity: 0.3,
    shadowOffset: {
      width: -2,
      height: 0
    },
    shadowRadius: 5,
    elevation: 5,
    zIndex: 999
  },
  drawerTitle: {
    fontSize: 20,
    fontWeight: 'bold',
    marginBottom: 20
  },
  drawerItem: {
    fontSize: 18,
    marginBottom: 10
  },
  overlay: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    flex: 1,
    width: '100%',
    height: '100%',
    backgroundColor: 'rgba(0, 0, 0, 0.5)'
  }
});
//# sourceMappingURL=HeaderRoomListMenu.js.map