import React__default, { useState, useContext } from 'react';
import { a as LocalizationContext } from '../../LocalizationContext-9c54e783.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../index-4111594a.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-1f18348a.js';
import '../../index-a9ddd0f5.js';
import 'prop-types';
import '../../color-3bac434a.js';
import '../../ui/Avatar.js';
import '../../ui/ImageRenderer.js';
import '../../ui/Icon.js';
import '../../uuid-48baadaf.js';
import '../../utils-447a922e.js';
import '../../topics-d8d10f83.js';
import '../../ui/Modal.js';
import 'react-dom';
import '../../index-2a938266.js';
import '../../ui/Button.js';
import '../../ui/IconButton.js';
import '../../_rollupPluginBabelHelpers-b2d9bfc5.js';
import '../../MediaQueryContext-1988a4bc.js';
import '../../ui/Input.js';
import '../../withSendbird.js';
import '@sendbird/chat/openChannel';
import '../../UserProfileContext-a8aa4c0f.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
