import React__default, { useState, useContext } from 'react';
import { a as LocalizationContext } from '../../LocalizationContext-1701e5c8.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../index-f50d7ab0.js';
import TextButton from '../../ui/TextButton.js';
import ChannelAvatar from '../../ui/OpenChannelAvatar.js';
import EditDetails from './EditDetailsModal.js';
import useSendbirdStateContext from '../../useSendbirdStateContext.js';
import { useOpenChannelSettingsContext } from '../context.js';
import '../../stringSet-e9bb0333.js';
import '../../index-ff8f2f61.js';
import 'prop-types';
import '../../color-ea3bf5b8.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../ui/Icon.js';
import '../../uuid-8b344dd2.js';
import '../../utils-cd7ab927.js';
import '../../topics-0b30f52b.js';
import '../../ui/Modal.js';
import 'react-dom';
import '../../index-44c86e58.js';
import '../../ui/Button.js';
import '../../ui/IconButton.js';
import '../../_rollupPluginBabelHelpers-cc035350.js';
import '../../MediaQueryContext-e5b401d0.js';
import '../../ui/Input.js';
import '../../withSendbird.js';
import '@sendbird/chat/openChannel';
import '../../UserProfileContext-74e9a128.js';

function ChannelProfile() {
  var _globalState$config, _globalState$config2;
  const globalState = useSendbirdStateContext();
  const disabled = !(globalState !== null && globalState !== void 0 && (_globalState$config = globalState.config) !== null && _globalState$config !== void 0 && _globalState$config.isOnline);
  const theme = globalState === null || globalState === void 0 ? void 0 : (_globalState$config2 = globalState.config) === null || _globalState$config2 === void 0 ? void 0 : _globalState$config2.theme;
  const {
    channel
  } = useOpenChannelSettingsContext();
  const title = channel === null || channel === void 0 ? void 0 : channel.name;
  const [showModal, setShowModal] = useState(false);
  const {
    stringSet
  } = useContext(LocalizationContext);
  return /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-openchannel-profile"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-openchannel-profile--inner"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-openchannel-profile__avatar"
  }, /*#__PURE__*/React__default.createElement(ChannelAvatar, {
    channel: channel,
    theme: theme,
    height: 80,
    width: 80
  })), /*#__PURE__*/React__default.createElement(Label, {
    type: LabelTypography.SUBTITLE_2,
    color: LabelColors.ONBACKGROUND_1,
    className: "sendbird-openchannel-profile__title"
  }, title || stringSet.OPEN_CHANNEL_SETTINGS__NO_TITLE), /*#__PURE__*/React__default.createElement(TextButton, {
    disabled: disabled,
    className: "sendbird-openchannel-profile__edit",
    onClick: () => {
      if (disabled) {
        return;
      }
      setShowModal(true);
    },
    disableUnderline: true
  }, /*#__PURE__*/React__default.createElement(Label, {
    type: LabelTypography.BUTTON_1,
    color: disabled ? LabelColors.ONBACKGROUND_2 : LabelColors.PRIMARY
  }, stringSet.CHANNEL_SETTING__PROFILE__EDIT)), showModal && /*#__PURE__*/React__default.createElement(EditDetails, {
    onCancel: () => setShowModal(false)
  })));
}

export { ChannelProfile as default };
//# sourceMappingURL=OpenChannelProfile.js.map
