@ermis-network/ermis-chat-react 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/index.cjs +752 -333
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +382 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +88 -1
- package/dist/index.d.ts +88 -1
- package/dist/index.mjs +691 -274
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelInfo/AddMemberModal.tsx +48 -174
- package/src/components/ChannelList.tsx +5 -0
- package/src/components/CreateChannelModal.tsx +274 -0
- package/src/components/UserPicker.tsx +377 -0
- package/src/index.ts +11 -0
- package/src/styles/_create-channel-modal.css +183 -0
- package/src/styles/_user-picker.css +268 -0
- package/src/styles/index.css +3 -0
- package/src/types.ts +100 -0
package/dist/index.cjs
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
ChannelItem: () => ChannelItem,
|
|
39
39
|
ChannelList: () => ChannelList,
|
|
40
40
|
ChatProvider: () => ChatProvider,
|
|
41
|
+
CreateChannelModal: () => CreateChannelModal,
|
|
41
42
|
DefaultChannelInfoActions: () => DefaultChannelInfoActions,
|
|
42
43
|
DefaultChannelInfoCover: () => DefaultChannelInfoCover,
|
|
43
44
|
DefaultChannelInfoHeader: () => DefaultChannelInfoHeader,
|
|
@@ -65,6 +66,7 @@ __export(index_exports, {
|
|
|
65
66
|
SystemMessage: () => SystemMessage,
|
|
66
67
|
SystemMessageItem: () => SystemMessageItem,
|
|
67
68
|
TypingIndicator: () => TypingIndicator,
|
|
69
|
+
UserPicker: () => UserPicker,
|
|
68
70
|
VirtualMessageList: () => VirtualMessageList,
|
|
69
71
|
closeAllDropdowns: () => closeAllDropdowns,
|
|
70
72
|
dedupMessages: () => dedupMessages,
|
|
@@ -744,6 +746,9 @@ function getLastMessagePreview(channel) {
|
|
|
744
746
|
const userMap = buildUserMap(channel.state);
|
|
745
747
|
return { text: (0, import_ermis_chat_sdk.parseSignalMessage)(rawText, userMap), user: "" };
|
|
746
748
|
}
|
|
749
|
+
if (msgType === "sticker" || lastMsg.sticker_url) {
|
|
750
|
+
return { text: "Sticker", user: lastMsg.user?.name || lastMsg.user_id || "" };
|
|
751
|
+
}
|
|
747
752
|
let displayText = rawText;
|
|
748
753
|
if (!displayText && lastMsg.attachments && lastMsg.attachments.length > 0) {
|
|
749
754
|
const att = lastMsg.attachments[0];
|
|
@@ -4481,7 +4486,7 @@ var MessageInput = import_react42.default.memo(({
|
|
|
4481
4486
|
MessageInput.displayName = "MessageInput";
|
|
4482
4487
|
|
|
4483
4488
|
// src/components/ChannelInfo/ChannelInfo.tsx
|
|
4484
|
-
var
|
|
4489
|
+
var import_react55 = __toESM(require("react"));
|
|
4485
4490
|
|
|
4486
4491
|
// src/components/ChannelInfo/ChannelInfoTabs.tsx
|
|
4487
4492
|
var import_react48 = __toESM(require("react"));
|
|
@@ -5017,37 +5022,49 @@ var DefaultChannelInfoTabs = import_react48.default.memo(({
|
|
|
5017
5022
|
});
|
|
5018
5023
|
|
|
5019
5024
|
// src/components/ChannelInfo/AddMemberModal.tsx
|
|
5025
|
+
var import_react50 = require("react");
|
|
5026
|
+
|
|
5027
|
+
// src/components/UserPicker.tsx
|
|
5020
5028
|
var import_react49 = __toESM(require("react"));
|
|
5021
5029
|
var import_virtua5 = require("virtua");
|
|
5022
5030
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5023
|
-
var
|
|
5024
|
-
var
|
|
5025
|
-
var
|
|
5031
|
+
var DEFAULT_PAGE_SIZE = 30;
|
|
5032
|
+
var SEARCH_DEBOUNCE_MS = 500;
|
|
5033
|
+
var LIST_STYLE = { height: "100%" };
|
|
5034
|
+
var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("polyline", { points: "20 6 9 17 4 12" }) });
|
|
5026
5035
|
var DefaultUserItem = import_react49.default.memo(({
|
|
5027
5036
|
user,
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
"
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5037
|
+
selected,
|
|
5038
|
+
disabled,
|
|
5039
|
+
mode,
|
|
5040
|
+
onToggle,
|
|
5041
|
+
AvatarComponent
|
|
5042
|
+
}) => {
|
|
5043
|
+
const handleClick = (0, import_react49.useCallback)(() => {
|
|
5044
|
+
if (!disabled) onToggle(user);
|
|
5045
|
+
}, [disabled, onToggle, user]);
|
|
5046
|
+
const inputClass = [
|
|
5047
|
+
"ermis-user-picker__input",
|
|
5048
|
+
mode === "radio" ? "ermis-user-picker__input--radio" : "ermis-user-picker__input--checkbox",
|
|
5049
|
+
selected ? "ermis-user-picker__input--checked" : ""
|
|
5050
|
+
].join(" ");
|
|
5051
|
+
const itemClass = [
|
|
5052
|
+
"ermis-user-picker__item",
|
|
5053
|
+
selected ? "ermis-user-picker__item--selected" : "",
|
|
5054
|
+
disabled ? "ermis-user-picker__item--disabled" : ""
|
|
5055
|
+
].join(" ");
|
|
5056
|
+
const detail = user.email || user.phone || "";
|
|
5057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: itemClass, onClick: handleClick, role: "option", "aria-selected": selected, children: [
|
|
5058
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: inputClass, children: selected && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CheckIcon, {}) }),
|
|
5059
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AvatarComponent, { image: user.avatar, name: user.name || user.id, size: 36 }),
|
|
5060
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ermis-user-picker__info", children: [
|
|
5061
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ermis-user-picker__name", children: user.name || user.id }),
|
|
5062
|
+
detail && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ermis-user-picker__detail", children: detail })
|
|
5063
|
+
] })
|
|
5064
|
+
] });
|
|
5065
|
+
});
|
|
5049
5066
|
DefaultUserItem.displayName = "DefaultUserItem";
|
|
5050
|
-
var DefaultSearchInput = ({ value, onChange, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ermis-
|
|
5067
|
+
var DefaultSearchInput = ({ value, onChange, placeholder }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ermis-user-picker__search", children: [
|
|
5051
5068
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5052
5069
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
5053
5070
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
@@ -5063,33 +5080,69 @@ var DefaultSearchInput = ({ value, onChange, placeholder }) => /* @__PURE__ */ (
|
|
|
5063
5080
|
}
|
|
5064
5081
|
)
|
|
5065
5082
|
] });
|
|
5066
|
-
var
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
onClose,
|
|
5083
|
+
var DefaultSelectedBox = import_react49.default.memo(({
|
|
5084
|
+
users,
|
|
5085
|
+
onRemove,
|
|
5070
5086
|
AvatarComponent,
|
|
5071
|
-
|
|
5087
|
+
emptyLabel
|
|
5088
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ermis-user-picker__selected-box", children: [
|
|
5089
|
+
users.length === 0 && emptyLabel && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ermis-user-picker__selected-empty", children: emptyLabel }),
|
|
5090
|
+
users.map((u) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ermis-user-picker__chip", children: [
|
|
5091
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AvatarComponent, { image: u.avatar, name: u.name || u.id, size: 20 }),
|
|
5092
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ermis-user-picker__chip-name", children: u.name || u.id }),
|
|
5093
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5094
|
+
"button",
|
|
5095
|
+
{
|
|
5096
|
+
className: "ermis-user-picker__chip-remove",
|
|
5097
|
+
onClick: () => onRemove(u.id),
|
|
5098
|
+
"aria-label": `Remove ${u.name || u.id}`,
|
|
5099
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5100
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
5101
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
5102
|
+
] })
|
|
5103
|
+
}
|
|
5104
|
+
)
|
|
5105
|
+
] }, u.id))
|
|
5106
|
+
] }));
|
|
5107
|
+
DefaultSelectedBox.displayName = "DefaultSelectedBox";
|
|
5108
|
+
var UserPicker = ({
|
|
5109
|
+
mode,
|
|
5110
|
+
onSelectionChange,
|
|
5111
|
+
excludeUserIds,
|
|
5112
|
+
initialSelectedUsers,
|
|
5113
|
+
pageSize = DEFAULT_PAGE_SIZE,
|
|
5114
|
+
AvatarComponent = Avatar,
|
|
5115
|
+
UserItemComponent,
|
|
5116
|
+
SelectedBoxComponent,
|
|
5117
|
+
SearchInputComponent,
|
|
5072
5118
|
searchPlaceholder = "Search by name, email or phone...",
|
|
5073
5119
|
loadingText = "Loading users...",
|
|
5074
5120
|
emptyText = "No users found.",
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
addedLabel = "Added",
|
|
5078
|
-
UserItemComponent,
|
|
5079
|
-
SearchInputComponent
|
|
5121
|
+
loadingMoreText = "Loading more...",
|
|
5122
|
+
selectedEmptyLabel
|
|
5080
5123
|
}) => {
|
|
5081
5124
|
const { client } = useChatClient();
|
|
5082
|
-
const
|
|
5125
|
+
const currentUserId = client?.userID;
|
|
5126
|
+
const [allUsers, setAllUsers] = (0, import_react49.useState)([]);
|
|
5127
|
+
const [page, setPage] = (0, import_react49.useState)(1);
|
|
5128
|
+
const [hasMore, setHasMore] = (0, import_react49.useState)(true);
|
|
5129
|
+
const [loading, setLoading] = (0, import_react49.useState)(true);
|
|
5130
|
+
const [loadingMore, setLoadingMore] = (0, import_react49.useState)(false);
|
|
5083
5131
|
const [remoteUsers, setRemoteUsers] = (0, import_react49.useState)([]);
|
|
5132
|
+
const [isSearching, setIsSearching] = (0, import_react49.useState)(false);
|
|
5084
5133
|
const [searchInput, setSearchInput] = (0, import_react49.useState)("");
|
|
5085
5134
|
const [search, setSearch] = (0, import_react49.useState)("");
|
|
5086
5135
|
const [isPendingFilter, startTransition] = (0, import_react49.useTransition)();
|
|
5087
|
-
const [
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5136
|
+
const [selectedMap, setSelectedMap] = (0, import_react49.useState)(() => {
|
|
5137
|
+
const map = /* @__PURE__ */ new Map();
|
|
5138
|
+
initialSelectedUsers?.forEach((u) => map.set(u.id, u));
|
|
5139
|
+
return map;
|
|
5140
|
+
});
|
|
5141
|
+
const vlistRef = (0, import_react49.useRef)(null);
|
|
5091
5142
|
const UserRow = UserItemComponent || DefaultUserItem;
|
|
5092
5143
|
const SearchInput = SearchInputComponent || DefaultSearchInput;
|
|
5144
|
+
const SelectedBox = SelectedBoxComponent || DefaultSelectedBox;
|
|
5145
|
+
const excludeSet = (0, import_react49.useMemo)(() => new Set(excludeUserIds || []), [excludeUserIds]);
|
|
5093
5146
|
const handleSearchChange = (0, import_react49.useCallback)((e) => {
|
|
5094
5147
|
const val = e.target.value;
|
|
5095
5148
|
setSearchInput(val);
|
|
@@ -5102,12 +5155,15 @@ var AddMemberModal = ({
|
|
|
5102
5155
|
const fetchUsers = async () => {
|
|
5103
5156
|
if (!client) return;
|
|
5104
5157
|
try {
|
|
5105
|
-
|
|
5158
|
+
setLoading(true);
|
|
5159
|
+
const response = await client.queryUsers(String(pageSize), 1);
|
|
5106
5160
|
if (active && response.data) {
|
|
5107
|
-
|
|
5161
|
+
setAllUsers(response.data);
|
|
5162
|
+
setHasMore(response.data.length >= pageSize);
|
|
5163
|
+
setPage(1);
|
|
5108
5164
|
}
|
|
5109
5165
|
} catch (err) {
|
|
5110
|
-
console.error("Error fetching users:", err);
|
|
5166
|
+
console.error("[UserPicker] Error fetching users:", err);
|
|
5111
5167
|
} finally {
|
|
5112
5168
|
if (active) setLoading(false);
|
|
5113
5169
|
}
|
|
@@ -5116,17 +5172,38 @@ var AddMemberModal = ({
|
|
|
5116
5172
|
return () => {
|
|
5117
5173
|
active = false;
|
|
5118
5174
|
};
|
|
5119
|
-
}, [client]);
|
|
5175
|
+
}, [client, pageSize]);
|
|
5176
|
+
const loadMore = (0, import_react49.useCallback)(async () => {
|
|
5177
|
+
if (!client || loadingMore || !hasMore || search.trim()) return;
|
|
5178
|
+
const nextPage = page + 1;
|
|
5179
|
+
setLoadingMore(true);
|
|
5180
|
+
try {
|
|
5181
|
+
const response = await client.queryUsers(String(pageSize), nextPage);
|
|
5182
|
+
if (response.data) {
|
|
5183
|
+
setAllUsers((prev) => {
|
|
5184
|
+
const existingIds = new Set(prev.map((u) => u.id));
|
|
5185
|
+
const newUsers = response.data.filter((u) => !existingIds.has(u.id));
|
|
5186
|
+
return [...prev, ...newUsers];
|
|
5187
|
+
});
|
|
5188
|
+
setHasMore(response.data.length >= pageSize);
|
|
5189
|
+
setPage(nextPage);
|
|
5190
|
+
}
|
|
5191
|
+
} catch (err) {
|
|
5192
|
+
console.error("[UserPicker] Error loading more users:", err);
|
|
5193
|
+
} finally {
|
|
5194
|
+
setLoadingMore(false);
|
|
5195
|
+
}
|
|
5196
|
+
}, [client, loadingMore, hasMore, page, pageSize, search]);
|
|
5120
5197
|
const localFilteredUsers = (0, import_react49.useMemo)(() => {
|
|
5121
|
-
if (!search.trim()) return initialUsers;
|
|
5122
5198
|
const term = search.toLowerCase().trim();
|
|
5123
|
-
|
|
5199
|
+
if (!term) return allUsers;
|
|
5200
|
+
return allUsers.filter((u) => {
|
|
5201
|
+
const name = (u.name || "").toLowerCase();
|
|
5124
5202
|
const email = (u.email || "").toLowerCase();
|
|
5125
5203
|
const phone = (u.phone || "").toLowerCase();
|
|
5126
|
-
|
|
5127
|
-
return email.includes(term) || phone.includes(term) || name.includes(term);
|
|
5204
|
+
return name.includes(term) || email.includes(term) || phone.includes(term);
|
|
5128
5205
|
});
|
|
5129
|
-
}, [search,
|
|
5206
|
+
}, [search, allUsers]);
|
|
5130
5207
|
(0, import_react49.useEffect)(() => {
|
|
5131
5208
|
if (!search.trim() || localFilteredUsers.length > 0) {
|
|
5132
5209
|
setRemoteUsers([]);
|
|
@@ -5142,33 +5219,69 @@ var AddMemberModal = ({
|
|
|
5142
5219
|
setRemoteUsers(response.data);
|
|
5143
5220
|
}
|
|
5144
5221
|
} catch (err) {
|
|
5145
|
-
console.error("Error searching remote users:", err);
|
|
5222
|
+
console.error("[UserPicker] Error searching remote users:", err);
|
|
5146
5223
|
} finally {
|
|
5147
5224
|
if (!cancelled) setIsSearching(false);
|
|
5148
5225
|
}
|
|
5149
|
-
},
|
|
5226
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
5150
5227
|
return () => {
|
|
5151
5228
|
cancelled = true;
|
|
5152
5229
|
clearTimeout(timer);
|
|
5153
5230
|
};
|
|
5154
|
-
}, [search, localFilteredUsers.length, client]);
|
|
5231
|
+
}, [search, localFilteredUsers.length, client, excludeSet]);
|
|
5155
5232
|
const usersToDisplay = search.trim() && localFilteredUsers.length === 0 ? remoteUsers : localFilteredUsers;
|
|
5156
5233
|
const isListLoading = loading || isSearching || isPendingFilter;
|
|
5157
|
-
const
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5234
|
+
const handleToggle = (0, import_react49.useCallback)((user) => {
|
|
5235
|
+
if (user.id === currentUserId || excludeSet.has(user.id)) return;
|
|
5236
|
+
setSelectedMap((prev) => {
|
|
5237
|
+
const next = new Map(prev);
|
|
5238
|
+
if (mode === "radio") {
|
|
5239
|
+
if (next.has(user.id)) {
|
|
5240
|
+
next.clear();
|
|
5241
|
+
} else {
|
|
5242
|
+
next.clear();
|
|
5243
|
+
next.set(user.id, user);
|
|
5244
|
+
}
|
|
5245
|
+
} else {
|
|
5246
|
+
if (next.has(user.id)) {
|
|
5247
|
+
next.delete(user.id);
|
|
5248
|
+
} else {
|
|
5249
|
+
next.set(user.id, user);
|
|
5250
|
+
}
|
|
5251
|
+
}
|
|
5252
|
+
return next;
|
|
5253
|
+
});
|
|
5254
|
+
}, [mode, currentUserId, excludeSet]);
|
|
5255
|
+
(0, import_react49.useEffect)(() => {
|
|
5256
|
+
onSelectionChange?.(Array.from(selectedMap.values()));
|
|
5257
|
+
}, [selectedMap, onSelectionChange]);
|
|
5258
|
+
const handleRemoveSelected = (0, import_react49.useCallback)((userId) => {
|
|
5259
|
+
setSelectedMap((prev) => {
|
|
5260
|
+
const next = new Map(prev);
|
|
5261
|
+
next.delete(userId);
|
|
5262
|
+
return next;
|
|
5263
|
+
});
|
|
5264
|
+
}, []);
|
|
5265
|
+
const handleScroll = (0, import_react49.useCallback)((offset) => {
|
|
5266
|
+
const el = vlistRef.current;
|
|
5267
|
+
if (!el) return;
|
|
5268
|
+
const scrollSize = el.scrollSize ?? 0;
|
|
5269
|
+
const viewportSize = el.viewportSize ?? 0;
|
|
5270
|
+
if (scrollSize > 0 && offset + viewportSize >= scrollSize - 50) {
|
|
5271
|
+
loadMore();
|
|
5169
5272
|
}
|
|
5170
|
-
}, [
|
|
5171
|
-
|
|
5273
|
+
}, [loadMore]);
|
|
5274
|
+
const selectedArr = (0, import_react49.useMemo)(() => Array.from(selectedMap.values()), [selectedMap]);
|
|
5275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ermis-user-picker", role: "listbox", "aria-multiselectable": mode === "checkbox", children: [
|
|
5276
|
+
mode === "checkbox" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5277
|
+
SelectedBox,
|
|
5278
|
+
{
|
|
5279
|
+
users: selectedArr,
|
|
5280
|
+
onRemove: handleRemoveSelected,
|
|
5281
|
+
AvatarComponent,
|
|
5282
|
+
emptyLabel: selectedEmptyLabel
|
|
5283
|
+
}
|
|
5284
|
+
),
|
|
5172
5285
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5173
5286
|
SearchInput,
|
|
5174
5287
|
{
|
|
@@ -5177,28 +5290,101 @@ var AddMemberModal = ({
|
|
|
5177
5290
|
placeholder: searchPlaceholder
|
|
5178
5291
|
}
|
|
5179
5292
|
),
|
|
5180
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ermis-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ermis-user-picker__list", children: isListLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ermis-user-picker__loading", children: [
|
|
5294
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ermis-user-picker__spinner" }),
|
|
5295
|
+
loadingText
|
|
5296
|
+
] }) : usersToDisplay.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ermis-user-picker__empty", children: emptyText }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_virtua5.VList, { ref: vlistRef, style: LIST_STYLE, onScroll: handleScroll, children: [
|
|
5297
|
+
usersToDisplay.map((user) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5298
|
+
UserRow,
|
|
5299
|
+
{
|
|
5300
|
+
user,
|
|
5301
|
+
selected: selectedMap.has(user.id),
|
|
5302
|
+
disabled: user.id === currentUserId || excludeSet.has(user.id),
|
|
5303
|
+
mode,
|
|
5304
|
+
onToggle: handleToggle,
|
|
5305
|
+
AvatarComponent
|
|
5306
|
+
},
|
|
5307
|
+
user.id
|
|
5308
|
+
)),
|
|
5309
|
+
loadingMore && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "ermis-user-picker__load-more", children: [
|
|
5310
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "ermis-user-picker__spinner" }),
|
|
5311
|
+
loadingMoreText
|
|
5312
|
+
] })
|
|
5313
|
+
] }) })
|
|
5194
5314
|
] });
|
|
5195
5315
|
};
|
|
5316
|
+
UserPicker.displayName = "UserPicker";
|
|
5196
5317
|
|
|
5197
|
-
// src/components/ChannelInfo/
|
|
5198
|
-
var import_react50 = __toESM(require("react"));
|
|
5318
|
+
// src/components/ChannelInfo/AddMemberModal.tsx
|
|
5199
5319
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5320
|
+
var AddMemberModal = ({
|
|
5321
|
+
channel,
|
|
5322
|
+
currentMembers,
|
|
5323
|
+
onClose,
|
|
5324
|
+
AvatarComponent = Avatar,
|
|
5325
|
+
title = "Add Member",
|
|
5326
|
+
searchPlaceholder = "Search by name, email or phone...",
|
|
5327
|
+
loadingText = "Loading users...",
|
|
5328
|
+
emptyText = "No users found.",
|
|
5329
|
+
addLabel = "Add",
|
|
5330
|
+
addingLabel = "Adding...",
|
|
5331
|
+
addedLabel = "Added",
|
|
5332
|
+
UserItemComponent,
|
|
5333
|
+
SearchInputComponent
|
|
5334
|
+
}) => {
|
|
5335
|
+
const [selectedUsers, setSelectedUsers] = (0, import_react50.useState)([]);
|
|
5336
|
+
const [isAdding, setIsAdding] = (0, import_react50.useState)(false);
|
|
5337
|
+
const excludeUserIds = (0, import_react50.useMemo)(
|
|
5338
|
+
() => currentMembers.map((m) => m.user_id),
|
|
5339
|
+
[currentMembers]
|
|
5340
|
+
);
|
|
5341
|
+
const handleSelectionChange = (0, import_react50.useCallback)((users) => {
|
|
5342
|
+
setSelectedUsers(users);
|
|
5343
|
+
}, []);
|
|
5344
|
+
const handleAdd = (0, import_react50.useCallback)(async () => {
|
|
5345
|
+
if (selectedUsers.length === 0 || isAdding) return;
|
|
5346
|
+
try {
|
|
5347
|
+
setIsAdding(true);
|
|
5348
|
+
await channel.addMembers(selectedUsers.map((u) => u.id));
|
|
5349
|
+
onClose();
|
|
5350
|
+
} catch (err) {
|
|
5351
|
+
console.error("Failed to add members:", err);
|
|
5352
|
+
} finally {
|
|
5353
|
+
setIsAdding(false);
|
|
5354
|
+
}
|
|
5355
|
+
}, [selectedUsers, isAdding, channel, onClose]);
|
|
5356
|
+
const footer = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5357
|
+
"button",
|
|
5358
|
+
{
|
|
5359
|
+
className: "ermis-modal-add-btn",
|
|
5360
|
+
onClick: handleAdd,
|
|
5361
|
+
disabled: selectedUsers.length === 0 || isAdding,
|
|
5362
|
+
children: isAdding ? addingLabel : `${addLabel} ${selectedUsers.length > 0 ? `(${selectedUsers.length})` : ""}`
|
|
5363
|
+
}
|
|
5364
|
+
);
|
|
5365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Modal, { isOpen: true, onClose, title, maxWidth: "480px", footer, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5366
|
+
UserPicker,
|
|
5367
|
+
{
|
|
5368
|
+
mode: "checkbox",
|
|
5369
|
+
onSelectionChange: handleSelectionChange,
|
|
5370
|
+
excludeUserIds,
|
|
5371
|
+
pageSize: 30,
|
|
5372
|
+
AvatarComponent,
|
|
5373
|
+
UserItemComponent,
|
|
5374
|
+
SearchInputComponent,
|
|
5375
|
+
searchPlaceholder,
|
|
5376
|
+
loadingText,
|
|
5377
|
+
emptyText,
|
|
5378
|
+
selectedEmptyLabel: "Select users to add..."
|
|
5379
|
+
}
|
|
5380
|
+
) });
|
|
5381
|
+
};
|
|
5382
|
+
|
|
5383
|
+
// src/components/ChannelInfo/EditChannelModal.tsx
|
|
5384
|
+
var import_react51 = __toESM(require("react"));
|
|
5385
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
5200
5386
|
var DEFAULT_MAX_IMAGE_SIZE = 5 * 1024 * 1024;
|
|
5201
|
-
var EditChannelModal =
|
|
5387
|
+
var EditChannelModal = import_react51.default.memo(({
|
|
5202
5388
|
channel,
|
|
5203
5389
|
onClose,
|
|
5204
5390
|
onSave,
|
|
@@ -5222,20 +5408,20 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5222
5408
|
const originalDescription = channel.data?.description || "";
|
|
5223
5409
|
const originalPublic = Boolean(channel.data?.public);
|
|
5224
5410
|
const isTeamChannel = channel.type === "team";
|
|
5225
|
-
const [name, setName] = (0,
|
|
5226
|
-
const [description, setDescription] = (0,
|
|
5227
|
-
const [isPublic, setIsPublic] = (0,
|
|
5228
|
-
const [previewUrl, setPreviewUrl] = (0,
|
|
5229
|
-
const [selectedFile, setSelectedFile] = (0,
|
|
5230
|
-
const [isSaving, setIsSaving] = (0,
|
|
5231
|
-
const [error, setError] = (0,
|
|
5232
|
-
const fileInputRef = (0,
|
|
5233
|
-
(0,
|
|
5411
|
+
const [name, setName] = (0, import_react51.useState)(originalName);
|
|
5412
|
+
const [description, setDescription] = (0, import_react51.useState)(originalDescription);
|
|
5413
|
+
const [isPublic, setIsPublic] = (0, import_react51.useState)(originalPublic);
|
|
5414
|
+
const [previewUrl, setPreviewUrl] = (0, import_react51.useState)(null);
|
|
5415
|
+
const [selectedFile, setSelectedFile] = (0, import_react51.useState)(null);
|
|
5416
|
+
const [isSaving, setIsSaving] = (0, import_react51.useState)(false);
|
|
5417
|
+
const [error, setError] = (0, import_react51.useState)(null);
|
|
5418
|
+
const fileInputRef = (0, import_react51.useRef)(null);
|
|
5419
|
+
(0, import_react51.useEffect)(() => {
|
|
5234
5420
|
return () => {
|
|
5235
5421
|
if (previewUrl) URL.revokeObjectURL(previewUrl);
|
|
5236
5422
|
};
|
|
5237
5423
|
}, [previewUrl]);
|
|
5238
|
-
const handleFileSelect = (0,
|
|
5424
|
+
const handleFileSelect = (0, import_react51.useCallback)((e) => {
|
|
5239
5425
|
const file = e.target.files?.[0];
|
|
5240
5426
|
if (!file) return;
|
|
5241
5427
|
if (!file.type.startsWith("image/")) {
|
|
@@ -5253,10 +5439,10 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5253
5439
|
setSelectedFile(file);
|
|
5254
5440
|
e.target.value = "";
|
|
5255
5441
|
}, [maxImageSize, maxImageSizeError, previewUrl]);
|
|
5256
|
-
const handleAvatarClick = (0,
|
|
5442
|
+
const handleAvatarClick = (0, import_react51.useCallback)(() => {
|
|
5257
5443
|
fileInputRef.current?.click();
|
|
5258
5444
|
}, []);
|
|
5259
|
-
const buildPayload = (0,
|
|
5445
|
+
const buildPayload = (0, import_react51.useCallback)(() => {
|
|
5260
5446
|
const payload = {};
|
|
5261
5447
|
let hasChanges = false;
|
|
5262
5448
|
if (name.trim() !== originalName) {
|
|
@@ -5276,7 +5462,7 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5276
5462
|
}
|
|
5277
5463
|
return hasChanges ? payload : null;
|
|
5278
5464
|
}, [name, description, isPublic, selectedFile, originalName, originalDescription, originalPublic, isTeamChannel]);
|
|
5279
|
-
const handleSave = (0,
|
|
5465
|
+
const handleSave = (0, import_react51.useCallback)(async () => {
|
|
5280
5466
|
const payload = buildPayload();
|
|
5281
5467
|
if (!payload && !selectedFile) {
|
|
5282
5468
|
onClose();
|
|
@@ -5310,8 +5496,8 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5310
5496
|
}
|
|
5311
5497
|
}, [buildPayload, selectedFile, onSave, channel, onClose]);
|
|
5312
5498
|
const displayImage = previewUrl || originalImage || void 0;
|
|
5313
|
-
const footerContent = /* @__PURE__ */ (0,
|
|
5314
|
-
/* @__PURE__ */ (0,
|
|
5499
|
+
const footerContent = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ermis-channel-info__edit-footer-buttons", children: [
|
|
5500
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5315
5501
|
"button",
|
|
5316
5502
|
{
|
|
5317
5503
|
className: "ermis-channel-info__edit-btn ermis-channel-info__edit-btn--cancel",
|
|
@@ -5320,7 +5506,7 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5320
5506
|
children: cancelLabel
|
|
5321
5507
|
}
|
|
5322
5508
|
),
|
|
5323
|
-
/* @__PURE__ */ (0,
|
|
5509
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5324
5510
|
"button",
|
|
5325
5511
|
{
|
|
5326
5512
|
className: "ermis-channel-info__edit-btn ermis-channel-info__edit-btn--save",
|
|
@@ -5330,7 +5516,7 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5330
5516
|
}
|
|
5331
5517
|
)
|
|
5332
5518
|
] });
|
|
5333
|
-
return /* @__PURE__ */ (0,
|
|
5519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5334
5520
|
Modal,
|
|
5335
5521
|
{
|
|
5336
5522
|
isOpen: true,
|
|
@@ -5339,16 +5525,16 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5339
5525
|
title,
|
|
5340
5526
|
footer: footerContent,
|
|
5341
5527
|
maxWidth: "420px",
|
|
5342
|
-
children: /* @__PURE__ */ (0,
|
|
5343
|
-
/* @__PURE__ */ (0,
|
|
5344
|
-
/* @__PURE__ */ (0,
|
|
5345
|
-
/* @__PURE__ */ (0,
|
|
5346
|
-
/* @__PURE__ */ (0,
|
|
5347
|
-
/* @__PURE__ */ (0,
|
|
5348
|
-
/* @__PURE__ */ (0,
|
|
5528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ermis-channel-info__edit-body", children: [
|
|
5529
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ermis-channel-info__edit-avatar-section", children: [
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ermis-channel-info__edit-avatar-wrap", onClick: handleAvatarClick, children: [
|
|
5531
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AvatarComponent, { image: displayImage, name: name || originalName, size: 80 }),
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "ermis-channel-info__edit-avatar-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5533
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" }),
|
|
5534
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "12", cy: "13", r: "4" })
|
|
5349
5535
|
] }) })
|
|
5350
5536
|
] }),
|
|
5351
|
-
/* @__PURE__ */ (0,
|
|
5537
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5352
5538
|
"button",
|
|
5353
5539
|
{
|
|
5354
5540
|
className: "ermis-channel-info__edit-avatar-btn",
|
|
@@ -5358,7 +5544,7 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5358
5544
|
children: changeAvatarLabel
|
|
5359
5545
|
}
|
|
5360
5546
|
),
|
|
5361
|
-
/* @__PURE__ */ (0,
|
|
5547
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5362
5548
|
"input",
|
|
5363
5549
|
{
|
|
5364
5550
|
ref: fileInputRef,
|
|
@@ -5370,9 +5556,9 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5370
5556
|
}
|
|
5371
5557
|
)
|
|
5372
5558
|
] }),
|
|
5373
|
-
/* @__PURE__ */ (0,
|
|
5374
|
-
/* @__PURE__ */ (0,
|
|
5375
|
-
/* @__PURE__ */ (0,
|
|
5559
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ermis-channel-info__edit-field", children: [
|
|
5560
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "ermis-channel-info__edit-label", children: nameLabel }),
|
|
5561
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5376
5562
|
"input",
|
|
5377
5563
|
{
|
|
5378
5564
|
className: "ermis-channel-info__edit-input",
|
|
@@ -5385,9 +5571,9 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5385
5571
|
}
|
|
5386
5572
|
)
|
|
5387
5573
|
] }),
|
|
5388
|
-
/* @__PURE__ */ (0,
|
|
5389
|
-
/* @__PURE__ */ (0,
|
|
5390
|
-
/* @__PURE__ */ (0,
|
|
5574
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ermis-channel-info__edit-field", children: [
|
|
5575
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "ermis-channel-info__edit-label", children: descriptionLabel }),
|
|
5576
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5391
5577
|
"textarea",
|
|
5392
5578
|
{
|
|
5393
5579
|
className: "ermis-channel-info__edit-textarea",
|
|
@@ -5400,9 +5586,9 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5400
5586
|
}
|
|
5401
5587
|
)
|
|
5402
5588
|
] }),
|
|
5403
|
-
isTeamChannel && /* @__PURE__ */ (0,
|
|
5404
|
-
/* @__PURE__ */ (0,
|
|
5405
|
-
/* @__PURE__ */ (0,
|
|
5589
|
+
isTeamChannel && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ermis-channel-info__edit-field ermis-channel-info__edit-field--toggle", children: [
|
|
5590
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("label", { className: "ermis-channel-info__edit-label", children: publicLabel }),
|
|
5591
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5406
5592
|
"button",
|
|
5407
5593
|
{
|
|
5408
5594
|
type: "button",
|
|
@@ -5411,15 +5597,15 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5411
5597
|
className: `ermis-channel-info__edit-toggle ${isPublic ? "ermis-channel-info__edit-toggle--on" : ""}`,
|
|
5412
5598
|
onClick: () => setIsPublic((v) => !v),
|
|
5413
5599
|
disabled: isSaving,
|
|
5414
|
-
children: /* @__PURE__ */ (0,
|
|
5600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "ermis-channel-info__edit-toggle-thumb" })
|
|
5415
5601
|
}
|
|
5416
5602
|
)
|
|
5417
5603
|
] }),
|
|
5418
|
-
error && /* @__PURE__ */ (0,
|
|
5419
|
-
/* @__PURE__ */ (0,
|
|
5420
|
-
/* @__PURE__ */ (0,
|
|
5421
|
-
/* @__PURE__ */ (0,
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
5604
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "ermis-channel-info__edit-error", children: [
|
|
5605
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5606
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
5607
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
5608
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
5423
5609
|
] }),
|
|
5424
5610
|
error
|
|
5425
5611
|
] })
|
|
@@ -5430,12 +5616,12 @@ var EditChannelModal = import_react50.default.memo(({
|
|
|
5430
5616
|
EditChannelModal.displayName = "EditChannelModal";
|
|
5431
5617
|
|
|
5432
5618
|
// src/components/ChannelInfo/MessageSearchPanel.tsx
|
|
5433
|
-
var
|
|
5619
|
+
var import_react53 = __toESM(require("react"));
|
|
5434
5620
|
|
|
5435
5621
|
// src/components/Panel.tsx
|
|
5436
|
-
var
|
|
5437
|
-
var
|
|
5438
|
-
var Panel =
|
|
5622
|
+
var import_react52 = __toESM(require("react"));
|
|
5623
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
5624
|
+
var Panel = import_react52.default.memo(({
|
|
5439
5625
|
isOpen,
|
|
5440
5626
|
onClose,
|
|
5441
5627
|
title,
|
|
@@ -5443,24 +5629,24 @@ var Panel = import_react51.default.memo(({
|
|
|
5443
5629
|
headerContent,
|
|
5444
5630
|
className
|
|
5445
5631
|
}) => {
|
|
5446
|
-
const panelRef = (0,
|
|
5447
|
-
(0,
|
|
5632
|
+
const panelRef = (0, import_react52.useRef)(null);
|
|
5633
|
+
(0, import_react52.useEffect)(() => {
|
|
5448
5634
|
if (isOpen && panelRef.current) {
|
|
5449
5635
|
panelRef.current.focus();
|
|
5450
5636
|
}
|
|
5451
5637
|
}, [isOpen]);
|
|
5452
|
-
return /* @__PURE__ */ (0,
|
|
5638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
5453
5639
|
"div",
|
|
5454
5640
|
{
|
|
5455
5641
|
ref: panelRef,
|
|
5456
5642
|
className: `ermis-panel${isOpen ? " ermis-panel--open" : ""}${className ? ` ${className}` : ""}`,
|
|
5457
5643
|
tabIndex: -1,
|
|
5458
5644
|
children: [
|
|
5459
|
-
headerContent ? headerContent : /* @__PURE__ */ (0,
|
|
5460
|
-
/* @__PURE__ */ (0,
|
|
5461
|
-
title && /* @__PURE__ */ (0,
|
|
5645
|
+
headerContent ? headerContent : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "ermis-panel__header", children: [
|
|
5646
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("button", { className: "ermis-panel__back", onClick: onClose, "aria-label": "Back", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("polyline", { points: "15 18 9 12 15 6" }) }) }),
|
|
5647
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "ermis-panel__title", children: title })
|
|
5462
5648
|
] }),
|
|
5463
|
-
/* @__PURE__ */ (0,
|
|
5649
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "ermis-panel__body", children })
|
|
5464
5650
|
]
|
|
5465
5651
|
}
|
|
5466
5652
|
);
|
|
@@ -5468,12 +5654,12 @@ var Panel = import_react51.default.memo(({
|
|
|
5468
5654
|
Panel.displayName = "Panel";
|
|
5469
5655
|
|
|
5470
5656
|
// src/components/ChannelInfo/MessageSearchPanel.tsx
|
|
5471
|
-
var
|
|
5657
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
5472
5658
|
var removeAccents = (str) => str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
5473
|
-
var HighlightedText =
|
|
5474
|
-
if (!term.trim()) return /* @__PURE__ */ (0,
|
|
5659
|
+
var HighlightedText = import_react53.default.memo(({ text, term }) => {
|
|
5660
|
+
if (!term.trim()) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: text });
|
|
5475
5661
|
const cleanTerm = removeAccents(term).toLowerCase();
|
|
5476
|
-
if (!cleanTerm) return /* @__PURE__ */ (0,
|
|
5662
|
+
if (!cleanTerm) return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: text });
|
|
5477
5663
|
const parts = [];
|
|
5478
5664
|
let currentIndex = 0;
|
|
5479
5665
|
const cleanText = removeAccents(text).toLowerCase();
|
|
@@ -5481,23 +5667,23 @@ var HighlightedText = import_react52.default.memo(({ text, term }) => {
|
|
|
5481
5667
|
const startMatch = cleanText.indexOf(cleanTerm, currentIndex);
|
|
5482
5668
|
if (startMatch === -1) {
|
|
5483
5669
|
if (currentIndex < text.length) {
|
|
5484
|
-
parts.push(/* @__PURE__ */ (0,
|
|
5670
|
+
parts.push(/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: text.slice(currentIndex) }, currentIndex));
|
|
5485
5671
|
}
|
|
5486
5672
|
break;
|
|
5487
5673
|
}
|
|
5488
5674
|
if (startMatch > currentIndex) {
|
|
5489
|
-
parts.push(/* @__PURE__ */ (0,
|
|
5675
|
+
parts.push(/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: text.slice(currentIndex, startMatch) }, `text-${currentIndex}`));
|
|
5490
5676
|
}
|
|
5491
5677
|
const endMatch = startMatch + cleanTerm.length;
|
|
5492
5678
|
parts.push(
|
|
5493
|
-
/* @__PURE__ */ (0,
|
|
5679
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("mark", { className: "ermis-search-panel__highlight", children: text.slice(startMatch, endMatch) }, `mark-${startMatch}`)
|
|
5494
5680
|
);
|
|
5495
5681
|
currentIndex = endMatch;
|
|
5496
5682
|
}
|
|
5497
|
-
return /* @__PURE__ */ (0,
|
|
5683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: parts.length > 0 ? parts : text });
|
|
5498
5684
|
});
|
|
5499
5685
|
HighlightedText.displayName = "HighlightedText";
|
|
5500
|
-
var MessageSearchPanel =
|
|
5686
|
+
var MessageSearchPanel = import_react53.default.memo(({
|
|
5501
5687
|
isOpen,
|
|
5502
5688
|
onClose,
|
|
5503
5689
|
channel,
|
|
@@ -5509,17 +5695,17 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5509
5695
|
debounceMs = 500
|
|
5510
5696
|
}) => {
|
|
5511
5697
|
const { setJumpToMessageId } = useChatClient();
|
|
5512
|
-
const [query, setQuery] = (0,
|
|
5513
|
-
const [results, setResults] = (0,
|
|
5514
|
-
const [loading, setLoading] = (0,
|
|
5515
|
-
const [hasMore, setHasMore] = (0,
|
|
5516
|
-
const [loadingMore, setLoadingMore] = (0,
|
|
5517
|
-
const debounceRef = (0,
|
|
5518
|
-
const scrollRef = (0,
|
|
5519
|
-
const inputRef = (0,
|
|
5520
|
-
const offsetRef = (0,
|
|
5521
|
-
const queryRef = (0,
|
|
5522
|
-
(0,
|
|
5698
|
+
const [query, setQuery] = (0, import_react53.useState)("");
|
|
5699
|
+
const [results, setResults] = (0, import_react53.useState)([]);
|
|
5700
|
+
const [loading, setLoading] = (0, import_react53.useState)(false);
|
|
5701
|
+
const [hasMore, setHasMore] = (0, import_react53.useState)(false);
|
|
5702
|
+
const [loadingMore, setLoadingMore] = (0, import_react53.useState)(false);
|
|
5703
|
+
const debounceRef = (0, import_react53.useRef)(null);
|
|
5704
|
+
const scrollRef = (0, import_react53.useRef)(null);
|
|
5705
|
+
const inputRef = (0, import_react53.useRef)(null);
|
|
5706
|
+
const offsetRef = (0, import_react53.useRef)(0);
|
|
5707
|
+
const queryRef = (0, import_react53.useRef)("");
|
|
5708
|
+
(0, import_react53.useEffect)(() => {
|
|
5523
5709
|
setQuery("");
|
|
5524
5710
|
setResults([]);
|
|
5525
5711
|
setLoading(false);
|
|
@@ -5528,12 +5714,12 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5528
5714
|
offsetRef.current = 0;
|
|
5529
5715
|
queryRef.current = "";
|
|
5530
5716
|
}, [channel?.cid, isOpen]);
|
|
5531
|
-
(0,
|
|
5717
|
+
(0, import_react53.useEffect)(() => {
|
|
5532
5718
|
if (isOpen) {
|
|
5533
5719
|
setTimeout(() => inputRef.current?.focus(), 300);
|
|
5534
5720
|
}
|
|
5535
5721
|
}, [isOpen]);
|
|
5536
|
-
const handleInputChange = (0,
|
|
5722
|
+
const handleInputChange = (0, import_react53.useCallback)((e) => {
|
|
5537
5723
|
const value = e.target.value;
|
|
5538
5724
|
setQuery(value);
|
|
5539
5725
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
@@ -5568,7 +5754,7 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5568
5754
|
}
|
|
5569
5755
|
}, debounceMs);
|
|
5570
5756
|
}, [channel, debounceMs]);
|
|
5571
|
-
const handleLoadMore = (0,
|
|
5757
|
+
const handleLoadMore = (0, import_react53.useCallback)(async () => {
|
|
5572
5758
|
if (loadingMore || !hasMore || !queryRef.current) return;
|
|
5573
5759
|
setLoadingMore(true);
|
|
5574
5760
|
const nextOffset = offsetRef.current + 25;
|
|
@@ -5587,7 +5773,7 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5587
5773
|
setLoadingMore(false);
|
|
5588
5774
|
}
|
|
5589
5775
|
}, [channel, hasMore, loadingMore]);
|
|
5590
|
-
const handleScroll = (0,
|
|
5776
|
+
const handleScroll = (0, import_react53.useCallback)(() => {
|
|
5591
5777
|
const el = scrollRef.current;
|
|
5592
5778
|
if (!el) return;
|
|
5593
5779
|
const threshold = 100;
|
|
@@ -5595,10 +5781,10 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5595
5781
|
handleLoadMore();
|
|
5596
5782
|
}
|
|
5597
5783
|
}, [handleLoadMore]);
|
|
5598
|
-
const handleResultClick = (0,
|
|
5784
|
+
const handleResultClick = (0, import_react53.useCallback)((messageId) => {
|
|
5599
5785
|
setJumpToMessageId(messageId);
|
|
5600
5786
|
}, [setJumpToMessageId]);
|
|
5601
|
-
const userMaps = (0,
|
|
5787
|
+
const userMaps = (0, import_react53.useMemo)(() => {
|
|
5602
5788
|
const original = buildUserMap(channel.state);
|
|
5603
5789
|
const lower = {};
|
|
5604
5790
|
for (const [id, name] of Object.entries(original)) {
|
|
@@ -5606,13 +5792,13 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5606
5792
|
}
|
|
5607
5793
|
return { original, lower };
|
|
5608
5794
|
}, [channel.state]);
|
|
5609
|
-
return /* @__PURE__ */ (0,
|
|
5610
|
-
/* @__PURE__ */ (0,
|
|
5611
|
-
/* @__PURE__ */ (0,
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5613
|
-
/* @__PURE__ */ (0,
|
|
5795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Panel, { isOpen, onClose, title, className: "ermis-search-panel", children: [
|
|
5796
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ermis-search-panel__search-box", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "ermis-search-panel__input-wrap", children: [
|
|
5797
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("svg", { className: "ermis-search-panel__input-icon", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5798
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
5799
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
5614
5800
|
] }),
|
|
5615
|
-
/* @__PURE__ */ (0,
|
|
5801
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5616
5802
|
"input",
|
|
5617
5803
|
{
|
|
5618
5804
|
ref: inputRef,
|
|
@@ -5623,7 +5809,7 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5623
5809
|
placeholder
|
|
5624
5810
|
}
|
|
5625
5811
|
),
|
|
5626
|
-
query && /* @__PURE__ */ (0,
|
|
5812
|
+
query && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5627
5813
|
"button",
|
|
5628
5814
|
{
|
|
5629
5815
|
className: "ermis-search-panel__input-clear",
|
|
@@ -5636,32 +5822,32 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5636
5822
|
inputRef.current?.focus();
|
|
5637
5823
|
},
|
|
5638
5824
|
"aria-label": "Clear",
|
|
5639
|
-
children: /* @__PURE__ */ (0,
|
|
5640
|
-
/* @__PURE__ */ (0,
|
|
5641
|
-
/* @__PURE__ */ (0,
|
|
5825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5826
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
5827
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
5642
5828
|
] })
|
|
5643
5829
|
}
|
|
5644
5830
|
)
|
|
5645
5831
|
] }) }),
|
|
5646
|
-
/* @__PURE__ */ (0,
|
|
5832
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
5647
5833
|
"div",
|
|
5648
5834
|
{
|
|
5649
5835
|
ref: scrollRef,
|
|
5650
5836
|
className: "ermis-search-panel__results",
|
|
5651
5837
|
onScroll: handleScroll,
|
|
5652
5838
|
children: [
|
|
5653
|
-
!query.trim() && !loading && results.length === 0 && /* @__PURE__ */ (0,
|
|
5654
|
-
/* @__PURE__ */ (0,
|
|
5655
|
-
/* @__PURE__ */ (0,
|
|
5656
|
-
/* @__PURE__ */ (0,
|
|
5839
|
+
!query.trim() && !loading && results.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "ermis-search-panel__idle", children: [
|
|
5840
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("svg", { width: "40", height: "40", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
5841
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
5842
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
5657
5843
|
] }),
|
|
5658
|
-
/* @__PURE__ */ (0,
|
|
5844
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: placeholder })
|
|
5659
5845
|
] }),
|
|
5660
|
-
loading && /* @__PURE__ */ (0,
|
|
5661
|
-
/* @__PURE__ */ (0,
|
|
5662
|
-
/* @__PURE__ */ (0,
|
|
5846
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "ermis-search-panel__loading", children: [
|
|
5847
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ermis-search-panel__spinner" }),
|
|
5848
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: loadingText })
|
|
5663
5849
|
] }),
|
|
5664
|
-
!loading && query.trim() && results.length === 0 && /* @__PURE__ */ (0,
|
|
5850
|
+
!loading && query.trim() && results.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ermis-search-panel__empty", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: emptyText }) }),
|
|
5665
5851
|
!loading && results.map((msg) => {
|
|
5666
5852
|
let parsedText = "";
|
|
5667
5853
|
if (msg.text) {
|
|
@@ -5673,7 +5859,7 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5673
5859
|
});
|
|
5674
5860
|
}
|
|
5675
5861
|
}
|
|
5676
|
-
return /* @__PURE__ */ (0,
|
|
5862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
5677
5863
|
"div",
|
|
5678
5864
|
{
|
|
5679
5865
|
role: "button",
|
|
@@ -5687,7 +5873,7 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5687
5873
|
}
|
|
5688
5874
|
},
|
|
5689
5875
|
children: [
|
|
5690
|
-
/* @__PURE__ */ (0,
|
|
5876
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5691
5877
|
AvatarComponent,
|
|
5692
5878
|
{
|
|
5693
5879
|
image: msg.user?.avatar || msg.user?.image || msg.user?.avatar_url,
|
|
@@ -5695,20 +5881,20 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5695
5881
|
size: 36
|
|
5696
5882
|
}
|
|
5697
5883
|
),
|
|
5698
|
-
/* @__PURE__ */ (0,
|
|
5699
|
-
/* @__PURE__ */ (0,
|
|
5700
|
-
/* @__PURE__ */ (0,
|
|
5701
|
-
/* @__PURE__ */ (0,
|
|
5884
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "ermis-search-panel__result-body", children: [
|
|
5885
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "ermis-search-panel__result-meta", children: [
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "ermis-search-panel__result-name", children: msg.user?.name || msg.user_id || "Unknown" }),
|
|
5887
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "ermis-search-panel__result-time", children: msg.created_at ? formatRelativeDate(msg.created_at) : "" })
|
|
5702
5888
|
] }),
|
|
5703
|
-
/* @__PURE__ */ (0,
|
|
5889
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "ermis-search-panel__result-text", children: parsedText ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HighlightedText, { text: parsedText, term: query }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("em", { children: "Attachment" }) })
|
|
5704
5890
|
] })
|
|
5705
5891
|
]
|
|
5706
5892
|
},
|
|
5707
5893
|
msg.id
|
|
5708
5894
|
);
|
|
5709
5895
|
}),
|
|
5710
|
-
!loading && !loadingMore && !hasMore && results.length > 0 && query.trim() && /* @__PURE__ */ (0,
|
|
5711
|
-
loadingMore && /* @__PURE__ */ (0,
|
|
5896
|
+
!loading && !loadingMore && !hasMore && results.length > 0 && query.trim() && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ermis-search-panel__end-indicator", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: emptyText }) }),
|
|
5897
|
+
loadingMore && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ermis-search-panel__loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "ermis-search-panel__spinner ermis-search-panel__spinner--small" }) })
|
|
5712
5898
|
]
|
|
5713
5899
|
}
|
|
5714
5900
|
)
|
|
@@ -5717,9 +5903,9 @@ var MessageSearchPanel = import_react52.default.memo(({
|
|
|
5717
5903
|
MessageSearchPanel.displayName = "MessageSearchPanel";
|
|
5718
5904
|
|
|
5719
5905
|
// src/components/ChannelInfo/ChannelSettingsPanel.tsx
|
|
5720
|
-
var
|
|
5721
|
-
var
|
|
5722
|
-
var ChannelSettingsPanel =
|
|
5906
|
+
var import_react54 = __toESM(require("react"));
|
|
5907
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
5908
|
+
var ChannelSettingsPanel = import_react54.default.memo(({
|
|
5723
5909
|
isOpen,
|
|
5724
5910
|
onClose,
|
|
5725
5911
|
channel,
|
|
@@ -5734,8 +5920,8 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5734
5920
|
{ label: "1h", value: 36e5 }
|
|
5735
5921
|
]
|
|
5736
5922
|
}) => {
|
|
5737
|
-
const [slowMode, setSlowMode] = (0,
|
|
5738
|
-
const [capabilities, setCapabilities] = (0,
|
|
5923
|
+
const [slowMode, setSlowMode] = (0, import_react54.useState)(0);
|
|
5924
|
+
const [capabilities, setCapabilities] = (0, import_react54.useState)({
|
|
5739
5925
|
"send-message": true,
|
|
5740
5926
|
"send-links": true,
|
|
5741
5927
|
"update-own-message": true,
|
|
@@ -5745,11 +5931,11 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5745
5931
|
"create-poll": true,
|
|
5746
5932
|
"vote-poll": true
|
|
5747
5933
|
});
|
|
5748
|
-
const [keywords, setKeywords] = (0,
|
|
5749
|
-
const [newKeyword, setNewKeyword] = (0,
|
|
5750
|
-
const [isSaving, setIsSaving] = (0,
|
|
5751
|
-
const [error, setError] = (0,
|
|
5752
|
-
(0,
|
|
5934
|
+
const [keywords, setKeywords] = (0, import_react54.useState)([]);
|
|
5935
|
+
const [newKeyword, setNewKeyword] = (0, import_react54.useState)("");
|
|
5936
|
+
const [isSaving, setIsSaving] = (0, import_react54.useState)(false);
|
|
5937
|
+
const [error, setError] = (0, import_react54.useState)(null);
|
|
5938
|
+
(0, import_react54.useEffect)(() => {
|
|
5753
5939
|
if (!channel) return;
|
|
5754
5940
|
const syncData = (dataToSync = channel.data) => {
|
|
5755
5941
|
console.log("---syncData---", dataToSync);
|
|
@@ -5863,8 +6049,8 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5863
6049
|
setIsSaving(false);
|
|
5864
6050
|
}
|
|
5865
6051
|
};
|
|
5866
|
-
return /* @__PURE__ */ (0,
|
|
5867
|
-
/* @__PURE__ */ (0,
|
|
6052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Panel, { isOpen, onClose, title, className: "ermis-settings-panel", children: [
|
|
6053
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5868
6054
|
"div",
|
|
5869
6055
|
{
|
|
5870
6056
|
className: "ermis-settings-panel__body",
|
|
@@ -5879,7 +6065,7 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5879
6065
|
background: "var(--ermis-bg-secondary)"
|
|
5880
6066
|
},
|
|
5881
6067
|
children: [
|
|
5882
|
-
/* @__PURE__ */ (0,
|
|
6068
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5883
6069
|
"section",
|
|
5884
6070
|
{
|
|
5885
6071
|
className: "ermis-settings-panel__section",
|
|
@@ -5891,14 +6077,14 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5891
6077
|
border: "1px solid var(--ermis-border-color)"
|
|
5892
6078
|
},
|
|
5893
6079
|
children: [
|
|
5894
|
-
/* @__PURE__ */ (0,
|
|
5895
|
-
/* @__PURE__ */ (0,
|
|
5896
|
-
/* @__PURE__ */ (0,
|
|
6080
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { display: "flex", alignItems: "center", marginBottom: "16px", gap: "8px" }, children: [
|
|
6081
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: { background: "var(--ermis-color-primary-light)", padding: "4px", borderRadius: "8px", color: "var(--ermis-color-primary)" }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }) }) }),
|
|
6082
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h4", { style: { fontSize: "14px", color: "var(--ermis-text-primary)", fontWeight: 600, margin: 0 }, children: "Member Permissions" })
|
|
5897
6083
|
] }),
|
|
5898
|
-
/* @__PURE__ */ (0,
|
|
5899
|
-
/* @__PURE__ */ (0,
|
|
5900
|
-
/* @__PURE__ */ (0,
|
|
5901
|
-
/* @__PURE__ */ (0,
|
|
6084
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ermis-settings-panel__field", style: { marginBottom: "16px" }, children: [
|
|
6085
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("label", { style: { display: "block", marginBottom: "6px", fontWeight: 500, fontSize: "12px", color: "var(--ermis-text-secondary)", textTransform: "uppercase", letterSpacing: "0.5px" }, children: "Slow Mode" }),
|
|
6086
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { position: "relative" }, children: [
|
|
6087
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5902
6088
|
"select",
|
|
5903
6089
|
{
|
|
5904
6090
|
value: slowMode,
|
|
@@ -5918,15 +6104,15 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5918
6104
|
transition: "border-color 0.2s"
|
|
5919
6105
|
},
|
|
5920
6106
|
disabled: isSaving,
|
|
5921
|
-
children: slowModeOptions.map((opt) => /* @__PURE__ */ (0,
|
|
6107
|
+
children: slowModeOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
5922
6108
|
}
|
|
5923
6109
|
),
|
|
5924
|
-
/* @__PURE__ */ (0,
|
|
6110
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: { position: "absolute", right: "14px", top: "50%", transform: "translateY(-50%)", pointerEvents: "none", color: "var(--ermis-text-secondary)" }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("polyline", { points: "6 9 12 15 18 9" }) }) })
|
|
5925
6111
|
] })
|
|
5926
6112
|
] }),
|
|
5927
|
-
/* @__PURE__ */ (0,
|
|
5928
|
-
/* @__PURE__ */ (0,
|
|
5929
|
-
/* @__PURE__ */ (0,
|
|
6113
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ermis-settings-panel__toggles", style: { display: "flex", flexDirection: "column" }, children: [
|
|
6114
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("label", { style: { display: "block", marginBottom: "6px", fontWeight: 500, fontSize: "12px", color: "var(--ermis-text-secondary)", textTransform: "uppercase", letterSpacing: "0.5px" }, children: "Capabilities" }),
|
|
6115
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: { background: "var(--ermis-bg-secondary)", borderRadius: "8px", overflow: "hidden", border: "1px solid var(--ermis-border-color)" }, children: Object.entries(capabilities).map(([key, value], index, arr) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5930
6116
|
"div",
|
|
5931
6117
|
{
|
|
5932
6118
|
style: {
|
|
@@ -5937,8 +6123,8 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5937
6123
|
borderBottom: index < arr.length - 1 ? "1px solid var(--ermis-border-color)" : "none"
|
|
5938
6124
|
},
|
|
5939
6125
|
children: [
|
|
5940
|
-
/* @__PURE__ */ (0,
|
|
5941
|
-
/* @__PURE__ */ (0,
|
|
6126
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { style: { fontSize: "14px", fontWeight: 500, color: "var(--ermis-text-primary)" }, children: key.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ") }),
|
|
6127
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5942
6128
|
"button",
|
|
5943
6129
|
{
|
|
5944
6130
|
type: "button",
|
|
@@ -5948,7 +6134,7 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5948
6134
|
onClick: () => toggleCapability(key),
|
|
5949
6135
|
disabled: isSaving,
|
|
5950
6136
|
style: { transform: "scale(0.85)", transformOrigin: "right center" },
|
|
5951
|
-
children: /* @__PURE__ */ (0,
|
|
6137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "ermis-channel-info__edit-toggle-thumb" })
|
|
5952
6138
|
}
|
|
5953
6139
|
)
|
|
5954
6140
|
]
|
|
@@ -5959,7 +6145,7 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5959
6145
|
]
|
|
5960
6146
|
}
|
|
5961
6147
|
),
|
|
5962
|
-
/* @__PURE__ */ (0,
|
|
6148
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
5963
6149
|
"section",
|
|
5964
6150
|
{
|
|
5965
6151
|
className: "ermis-settings-panel__section",
|
|
@@ -5971,18 +6157,18 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
5971
6157
|
border: "1px solid var(--ermis-border-color)"
|
|
5972
6158
|
},
|
|
5973
6159
|
children: [
|
|
5974
|
-
/* @__PURE__ */ (0,
|
|
5975
|
-
/* @__PURE__ */ (0,
|
|
5976
|
-
/* @__PURE__ */ (0,
|
|
5977
|
-
/* @__PURE__ */ (0,
|
|
5978
|
-
/* @__PURE__ */ (0,
|
|
6160
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { display: "flex", alignItems: "center", marginBottom: "16px", gap: "8px" }, children: [
|
|
6161
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { style: { background: "var(--ermis-color-danger-light)", padding: "4px", borderRadius: "8px", color: "var(--ermis-color-danger)" }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6162
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
|
|
6163
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
6164
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
5979
6165
|
] }) }),
|
|
5980
|
-
/* @__PURE__ */ (0,
|
|
6166
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h4", { style: { fontSize: "14px", color: "var(--ermis-text-primary)", fontWeight: 600, margin: 0 }, children: "Content Moderation" })
|
|
5981
6167
|
] }),
|
|
5982
|
-
/* @__PURE__ */ (0,
|
|
5983
|
-
/* @__PURE__ */ (0,
|
|
5984
|
-
/* @__PURE__ */ (0,
|
|
5985
|
-
/* @__PURE__ */ (0,
|
|
6168
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "ermis-settings-panel__field", style: { marginBottom: "16px" }, children: [
|
|
6169
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("label", { style: { display: "block", marginBottom: "6px", fontWeight: 500, fontSize: "12px", color: "var(--ermis-text-secondary)", textTransform: "uppercase", letterSpacing: "0.5px" }, children: "Keyword Filtering" }),
|
|
6170
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { display: "flex", gap: "8px", position: "relative" }, children: [
|
|
6171
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5986
6172
|
"input",
|
|
5987
6173
|
{
|
|
5988
6174
|
type: "text",
|
|
@@ -6004,7 +6190,7 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6004
6190
|
disabled: isSaving
|
|
6005
6191
|
}
|
|
6006
6192
|
),
|
|
6007
|
-
/* @__PURE__ */ (0,
|
|
6193
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6008
6194
|
"button",
|
|
6009
6195
|
{
|
|
6010
6196
|
type: "button",
|
|
@@ -6030,8 +6216,8 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6030
6216
|
)
|
|
6031
6217
|
] })
|
|
6032
6218
|
] }),
|
|
6033
|
-
/* @__PURE__ */ (0,
|
|
6034
|
-
keywords.map((kw) => /* @__PURE__ */ (0,
|
|
6219
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px", minHeight: "32px" }, children: [
|
|
6220
|
+
keywords.map((kw) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
6035
6221
|
"span",
|
|
6036
6222
|
{
|
|
6037
6223
|
style: {
|
|
@@ -6048,7 +6234,7 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6048
6234
|
},
|
|
6049
6235
|
children: [
|
|
6050
6236
|
kw,
|
|
6051
|
-
/* @__PURE__ */ (0,
|
|
6237
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6052
6238
|
"button",
|
|
6053
6239
|
{
|
|
6054
6240
|
onClick: () => handeRemoveKeyword(kw),
|
|
@@ -6065,9 +6251,9 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6065
6251
|
},
|
|
6066
6252
|
disabled: isSaving,
|
|
6067
6253
|
"aria-label": "Remove keyword",
|
|
6068
|
-
children: /* @__PURE__ */ (0,
|
|
6069
|
-
/* @__PURE__ */ (0,
|
|
6070
|
-
/* @__PURE__ */ (0,
|
|
6254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6255
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
6256
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
6071
6257
|
] })
|
|
6072
6258
|
}
|
|
6073
6259
|
)
|
|
@@ -6075,7 +6261,7 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6075
6261
|
},
|
|
6076
6262
|
kw
|
|
6077
6263
|
)),
|
|
6078
|
-
keywords.length === 0 && /* @__PURE__ */ (0,
|
|
6264
|
+
keywords.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { style: { fontSize: "14px", color: "var(--ermis-text-secondary)", padding: "6px 0", fontStyle: "italic" }, children: "No blacklisted keywords added." })
|
|
6079
6265
|
] })
|
|
6080
6266
|
]
|
|
6081
6267
|
}
|
|
@@ -6083,7 +6269,7 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6083
6269
|
]
|
|
6084
6270
|
}
|
|
6085
6271
|
),
|
|
6086
|
-
/* @__PURE__ */ (0,
|
|
6272
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
6087
6273
|
"div",
|
|
6088
6274
|
{
|
|
6089
6275
|
className: "ermis-settings-panel__footer",
|
|
@@ -6097,15 +6283,15 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6097
6283
|
gap: "8px"
|
|
6098
6284
|
},
|
|
6099
6285
|
children: [
|
|
6100
|
-
error && /* @__PURE__ */ (0,
|
|
6101
|
-
/* @__PURE__ */ (0,
|
|
6102
|
-
/* @__PURE__ */ (0,
|
|
6103
|
-
/* @__PURE__ */ (0,
|
|
6104
|
-
/* @__PURE__ */ (0,
|
|
6286
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { style: { color: "var(--ermis-color-danger)", fontSize: "13px", display: "flex", alignItems: "center", gap: "6px", fontWeight: 500 }, children: [
|
|
6287
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", children: [
|
|
6288
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
6289
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
6290
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
6105
6291
|
] }),
|
|
6106
6292
|
error
|
|
6107
6293
|
] }),
|
|
6108
|
-
/* @__PURE__ */ (0,
|
|
6294
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6109
6295
|
"button",
|
|
6110
6296
|
{
|
|
6111
6297
|
onClick: handleSave,
|
|
@@ -6124,8 +6310,8 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6124
6310
|
transition: "all 0.2s ease",
|
|
6125
6311
|
boxShadow: isSaving || !isDirty ? "none" : "0 4px 12px rgba(0, 110, 255, 0.2)"
|
|
6126
6312
|
},
|
|
6127
|
-
children: isSaving ? /* @__PURE__ */ (0,
|
|
6128
|
-
/* @__PURE__ */ (0,
|
|
6313
|
+
children: isSaving ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "8px" }, children: [
|
|
6314
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "ermis-spinner", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) }),
|
|
6129
6315
|
"Saving..."
|
|
6130
6316
|
] }) : "Save Updates"
|
|
6131
6317
|
}
|
|
@@ -6138,40 +6324,40 @@ var ChannelSettingsPanel = import_react53.default.memo(({
|
|
|
6138
6324
|
ChannelSettingsPanel.displayName = "ChannelSettingsPanel";
|
|
6139
6325
|
|
|
6140
6326
|
// src/components/ChannelInfo/ChannelInfo.tsx
|
|
6141
|
-
var
|
|
6142
|
-
var DefaultChannelInfoHeader =
|
|
6143
|
-
return /* @__PURE__ */ (0,
|
|
6144
|
-
/* @__PURE__ */ (0,
|
|
6145
|
-
onClose && /* @__PURE__ */ (0,
|
|
6327
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
6328
|
+
var DefaultChannelInfoHeader = import_react55.default.memo(({ title, onClose }) => {
|
|
6329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ermis-channel-info__header", children: [
|
|
6330
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h3", { className: "ermis-channel-info__title", children: title }),
|
|
6331
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { className: "ermis-channel-info__close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
|
6146
6332
|
] });
|
|
6147
6333
|
});
|
|
6148
6334
|
DefaultChannelInfoHeader.displayName = "DefaultChannelInfoHeader";
|
|
6149
|
-
var DefaultChannelInfoCover =
|
|
6150
|
-
return /* @__PURE__ */ (0,
|
|
6151
|
-
/* @__PURE__ */ (0,
|
|
6152
|
-
/* @__PURE__ */ (0,
|
|
6153
|
-
/* @__PURE__ */ (0,
|
|
6154
|
-
canEdit && onEditClick && /* @__PURE__ */ (0,
|
|
6155
|
-
/* @__PURE__ */ (0,
|
|
6156
|
-
/* @__PURE__ */ (0,
|
|
6335
|
+
var DefaultChannelInfoCover = import_react55.default.memo(({ channelName, channelImage, channelDescription, AvatarComponent, canEdit, onEditClick, isPublic, isTeamChannel }) => {
|
|
6336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ermis-channel-info__cover", children: [
|
|
6337
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(AvatarComponent, { image: channelImage, name: channelName, size: 80, className: "ermis-channel-info__avatar" }),
|
|
6338
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ermis-channel-info__name-row", children: [
|
|
6339
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { className: "ermis-channel-info__name", children: channelName }),
|
|
6340
|
+
canEdit && onEditClick && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { className: "ermis-channel-info__cover-edit-btn", onClick: onEditClick, "aria-label": "Edit channel", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6341
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
|
|
6342
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })
|
|
6157
6343
|
] }) })
|
|
6158
6344
|
] }),
|
|
6159
|
-
isTeamChannel && /* @__PURE__ */ (0,
|
|
6160
|
-
isPublic ? /* @__PURE__ */ (0,
|
|
6161
|
-
/* @__PURE__ */ (0,
|
|
6162
|
-
/* @__PURE__ */ (0,
|
|
6163
|
-
/* @__PURE__ */ (0,
|
|
6164
|
-
] }) : /* @__PURE__ */ (0,
|
|
6165
|
-
/* @__PURE__ */ (0,
|
|
6166
|
-
/* @__PURE__ */ (0,
|
|
6345
|
+
isTeamChannel && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { className: `ermis-channel-info__type-badge ${isPublic ? "ermis-channel-info__type-badge--public" : "ermis-channel-info__type-badge--private"}`, children: [
|
|
6346
|
+
isPublic ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6347
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
6348
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { x1: "2", y1: "12", x2: "22", y2: "12" }),
|
|
6349
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" })
|
|
6350
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6351
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }),
|
|
6352
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
|
|
6167
6353
|
] }),
|
|
6168
6354
|
isPublic ? "Public" : "Private"
|
|
6169
6355
|
] }),
|
|
6170
|
-
channelDescription && /* @__PURE__ */ (0,
|
|
6356
|
+
channelDescription && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "ermis-channel-info__description", children: channelDescription })
|
|
6171
6357
|
] });
|
|
6172
6358
|
});
|
|
6173
6359
|
DefaultChannelInfoCover.displayName = "DefaultChannelInfoCover";
|
|
6174
|
-
var DefaultChannelInfoActions =
|
|
6360
|
+
var DefaultChannelInfoActions = import_react55.default.memo(({
|
|
6175
6361
|
onSearchClick,
|
|
6176
6362
|
onSettingsClick,
|
|
6177
6363
|
onLeaveChannel,
|
|
@@ -6188,52 +6374,52 @@ var DefaultChannelInfoActions = import_react54.default.memo(({
|
|
|
6188
6374
|
blockLabel = "Block",
|
|
6189
6375
|
unblockLabel = "Unblock"
|
|
6190
6376
|
}) => {
|
|
6191
|
-
return /* @__PURE__ */ (0,
|
|
6192
|
-
/* @__PURE__ */ (0,
|
|
6193
|
-
/* @__PURE__ */ (0,
|
|
6194
|
-
/* @__PURE__ */ (0,
|
|
6195
|
-
/* @__PURE__ */ (0,
|
|
6377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ermis-channel-info__actions", children: [
|
|
6378
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { className: "ermis-channel-info__action-btn", onClick: onSearchClick, disabled: isBlocked, children: [
|
|
6379
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ermis-channel-info__action-icon", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6380
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
|
|
6381
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
6196
6382
|
] }) }),
|
|
6197
|
-
/* @__PURE__ */ (0,
|
|
6383
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: searchLabel })
|
|
6198
6384
|
] }),
|
|
6199
|
-
isTeamChannel && (currentUserRole === "owner" || currentUserRole === "moder") && /* @__PURE__ */ (0,
|
|
6200
|
-
/* @__PURE__ */ (0,
|
|
6201
|
-
/* @__PURE__ */ (0,
|
|
6202
|
-
/* @__PURE__ */ (0,
|
|
6385
|
+
isTeamChannel && (currentUserRole === "owner" || currentUserRole === "moder") && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { className: "ermis-channel-info__action-btn", onClick: onSettingsClick, children: [
|
|
6386
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ermis-channel-info__action-icon", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6387
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { cx: "12", cy: "12", r: "3" }),
|
|
6388
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
6203
6389
|
] }) }),
|
|
6204
|
-
/* @__PURE__ */ (0,
|
|
6390
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: settingsLabel })
|
|
6205
6391
|
] }),
|
|
6206
|
-
isTeamChannel && (currentUserRole === "owner" ? /* @__PURE__ */ (0,
|
|
6207
|
-
/* @__PURE__ */ (0,
|
|
6208
|
-
/* @__PURE__ */ (0,
|
|
6209
|
-
/* @__PURE__ */ (0,
|
|
6392
|
+
isTeamChannel && (currentUserRole === "owner" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { className: "ermis-channel-info__action-btn ermis-channel-info__action-btn--danger", onClick: onDeleteChannel, children: [
|
|
6393
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ermis-channel-info__action-icon", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6394
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
6395
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M19 6V20a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
6210
6396
|
] }) }),
|
|
6211
|
-
/* @__PURE__ */ (0,
|
|
6212
|
-
] }) : /* @__PURE__ */ (0,
|
|
6213
|
-
/* @__PURE__ */ (0,
|
|
6214
|
-
/* @__PURE__ */ (0,
|
|
6215
|
-
/* @__PURE__ */ (0,
|
|
6216
|
-
/* @__PURE__ */ (0,
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: deleteLabel })
|
|
6398
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { className: "ermis-channel-info__action-btn ermis-channel-info__action-btn--danger", onClick: onLeaveChannel, children: [
|
|
6399
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ermis-channel-info__action-icon", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6400
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
6401
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("polyline", { points: "16 17 21 12 16 7" }),
|
|
6402
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
|
|
6217
6403
|
] }) }),
|
|
6218
|
-
/* @__PURE__ */ (0,
|
|
6404
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: leaveLabel })
|
|
6219
6405
|
] })),
|
|
6220
|
-
!isTeamChannel && (isBlocked ? /* @__PURE__ */ (0,
|
|
6221
|
-
/* @__PURE__ */ (0,
|
|
6222
|
-
/* @__PURE__ */ (0,
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6406
|
+
!isTeamChannel && (isBlocked ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { className: "ermis-channel-info__action-btn", onClick: onUnblockUser, children: [
|
|
6407
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ermis-channel-info__action-icon", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6408
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
6409
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { x1: "4.93", y1: "4.93", x2: "19.07", y2: "19.07" })
|
|
6224
6410
|
] }) }),
|
|
6225
|
-
/* @__PURE__ */ (0,
|
|
6226
|
-
] }) : /* @__PURE__ */ (0,
|
|
6227
|
-
/* @__PURE__ */ (0,
|
|
6228
|
-
/* @__PURE__ */ (0,
|
|
6229
|
-
/* @__PURE__ */ (0,
|
|
6411
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: unblockLabel })
|
|
6412
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("button", { className: "ermis-channel-info__action-btn ermis-channel-info__action-btn--danger", onClick: onBlockUser, children: [
|
|
6413
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ermis-channel-info__action-icon", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6414
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
6415
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { x1: "4.93", y1: "4.93", x2: "19.07", y2: "19.07" })
|
|
6230
6416
|
] }) }),
|
|
6231
|
-
/* @__PURE__ */ (0,
|
|
6417
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: blockLabel })
|
|
6232
6418
|
] }))
|
|
6233
6419
|
] });
|
|
6234
6420
|
});
|
|
6235
6421
|
DefaultChannelInfoActions.displayName = "DefaultChannelInfoActions";
|
|
6236
|
-
var ChannelInfo =
|
|
6422
|
+
var ChannelInfo = import_react55.default.memo((props) => {
|
|
6237
6423
|
const {
|
|
6238
6424
|
channel: channelProp,
|
|
6239
6425
|
className = "",
|
|
@@ -6303,7 +6489,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6303
6489
|
const currentUserId = client?.userID;
|
|
6304
6490
|
const currentUserRole = currentUserId ? channel?.state?.members?.[currentUserId]?.channel_role : void 0;
|
|
6305
6491
|
const isTeamChannel = channel?.type === "team";
|
|
6306
|
-
const handleDeleteChannel = (0,
|
|
6492
|
+
const handleDeleteChannel = (0, import_react55.useCallback)(async () => {
|
|
6307
6493
|
if (onDeleteChannelProp) return onDeleteChannelProp();
|
|
6308
6494
|
if (!channel) return;
|
|
6309
6495
|
try {
|
|
@@ -6312,7 +6498,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6312
6498
|
console.error("Error deleting channel", e);
|
|
6313
6499
|
}
|
|
6314
6500
|
}, [channel, onDeleteChannelProp]);
|
|
6315
|
-
const handleLeaveChannel = (0,
|
|
6501
|
+
const handleLeaveChannel = (0, import_react55.useCallback)(async () => {
|
|
6316
6502
|
if (onLeaveChannelProp) return onLeaveChannelProp();
|
|
6317
6503
|
if (!channel || !currentUserId) return;
|
|
6318
6504
|
try {
|
|
@@ -6321,7 +6507,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6321
6507
|
console.error("Error leaving channel", e);
|
|
6322
6508
|
}
|
|
6323
6509
|
}, [channel, currentUserId, onLeaveChannelProp]);
|
|
6324
|
-
const handleRemoveMember = (0,
|
|
6510
|
+
const handleRemoveMember = (0, import_react55.useCallback)(async (memberId) => {
|
|
6325
6511
|
if (onRemoveMemberProp) return onRemoveMemberProp(memberId);
|
|
6326
6512
|
if (!channel) return;
|
|
6327
6513
|
try {
|
|
@@ -6330,7 +6516,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6330
6516
|
console.error("Error removing member", e);
|
|
6331
6517
|
}
|
|
6332
6518
|
}, [channel, onRemoveMemberProp]);
|
|
6333
|
-
const handleBanMember = (0,
|
|
6519
|
+
const handleBanMember = (0, import_react55.useCallback)(async (memberId) => {
|
|
6334
6520
|
if (onBanMemberProp) return onBanMemberProp(memberId);
|
|
6335
6521
|
if (!channel) return;
|
|
6336
6522
|
try {
|
|
@@ -6339,7 +6525,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6339
6525
|
console.error("Error banning member", e);
|
|
6340
6526
|
}
|
|
6341
6527
|
}, [channel, onBanMemberProp]);
|
|
6342
|
-
const handleUnbanMember = (0,
|
|
6528
|
+
const handleUnbanMember = (0, import_react55.useCallback)(async (memberId) => {
|
|
6343
6529
|
if (onUnbanMemberProp) return onUnbanMemberProp(memberId);
|
|
6344
6530
|
if (!channel) return;
|
|
6345
6531
|
try {
|
|
@@ -6348,7 +6534,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6348
6534
|
console.error("Error unbanning member", e);
|
|
6349
6535
|
}
|
|
6350
6536
|
}, [channel, onUnbanMemberProp]);
|
|
6351
|
-
const handlePromoteMember = (0,
|
|
6537
|
+
const handlePromoteMember = (0, import_react55.useCallback)(async (memberId) => {
|
|
6352
6538
|
if (onPromoteMemberProp) return onPromoteMemberProp(memberId);
|
|
6353
6539
|
if (!channel) return;
|
|
6354
6540
|
try {
|
|
@@ -6357,7 +6543,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6357
6543
|
console.error("Error promoting member", e);
|
|
6358
6544
|
}
|
|
6359
6545
|
}, [channel, onPromoteMemberProp]);
|
|
6360
|
-
const handleDemoteMember = (0,
|
|
6546
|
+
const handleDemoteMember = (0, import_react55.useCallback)(async (memberId) => {
|
|
6361
6547
|
if (onDemoteMemberProp) return onDemoteMemberProp(memberId);
|
|
6362
6548
|
if (!channel) return;
|
|
6363
6549
|
try {
|
|
@@ -6366,7 +6552,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6366
6552
|
console.error("Error demoting member", e);
|
|
6367
6553
|
}
|
|
6368
6554
|
}, [channel, onDemoteMemberProp]);
|
|
6369
|
-
const handleBlockUser = (0,
|
|
6555
|
+
const handleBlockUser = (0, import_react55.useCallback)(async () => {
|
|
6370
6556
|
if (onBlockUserProp) return onBlockUserProp();
|
|
6371
6557
|
if (!channel) return;
|
|
6372
6558
|
try {
|
|
@@ -6375,7 +6561,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6375
6561
|
console.error("Error blocking user", e);
|
|
6376
6562
|
}
|
|
6377
6563
|
}, [channel, onBlockUserProp]);
|
|
6378
|
-
const handleUnblockUser = (0,
|
|
6564
|
+
const handleUnblockUser = (0, import_react55.useCallback)(async () => {
|
|
6379
6565
|
if (onUnblockUserProp) return onUnblockUserProp();
|
|
6380
6566
|
if (!channel) return;
|
|
6381
6567
|
try {
|
|
@@ -6386,22 +6572,22 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6386
6572
|
}, [channel, onUnblockUserProp]);
|
|
6387
6573
|
const { members } = useChannelMembers(channel);
|
|
6388
6574
|
const { channelName, channelImage, channelDescription } = useChannelProfile(channel);
|
|
6389
|
-
const [showAddMemberModal, setShowAddMemberModal] = (0,
|
|
6390
|
-
const [showEditChannelModal, setShowEditChannelModal] = (0,
|
|
6391
|
-
const [showSearchPanel, setShowSearchPanel] = (0,
|
|
6392
|
-
const [showSettingsPanel, setShowSettingsPanel] = (0,
|
|
6575
|
+
const [showAddMemberModal, setShowAddMemberModal] = (0, import_react55.useState)(false);
|
|
6576
|
+
const [showEditChannelModal, setShowEditChannelModal] = (0, import_react55.useState)(false);
|
|
6577
|
+
const [showSearchPanel, setShowSearchPanel] = (0, import_react55.useState)(false);
|
|
6578
|
+
const [showSettingsPanel, setShowSettingsPanel] = (0, import_react55.useState)(false);
|
|
6393
6579
|
const canEditChannel = isTeamChannel && !isBanned && (currentUserRole === "owner" || currentUserRole === "moder");
|
|
6394
|
-
const handleEditChannelClick = (0,
|
|
6580
|
+
const handleEditChannelClick = (0, import_react55.useCallback)(() => {
|
|
6395
6581
|
setShowEditChannelModal(true);
|
|
6396
6582
|
}, []);
|
|
6397
|
-
const handleAddMemberClick = (0,
|
|
6583
|
+
const handleAddMemberClick = (0, import_react55.useCallback)(() => {
|
|
6398
6584
|
if (onAddMemberClick) return onAddMemberClick();
|
|
6399
6585
|
setShowAddMemberModal(true);
|
|
6400
6586
|
}, [onAddMemberClick]);
|
|
6401
6587
|
if (!channel) return null;
|
|
6402
|
-
return /* @__PURE__ */ (0,
|
|
6403
|
-
/* @__PURE__ */ (0,
|
|
6404
|
-
/* @__PURE__ */ (0,
|
|
6588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `ermis-channel-info ${className}`.trim(), children: [
|
|
6589
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(HeaderComponent, { title, onClose }),
|
|
6590
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6405
6591
|
CoverComponent,
|
|
6406
6592
|
{
|
|
6407
6593
|
channelName,
|
|
@@ -6414,14 +6600,14 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6414
6600
|
isTeamChannel
|
|
6415
6601
|
}
|
|
6416
6602
|
),
|
|
6417
|
-
isBanned ? /* @__PURE__ */ (0,
|
|
6418
|
-
/* @__PURE__ */ (0,
|
|
6419
|
-
/* @__PURE__ */ (0,
|
|
6420
|
-
/* @__PURE__ */ (0,
|
|
6603
|
+
isBanned ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "ermis-channel-info__banned-banner", children: [
|
|
6604
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ermis-channel-info__banned-banner-icon", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6605
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
6606
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("line", { x1: "4.93", y1: "4.93", x2: "19.07", y2: "19.07" })
|
|
6421
6607
|
] }) }),
|
|
6422
|
-
/* @__PURE__ */ (0,
|
|
6423
|
-
] }) : /* @__PURE__ */ (0,
|
|
6424
|
-
/* @__PURE__ */ (0,
|
|
6608
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "ermis-channel-info__banned-banner-text", children: "You have been blocked from this channel" })
|
|
6609
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
6610
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6425
6611
|
ActionsComponent,
|
|
6426
6612
|
{
|
|
6427
6613
|
onSearchClick: () => setShowSearchPanel(true),
|
|
@@ -6441,7 +6627,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6441
6627
|
unblockLabel: actionsUnblockLabel
|
|
6442
6628
|
}
|
|
6443
6629
|
),
|
|
6444
|
-
/* @__PURE__ */ (0,
|
|
6630
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6445
6631
|
TabsComponent,
|
|
6446
6632
|
{
|
|
6447
6633
|
channel,
|
|
@@ -6467,7 +6653,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6467
6653
|
),
|
|
6468
6654
|
showAddMemberModal && /* @__PURE__ */ (() => {
|
|
6469
6655
|
const ModalComp = AddMemberModalComponent || AddMemberModal;
|
|
6470
|
-
return /* @__PURE__ */ (0,
|
|
6656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6471
6657
|
ModalComp,
|
|
6472
6658
|
{
|
|
6473
6659
|
channel,
|
|
@@ -6486,7 +6672,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6486
6672
|
})(),
|
|
6487
6673
|
showEditChannelModal && /* @__PURE__ */ (() => {
|
|
6488
6674
|
const EditComp = EditChannelModalComponent || EditChannelModal;
|
|
6489
|
-
return /* @__PURE__ */ (0,
|
|
6675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6490
6676
|
EditComp,
|
|
6491
6677
|
{
|
|
6492
6678
|
channel,
|
|
@@ -6510,7 +6696,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6510
6696
|
);
|
|
6511
6697
|
})()
|
|
6512
6698
|
] }),
|
|
6513
|
-
channel && showSearchPanel && /* @__PURE__ */ (0,
|
|
6699
|
+
channel && showSearchPanel && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6514
6700
|
MessageSearchPanel,
|
|
6515
6701
|
{
|
|
6516
6702
|
isOpen: showSearchPanel,
|
|
@@ -6519,7 +6705,7 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6519
6705
|
AvatarComponent
|
|
6520
6706
|
}
|
|
6521
6707
|
),
|
|
6522
|
-
channel && showSettingsPanel && /* @__PURE__ */ (0,
|
|
6708
|
+
channel && showSettingsPanel && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6523
6709
|
ChannelSettingsPanel,
|
|
6524
6710
|
{
|
|
6525
6711
|
isOpen: showSettingsPanel,
|
|
@@ -6530,6 +6716,237 @@ var ChannelInfo = import_react54.default.memo((props) => {
|
|
|
6530
6716
|
] });
|
|
6531
6717
|
});
|
|
6532
6718
|
ChannelInfo.displayName = "ChannelInfo";
|
|
6719
|
+
|
|
6720
|
+
// src/components/CreateChannelModal.tsx
|
|
6721
|
+
var import_react56 = require("react");
|
|
6722
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6723
|
+
var CreateChannelModal = ({
|
|
6724
|
+
isOpen,
|
|
6725
|
+
onClose,
|
|
6726
|
+
onSuccess,
|
|
6727
|
+
AvatarComponent = Avatar,
|
|
6728
|
+
UserItemComponent,
|
|
6729
|
+
title = "New Message",
|
|
6730
|
+
directTabLabel = "Direct",
|
|
6731
|
+
groupTabLabel = "Group",
|
|
6732
|
+
groupNameLabel = "Channel Name",
|
|
6733
|
+
groupNamePlaceholder = "Enter channel name (required)",
|
|
6734
|
+
groupDescriptionLabel = "Description",
|
|
6735
|
+
groupDescriptionPlaceholder = "Optional description",
|
|
6736
|
+
groupPublicLabel = "Public Channel",
|
|
6737
|
+
userSearchPlaceholder = "Search users...",
|
|
6738
|
+
cancelButtonLabel = "Cancel",
|
|
6739
|
+
createButtonLabel = "Create",
|
|
6740
|
+
creatingButtonLabel = "Creating..."
|
|
6741
|
+
}) => {
|
|
6742
|
+
const { client } = useChatClient();
|
|
6743
|
+
const currentUserId = client?.userID;
|
|
6744
|
+
const [tab, setTab] = (0, import_react56.useState)("messaging");
|
|
6745
|
+
const [step, setStep] = (0, import_react56.useState)(1);
|
|
6746
|
+
const [name, setName] = (0, import_react56.useState)("");
|
|
6747
|
+
const [description, setDescription] = (0, import_react56.useState)("");
|
|
6748
|
+
const [isPublic, setIsPublic] = (0, import_react56.useState)(false);
|
|
6749
|
+
const [selectedUsers, setSelectedUsers] = (0, import_react56.useState)([]);
|
|
6750
|
+
const [isCreating, setIsCreating] = (0, import_react56.useState)(false);
|
|
6751
|
+
const [error, setError] = (0, import_react56.useState)(null);
|
|
6752
|
+
const existingDirectUserIds = (0, import_react56.useMemo)(() => {
|
|
6753
|
+
if (!client || !currentUserId || tab !== "messaging") return [];
|
|
6754
|
+
const ids = /* @__PURE__ */ new Set();
|
|
6755
|
+
Object.values(client.activeChannels).forEach((channel) => {
|
|
6756
|
+
if (channel.type === "messaging" && channel.state?.members) {
|
|
6757
|
+
Object.keys(channel.state.members).forEach((uid) => {
|
|
6758
|
+
if (uid !== currentUserId) ids.add(uid);
|
|
6759
|
+
});
|
|
6760
|
+
}
|
|
6761
|
+
});
|
|
6762
|
+
return Array.from(ids);
|
|
6763
|
+
}, [client, currentUserId, tab]);
|
|
6764
|
+
const handleCreate = (0, import_react56.useCallback)(async () => {
|
|
6765
|
+
if (!client || !currentUserId || isCreating) return;
|
|
6766
|
+
if (selectedUsers.length === 0) {
|
|
6767
|
+
setError("Please select at least one user.");
|
|
6768
|
+
return;
|
|
6769
|
+
}
|
|
6770
|
+
if (tab === "team" && !name.trim()) {
|
|
6771
|
+
setError("Group name is required.");
|
|
6772
|
+
return;
|
|
6773
|
+
}
|
|
6774
|
+
setIsCreating(true);
|
|
6775
|
+
setError(null);
|
|
6776
|
+
try {
|
|
6777
|
+
let createdChannel;
|
|
6778
|
+
if (tab === "messaging") {
|
|
6779
|
+
const targetUserId = selectedUsers[0].id;
|
|
6780
|
+
createdChannel = client.channel("messaging", {
|
|
6781
|
+
members: [currentUserId, targetUserId]
|
|
6782
|
+
});
|
|
6783
|
+
await createdChannel.create();
|
|
6784
|
+
} else {
|
|
6785
|
+
const memberIds = selectedUsers.map((member) => member.id);
|
|
6786
|
+
if (!memberIds.includes(currentUserId)) {
|
|
6787
|
+
memberIds.push(currentUserId);
|
|
6788
|
+
}
|
|
6789
|
+
const payload = {
|
|
6790
|
+
name: name.trim(),
|
|
6791
|
+
members: memberIds,
|
|
6792
|
+
public: isPublic
|
|
6793
|
+
};
|
|
6794
|
+
if (description.trim()) {
|
|
6795
|
+
payload.description = description.trim();
|
|
6796
|
+
}
|
|
6797
|
+
createdChannel = client.channel("team", payload);
|
|
6798
|
+
await createdChannel.create();
|
|
6799
|
+
}
|
|
6800
|
+
if (onSuccess) {
|
|
6801
|
+
onSuccess(createdChannel);
|
|
6802
|
+
} else {
|
|
6803
|
+
onClose();
|
|
6804
|
+
}
|
|
6805
|
+
} catch (err) {
|
|
6806
|
+
setError(err?.message || "Failed to create channel");
|
|
6807
|
+
} finally {
|
|
6808
|
+
setIsCreating(false);
|
|
6809
|
+
}
|
|
6810
|
+
}, [client, currentUserId, isCreating, selectedUsers, tab, name, isPublic, description, onSuccess, onClose]);
|
|
6811
|
+
const isValid = (0, import_react56.useMemo)(() => {
|
|
6812
|
+
if (tab === "messaging" && selectedUsers.length === 0) return false;
|
|
6813
|
+
if (tab === "team" && step === 1 && !name.trim()) return false;
|
|
6814
|
+
if (tab === "team" && step === 2 && selectedUsers.length === 0) return false;
|
|
6815
|
+
return true;
|
|
6816
|
+
}, [selectedUsers, tab, name, step]);
|
|
6817
|
+
let footer;
|
|
6818
|
+
if (tab === "messaging") {
|
|
6819
|
+
footer = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__footer", children: [
|
|
6820
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "ermis-create-channel__btn ermis-create-channel__btn--cancel", onClick: onClose, disabled: isCreating, children: cancelButtonLabel }),
|
|
6821
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "ermis-create-channel__btn ermis-create-channel__btn--create", onClick: handleCreate, disabled: isCreating || !isValid, children: isCreating ? creatingButtonLabel : createButtonLabel })
|
|
6822
|
+
] });
|
|
6823
|
+
} else if (tab === "team" && step === 1) {
|
|
6824
|
+
footer = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__footer", children: [
|
|
6825
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "ermis-create-channel__btn ermis-create-channel__btn--cancel", onClick: onClose, disabled: isCreating, children: cancelButtonLabel }),
|
|
6826
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "ermis-create-channel__btn ermis-create-channel__btn--create", onClick: () => {
|
|
6827
|
+
setError(null);
|
|
6828
|
+
setStep(2);
|
|
6829
|
+
}, disabled: isCreating || !isValid, children: "Next" })
|
|
6830
|
+
] });
|
|
6831
|
+
} else if (tab === "team" && step === 2) {
|
|
6832
|
+
footer = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__footer", children: [
|
|
6833
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "ermis-create-channel__btn ermis-create-channel__btn--cancel", onClick: () => {
|
|
6834
|
+
setError(null);
|
|
6835
|
+
setStep(1);
|
|
6836
|
+
}, disabled: isCreating, children: "Back" }),
|
|
6837
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { className: "ermis-create-channel__btn ermis-create-channel__btn--create", onClick: handleCreate, disabled: isCreating || !isValid, children: isCreating ? creatingButtonLabel : createButtonLabel })
|
|
6838
|
+
] });
|
|
6839
|
+
}
|
|
6840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Modal, { isOpen, onClose: isCreating ? () => {
|
|
6841
|
+
} : onClose, title, maxWidth: "480px", footer, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__body", children: [
|
|
6842
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__tabs", children: [
|
|
6843
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6844
|
+
"button",
|
|
6845
|
+
{
|
|
6846
|
+
className: `ermis-create-channel__tab ${tab === "messaging" ? "ermis-create-channel__tab--active" : ""}`,
|
|
6847
|
+
onClick: () => {
|
|
6848
|
+
setTab("messaging");
|
|
6849
|
+
setStep(1);
|
|
6850
|
+
setSelectedUsers([]);
|
|
6851
|
+
setError(null);
|
|
6852
|
+
},
|
|
6853
|
+
disabled: isCreating,
|
|
6854
|
+
children: directTabLabel
|
|
6855
|
+
}
|
|
6856
|
+
),
|
|
6857
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6858
|
+
"button",
|
|
6859
|
+
{
|
|
6860
|
+
className: `ermis-create-channel__tab ${tab === "team" ? "ermis-create-channel__tab--active" : ""}`,
|
|
6861
|
+
onClick: () => {
|
|
6862
|
+
setTab("team");
|
|
6863
|
+
setStep(1);
|
|
6864
|
+
setSelectedUsers([]);
|
|
6865
|
+
setError(null);
|
|
6866
|
+
},
|
|
6867
|
+
disabled: isCreating,
|
|
6868
|
+
children: groupTabLabel
|
|
6869
|
+
}
|
|
6870
|
+
)
|
|
6871
|
+
] }),
|
|
6872
|
+
tab === "team" && step === 1 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
6873
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__field", children: [
|
|
6874
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "ermis-create-channel__label", children: [
|
|
6875
|
+
groupNameLabel,
|
|
6876
|
+
" ",
|
|
6877
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { style: { color: "var(--ermis-error)" }, children: "*" })
|
|
6878
|
+
] }),
|
|
6879
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6880
|
+
"input",
|
|
6881
|
+
{
|
|
6882
|
+
className: "ermis-create-channel__input",
|
|
6883
|
+
value: name,
|
|
6884
|
+
onChange: (e) => setName(e.target.value),
|
|
6885
|
+
placeholder: groupNamePlaceholder,
|
|
6886
|
+
disabled: isCreating,
|
|
6887
|
+
maxLength: 100
|
|
6888
|
+
}
|
|
6889
|
+
)
|
|
6890
|
+
] }),
|
|
6891
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__field", children: [
|
|
6892
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { className: "ermis-create-channel__label", children: groupDescriptionLabel }),
|
|
6893
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6894
|
+
"textarea",
|
|
6895
|
+
{
|
|
6896
|
+
className: "ermis-create-channel__textarea",
|
|
6897
|
+
value: description,
|
|
6898
|
+
onChange: (e) => setDescription(e.target.value),
|
|
6899
|
+
placeholder: groupDescriptionPlaceholder,
|
|
6900
|
+
disabled: isCreating,
|
|
6901
|
+
maxLength: 500,
|
|
6902
|
+
rows: 2
|
|
6903
|
+
}
|
|
6904
|
+
)
|
|
6905
|
+
] }),
|
|
6906
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__field ermis-create-channel__field--toggle", children: [
|
|
6907
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("label", { className: "ermis-create-channel__label", children: groupPublicLabel }),
|
|
6908
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6909
|
+
"button",
|
|
6910
|
+
{
|
|
6911
|
+
type: "button",
|
|
6912
|
+
role: "switch",
|
|
6913
|
+
"aria-checked": isPublic,
|
|
6914
|
+
className: `ermis-create-channel__toggle ${isPublic ? "ermis-create-channel__toggle--on" : ""}`,
|
|
6915
|
+
onClick: () => setIsPublic((v) => !v),
|
|
6916
|
+
disabled: isCreating,
|
|
6917
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "ermis-create-channel__toggle-thumb" })
|
|
6918
|
+
}
|
|
6919
|
+
)
|
|
6920
|
+
] })
|
|
6921
|
+
] }),
|
|
6922
|
+
(tab === "team" && step === 2 || tab === "messaging") && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__users", children: [
|
|
6923
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__users-title", children: [
|
|
6924
|
+
"Members ",
|
|
6925
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { style: { color: "var(--ermis-error)" }, children: "*" })
|
|
6926
|
+
] }),
|
|
6927
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { style: { height: tab === "team" ? "280px" : "400px", display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
6928
|
+
UserPicker,
|
|
6929
|
+
{
|
|
6930
|
+
mode: tab === "messaging" ? "radio" : "checkbox",
|
|
6931
|
+
onSelectionChange: setSelectedUsers,
|
|
6932
|
+
excludeUserIds: tab === "messaging" ? existingDirectUserIds : [],
|
|
6933
|
+
initialSelectedUsers: selectedUsers,
|
|
6934
|
+
AvatarComponent,
|
|
6935
|
+
UserItemComponent,
|
|
6936
|
+
searchPlaceholder: userSearchPlaceholder
|
|
6937
|
+
}
|
|
6938
|
+
) })
|
|
6939
|
+
] }),
|
|
6940
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "ermis-create-channel__error", children: [
|
|
6941
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6942
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
6943
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
6944
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
6945
|
+
] }),
|
|
6946
|
+
error
|
|
6947
|
+
] })
|
|
6948
|
+
] }) });
|
|
6949
|
+
};
|
|
6533
6950
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6534
6951
|
0 && (module.exports = {
|
|
6535
6952
|
AttachmentList,
|
|
@@ -6540,6 +6957,7 @@ ChannelInfo.displayName = "ChannelInfo";
|
|
|
6540
6957
|
ChannelItem,
|
|
6541
6958
|
ChannelList,
|
|
6542
6959
|
ChatProvider,
|
|
6960
|
+
CreateChannelModal,
|
|
6543
6961
|
DefaultChannelInfoActions,
|
|
6544
6962
|
DefaultChannelInfoCover,
|
|
6545
6963
|
DefaultChannelInfoHeader,
|
|
@@ -6567,6 +6985,7 @@ ChannelInfo.displayName = "ChannelInfo";
|
|
|
6567
6985
|
SystemMessage,
|
|
6568
6986
|
SystemMessageItem,
|
|
6569
6987
|
TypingIndicator,
|
|
6988
|
+
UserPicker,
|
|
6570
6989
|
VirtualMessageList,
|
|
6571
6990
|
closeAllDropdowns,
|
|
6572
6991
|
dedupMessages,
|