@sendbird/uikit-react
Version:
Sendbird UIKit for React: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.
95 lines (91 loc) • 5.59 kB
JavaScript
import React__default, { useContext } from 'react';
import { useOpenChannelSettingsContext } from '../context.js';
import { L as LocalizationContext } from '../../chunks/bundle-DxLnjDoJ.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../chunks/bundle-FZ_FdxZT.js';
import Icon, { IconTypes } from '../../ui/Icon.js';
import PlaceHolder, { PlaceHolderTypes } from '../../ui/PlaceHolder.js';
import { OperatorUI } from './OperatorUI.js';
import { P as ParticipantList } from '../../chunks/bundle-Dzg7JewE.js';
import { u as useSendbird } from '../../chunks/bundle-BnaoVUUl.js';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-tDk7wyaM.js';
import '../../chunks/bundle-CSjCAZib.js';
import '../../chunks/bundle-DlZj_j5B.js';
import '../../chunks/bundle-C1jTnXNH.js';
import '../../chunks/bundle-C8kxBudB.js';
import '@sendbird/chat';
import '@sendbird/chat/groupChannel';
import '../../chunks/bundle-Dhutxl0X.js';
import '../../chunks/bundle-D89Qj0P4.js';
import '../../chunks/bundle-CaW4IP0_.js';
import '../../ui/Loader.js';
import './OpenChannelProfile.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-Bv6iXkjg.js';
import '../../ui/OpenChannelAvatar.js';
import '../../chunks/bundle-Dgt7lb2O.js';
import '../../ui/ImageRenderer.js';
import '../../chunks/bundle-h43SVTxb.js';
import '../../chunks/bundle-DGOBflIQ.js';
import './EditDetailsModal.js';
import '../../chunks/bundle-D9lZlE3H.js';
import '../../chunks/bundle-BDItDVZl.js';
import 'react-dom';
import '../../chunks/bundle-DWJPyrDa.js';
import '../../ui/IconButton.js';
import '../../ui/Button.js';
import '../../ui/Input.js';
import '../../ui/Accordion.js';
import '../../ui/AccordionGroup.js';
import '../../chunks/bundle-BRB1saAI.js';
import '../../ui/SortByRow.js';
import '../../chunks/bundle-C5Cl3Igw.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-OJHU7Q3U.js';
import '../../chunks/bundle-DZaN4z9l.js';
import '../../chunks/bundle-0bJlK18Z.js';
import '../../ui/UserListItem.js';
import '../../ui/MutedAvatarOverlay.js';
import '../../ui/Checkbox.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
function InvalidChannel(_a) {
var onCloseClick = _a.onCloseClick;
var stringSet = useContext(LocalizationContext).stringSet;
return (React__default.createElement("div", { className: "sendbird-openchannel-settings" },
React__default.createElement("div", { className: "sendbird-openchannel-settings__header" },
React__default.createElement(Label, { type: LabelTypography.H_2, color: LabelColors.ONBACKGROUND_1 }, stringSet.CHANNEL_SETTING__HEADER__TITLE),
React__default.createElement(Icon, { type: IconTypes.CLOSE, className: "sendbird-openchannel-settings__close-icon", height: "24px", width: "24px", onClick: function () {
onCloseClick === null || onCloseClick === void 0 ? void 0 : onCloseClick();
} })),
React__default.createElement("div", { className: "sendbird-openchannel-settings__placeholder" },
React__default.createElement(PlaceHolder, { type: PlaceHolderTypes.WRONG }))));
}
var OpenChannelUI = function (_a) {
var _b, _c, _d;
var renderOperatorUI = _a.renderOperatorUI, renderParticipantList = _a.renderParticipantList;
var _e = useOpenChannelSettingsContext(), channel = _e.channel, onCloseClick = _e.onCloseClick, isChannelInitialized = _e.isChannelInitialized;
var state = useSendbird().state;
var logger = (_b = state === null || state === void 0 ? void 0 : state.config) === null || _b === void 0 ? void 0 : _b.logger;
var user = (_d = (_c = state === null || state === void 0 ? void 0 : state.stores) === null || _c === void 0 ? void 0 : _c.userStore) === null || _d === void 0 ? void 0 : _d.user;
var stringSet = useContext(LocalizationContext).stringSet;
if (isChannelInitialized && !channel) {
return (React__default.createElement(InvalidChannel, { onCloseClick: function () {
logger.info('OpenChannelSettings: Click close');
if (onCloseClick) {
onCloseClick();
}
} }));
}
return (React__default.createElement("div", { className: 'sendbird-openchannel-settings' },
(channel === null || channel === void 0 ? void 0 : channel.isOperator(user)) && ((renderOperatorUI === null || renderOperatorUI === void 0 ? void 0 : renderOperatorUI()) || (React__default.createElement(OperatorUI, null))),
!(channel === null || channel === void 0 ? void 0 : channel.isOperator(user)) && (React__default.createElement("div", { className: "sendbird-openchannel-settings__participant" },
React__default.createElement("div", { className: "sendbird-openchannel-settings__header" },
React__default.createElement(Label, { type: LabelTypography.H_2, color: LabelColors.ONBACKGROUND_1 }, stringSet.OPEN_CHANNEL_SETTINGS__PARTICIPANTS_TITLE),
React__default.createElement(Icon, { type: IconTypes.CLOSE, className: "sendbird-openchannel-settings__close-icon", height: "24px", width: "24px", onClick: function () {
onCloseClick === null || onCloseClick === void 0 ? void 0 : onCloseClick();
} })),
(renderParticipantList === null || renderParticipantList === void 0 ? void 0 : renderParticipantList()) || (React__default.createElement(ParticipantList, null))))));
};
export { OpenChannelUI as default };
//# sourceMappingURL=OpenChannelSettingsUI.js.map