whyuzeim 1.1.95 → 1.1.96
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/cjs/Sidebar/CustomConversationItem/OperateBtn/index.js +7 -7
- package/cjs/Sidebar/GroupList/OperateBtn/index.js +6 -5
- package/cjs/TypeItem/OperateBtn/index.d.ts +1 -0
- package/cjs/TypeItem/OperateBtn/index.js +56 -86
- package/es/Sidebar/CustomConversationItem/OperateBtn/index.js +7 -7
- package/es/Sidebar/GroupList/OperateBtn/index.js +6 -5
- package/es/TypeItem/OperateBtn/index.d.ts +1 -0
- package/es/TypeItem/OperateBtn/index.js +63 -93
- package/es/contexts/LocaleContext.js +1 -1
- package/package.json +1 -1
|
@@ -66,7 +66,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
66
66
|
return modal.confirm({
|
|
67
67
|
content: /*#__PURE__*/React.createElement("span", {
|
|
68
68
|
className: "text-sm "
|
|
69
|
-
},
|
|
69
|
+
}, t('conversation.confirmDelete')),
|
|
70
70
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
71
71
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
72
72
|
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
@@ -76,12 +76,12 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
76
76
|
onClick: function onClick() {
|
|
77
77
|
antd.Modal.destroyAll();
|
|
78
78
|
}
|
|
79
|
-
},
|
|
79
|
+
}, t('common.close')), /*#__PURE__*/React.createElement(antd.Button, {
|
|
80
80
|
type: "primary",
|
|
81
81
|
className: "flex-1",
|
|
82
82
|
size: "large",
|
|
83
83
|
onClick: handleDebounceDelete
|
|
84
|
-
},
|
|
84
|
+
}, t('common.confirm')))
|
|
85
85
|
});
|
|
86
86
|
case 3:
|
|
87
87
|
case "end":
|
|
@@ -103,7 +103,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
103
103
|
return modal.confirm({
|
|
104
104
|
content: /*#__PURE__*/React.createElement("span", {
|
|
105
105
|
className: "text-sm "
|
|
106
|
-
},
|
|
106
|
+
}, t('group.confirmLeaveAndDelete')),
|
|
107
107
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
108
108
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
109
109
|
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
@@ -113,12 +113,12 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
113
113
|
onClick: function onClick() {
|
|
114
114
|
antd.Modal.destroyAll();
|
|
115
115
|
}
|
|
116
|
-
},
|
|
116
|
+
}, t('common.close')), /*#__PURE__*/React.createElement(antd.Button, {
|
|
117
117
|
type: "primary",
|
|
118
118
|
className: "flex-1",
|
|
119
119
|
size: "large",
|
|
120
120
|
onClick: handleDebounceLeave
|
|
121
|
-
},
|
|
121
|
+
}, t('common.confirm')))
|
|
122
122
|
});
|
|
123
123
|
case 3:
|
|
124
124
|
case "end":
|
|
@@ -199,7 +199,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
199
199
|
className: "yuze-conversationItem-action-img"
|
|
200
200
|
}), /*#__PURE__*/React.createElement("span", {
|
|
201
201
|
className: "text-sm delete"
|
|
202
|
-
},
|
|
202
|
+
}, t('conversation.deleteChat'))))
|
|
203
203
|
}, /*#__PURE__*/React.createElement("img", {
|
|
204
204
|
src: more,
|
|
205
205
|
className: "cursor-pointer ml-2 yuze-conversationItem-action-img",
|
|
@@ -85,11 +85,12 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
85
85
|
while (1) switch (_context3.prev = _context3.next) {
|
|
86
86
|
case 0:
|
|
87
87
|
event.stopPropagation();
|
|
88
|
-
|
|
88
|
+
setTooltipOpen(false);
|
|
89
|
+
_context3.next = 4;
|
|
89
90
|
return modal.confirm({
|
|
90
91
|
content: /*#__PURE__*/React.createElement("span", {
|
|
91
92
|
className: "text-sm "
|
|
92
|
-
},
|
|
93
|
+
}, t('conversation.confirmDelete')),
|
|
93
94
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
94
95
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
95
96
|
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
@@ -99,14 +100,14 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
99
100
|
onClick: function onClick() {
|
|
100
101
|
antd.Modal.destroyAll();
|
|
101
102
|
}
|
|
102
|
-
},
|
|
103
|
+
}, t('common.close')), /*#__PURE__*/React.createElement(antd.Button, {
|
|
103
104
|
type: "primary",
|
|
104
105
|
className: "flex-1",
|
|
105
106
|
size: "large",
|
|
106
107
|
onClick: handleDebounceDelete
|
|
107
|
-
},
|
|
108
|
+
}, t('common.confirm')))
|
|
108
109
|
});
|
|
109
|
-
case
|
|
110
|
+
case 4:
|
|
110
111
|
case "end":
|
|
111
112
|
return _context3.stop();
|
|
112
113
|
}
|
|
@@ -6,58 +6,42 @@ var _regeneratorRuntime = require('@babel/runtime-corejs3/regenerator');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var antd = require('antd');
|
|
8
8
|
var more = require('./image/more.svg.js');
|
|
9
|
-
var admin = require('./image/admin.svg.js');
|
|
10
9
|
var logout = require('./image/logout.svg.js');
|
|
11
10
|
var block = require('./image/block.svg.js');
|
|
12
11
|
var ban = require('./image/ban.svg.js');
|
|
13
12
|
var context = require('../../IM/context.js');
|
|
14
13
|
var useDebounce = require('use-debounce');
|
|
14
|
+
var LocaleContext = require('../../contexts/LocaleContext.js');
|
|
15
|
+
require('./style/index.scss');
|
|
15
16
|
|
|
16
17
|
var OperateBtn = function OperateBtn(props) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
sendbirdid = props.sendbirdid
|
|
20
|
-
|
|
21
|
-
onDelete = props.onDelete,
|
|
22
|
-
onBlock = props.onBlock
|
|
23
|
-
|
|
24
|
-
onBan = props.onBan
|
|
25
|
-
|
|
18
|
+
props.userId;
|
|
19
|
+
props.roletype;
|
|
20
|
+
var sendbirdid = props.sendbirdid;
|
|
21
|
+
props.onRoletype;
|
|
22
|
+
var onDelete = props.onDelete,
|
|
23
|
+
onBlock = props.onBlock;
|
|
24
|
+
props.isprohibition;
|
|
25
|
+
var onBan = props.onBan;
|
|
26
|
+
props.groupRoleType;
|
|
26
27
|
var _useContext = React.useContext(context.Context),
|
|
27
28
|
http = _useContext.http;
|
|
28
29
|
var _Modal$useModal = antd.Modal.useModal(),
|
|
29
30
|
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
30
31
|
modal = _Modal$useModal2[0],
|
|
31
32
|
contextHolder = _Modal$useModal2[1];
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
http.post("/capi/account/imchannel/updatechanneluserrole", {
|
|
39
|
-
sendbirdid: sendbirdid,
|
|
40
|
-
memberid: userId,
|
|
41
|
-
roletype: iroletype
|
|
42
|
-
});
|
|
43
|
-
onRoletype && onRoletype(iroletype);
|
|
44
|
-
case 3:
|
|
45
|
-
case "end":
|
|
46
|
-
return _context.stop();
|
|
47
|
-
}
|
|
48
|
-
}, _callee);
|
|
49
|
-
})), [http, userId, sendbirdid, onRoletype, roletype]);
|
|
50
|
-
var handleDebounceUpdateAdmin = useDebounce.useDebouncedCallback(handleUpdateAdmin, 150);
|
|
51
|
-
var handleConfirmRemove = /*#__PURE__*/function () {
|
|
52
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
53
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
54
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
33
|
+
var _useTranslation = LocaleContext.useTranslation(),
|
|
34
|
+
t = _useTranslation.t;
|
|
35
|
+
var handleConfirmDelete = /*#__PURE__*/function () {
|
|
36
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
37
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
38
|
+
while (1) switch (_context.prev = _context.next) {
|
|
55
39
|
case 0:
|
|
56
|
-
|
|
40
|
+
_context.next = 2;
|
|
57
41
|
return modal.confirm({
|
|
58
42
|
content: /*#__PURE__*/React.createElement("span", {
|
|
59
43
|
className: "text-sm "
|
|
60
|
-
},
|
|
44
|
+
}, t('conversation.confirmDelete')),
|
|
61
45
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
62
46
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
63
47
|
}, /*#__PURE__*/React.createElement(antd.Button, {
|
|
@@ -67,95 +51,81 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
67
51
|
onClick: function onClick() {
|
|
68
52
|
antd.Modal.destroyAll();
|
|
69
53
|
}
|
|
70
|
-
},
|
|
54
|
+
}, t('common.close')), /*#__PURE__*/React.createElement(antd.Button, {
|
|
71
55
|
type: "primary",
|
|
72
56
|
className: "flex-1",
|
|
73
57
|
size: "large",
|
|
74
58
|
onClick: handleDebounceRemoveMember
|
|
75
|
-
},
|
|
59
|
+
}, t('common.confirm')))
|
|
76
60
|
});
|
|
77
61
|
case 2:
|
|
78
62
|
case "end":
|
|
79
|
-
return
|
|
63
|
+
return _context.stop();
|
|
80
64
|
}
|
|
81
|
-
},
|
|
65
|
+
}, _callee);
|
|
82
66
|
}));
|
|
83
|
-
return function
|
|
84
|
-
return
|
|
67
|
+
return function handleConfirmDelete() {
|
|
68
|
+
return _ref.apply(this, arguments);
|
|
85
69
|
};
|
|
86
70
|
}();
|
|
87
|
-
var handleRemoveMember = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
88
|
-
return _regeneratorRuntime.wrap(function
|
|
89
|
-
while (1) switch (
|
|
71
|
+
var handleRemoveMember = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
72
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
73
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
90
74
|
case 0:
|
|
91
75
|
http.post("/capi/account/imchannel/removeuser", {
|
|
92
76
|
sendbirdid: sendbirdid,
|
|
93
|
-
memberids: [
|
|
77
|
+
memberids: [sendbirdid]
|
|
94
78
|
});
|
|
95
|
-
onDelete && onDelete(
|
|
79
|
+
onDelete && onDelete(sendbirdid);
|
|
96
80
|
case 2:
|
|
97
81
|
case "end":
|
|
98
|
-
return
|
|
82
|
+
return _context2.stop();
|
|
99
83
|
}
|
|
100
|
-
},
|
|
101
|
-
})), [http, sendbirdid,
|
|
84
|
+
}, _callee2);
|
|
85
|
+
})), [http, sendbirdid, onDelete]);
|
|
102
86
|
var handleDebounceRemoveMember = useDebounce.useDebouncedCallback(handleRemoveMember, 150);
|
|
103
87
|
// /capi/account/imchannelblocks/save
|
|
104
|
-
var handleBlockMember = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
105
|
-
return _regeneratorRuntime.wrap(function
|
|
106
|
-
while (1) switch (
|
|
88
|
+
var handleBlockMember = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
89
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
90
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
107
91
|
case 0:
|
|
108
92
|
http.post("/capi/account/imchannelblocks/save", {
|
|
109
93
|
sendbirdid: sendbirdid,
|
|
110
|
-
userid:
|
|
94
|
+
userid: sendbirdid,
|
|
111
95
|
memo: "xixi"
|
|
112
96
|
});
|
|
113
|
-
onBlock && onBlock(
|
|
97
|
+
onBlock && onBlock(sendbirdid);
|
|
114
98
|
case 2:
|
|
115
99
|
case "end":
|
|
116
|
-
return
|
|
100
|
+
return _context3.stop();
|
|
117
101
|
}
|
|
118
|
-
},
|
|
119
|
-
})), [http, sendbirdid,
|
|
102
|
+
}, _callee3);
|
|
103
|
+
})), [http, sendbirdid, onBlock]);
|
|
120
104
|
var handleDebounceBlockMember = useDebounce.useDebouncedCallback(handleBlockMember, 150);
|
|
121
|
-
var handleBanMember = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
105
|
+
var handleBanMember = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
106
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
107
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
125
108
|
case 0:
|
|
126
|
-
iisprohibition = isprohibition === 0 ? 1 : 0;
|
|
127
109
|
http.post("/capi/account/imchannel/updateprohibition", {
|
|
128
110
|
sendbirdid: sendbirdid,
|
|
129
|
-
memberid:
|
|
130
|
-
isprohibition:
|
|
111
|
+
memberid: sendbirdid,
|
|
112
|
+
isprohibition: 1
|
|
131
113
|
});
|
|
132
|
-
onBan && onBan(
|
|
133
|
-
case
|
|
114
|
+
onBan && onBan(1);
|
|
115
|
+
case 2:
|
|
134
116
|
case "end":
|
|
135
|
-
return
|
|
117
|
+
return _context4.stop();
|
|
136
118
|
}
|
|
137
|
-
},
|
|
138
|
-
})), [
|
|
119
|
+
}, _callee4);
|
|
120
|
+
})), [http, sendbirdid, onBan]);
|
|
139
121
|
var handleDebounceBanMember = useDebounce.useDebouncedCallback(handleBanMember, 150);
|
|
140
122
|
return /*#__PURE__*/React.createElement(antd.Tooltip, {
|
|
141
123
|
placement: "bottomLeft",
|
|
142
124
|
title: /*#__PURE__*/React.createElement("div", {
|
|
143
125
|
className: "flex flex-col"
|
|
144
|
-
},
|
|
145
|
-
className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
|
|
146
|
-
onClick: handleDebounceUpdateAdmin
|
|
147
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
148
|
-
src: admin,
|
|
149
|
-
alt: "",
|
|
150
|
-
style: {
|
|
151
|
-
width: "14px",
|
|
152
|
-
height: "14px"
|
|
153
|
-
}
|
|
154
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
155
|
-
className: "text-sm"
|
|
156
|
-
}, roletype === 1 ? "Remove Admin" : "Set Admin")), /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
157
127
|
className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
|
|
158
|
-
onClick:
|
|
128
|
+
onClick: handleConfirmDelete
|
|
159
129
|
}, /*#__PURE__*/React.createElement("img", {
|
|
160
130
|
src: logout,
|
|
161
131
|
alt: "",
|
|
@@ -165,7 +135,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
165
135
|
}
|
|
166
136
|
}), /*#__PURE__*/React.createElement("span", {
|
|
167
137
|
className: "text-sm"
|
|
168
|
-
},
|
|
138
|
+
}, t('group.removeMember'))), /*#__PURE__*/React.createElement("div", {
|
|
169
139
|
className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
|
|
170
140
|
onClick: handleDebounceBlockMember
|
|
171
141
|
}, /*#__PURE__*/React.createElement("img", {
|
|
@@ -177,7 +147,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
177
147
|
}
|
|
178
148
|
}), /*#__PURE__*/React.createElement("span", {
|
|
179
149
|
className: "text-sm"
|
|
180
|
-
},
|
|
150
|
+
}, t('actions.block'))), /*#__PURE__*/React.createElement("div", {
|
|
181
151
|
className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
|
|
182
152
|
onClick: handleDebounceBanMember
|
|
183
153
|
}, /*#__PURE__*/React.createElement("img", {
|
|
@@ -189,7 +159,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
189
159
|
}
|
|
190
160
|
}), /*#__PURE__*/React.createElement("span", {
|
|
191
161
|
className: "text-sm"
|
|
192
|
-
},
|
|
162
|
+
}, t('actions.ban'))))
|
|
193
163
|
}, contextHolder, /*#__PURE__*/React.createElement("img", {
|
|
194
164
|
src: more,
|
|
195
165
|
className: "cursor-pointer ml-2"
|
|
@@ -64,7 +64,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
64
64
|
return modal.confirm({
|
|
65
65
|
content: /*#__PURE__*/React.createElement("span", {
|
|
66
66
|
className: "text-sm "
|
|
67
|
-
},
|
|
67
|
+
}, t('conversation.confirmDelete')),
|
|
68
68
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
69
69
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
70
70
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -74,12 +74,12 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
74
74
|
onClick: function onClick() {
|
|
75
75
|
Modal.destroyAll();
|
|
76
76
|
}
|
|
77
|
-
},
|
|
77
|
+
}, t('common.close')), /*#__PURE__*/React.createElement(Button, {
|
|
78
78
|
type: "primary",
|
|
79
79
|
className: "flex-1",
|
|
80
80
|
size: "large",
|
|
81
81
|
onClick: handleDebounceDelete
|
|
82
|
-
},
|
|
82
|
+
}, t('common.confirm')))
|
|
83
83
|
});
|
|
84
84
|
case 3:
|
|
85
85
|
case "end":
|
|
@@ -101,7 +101,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
101
101
|
return modal.confirm({
|
|
102
102
|
content: /*#__PURE__*/React.createElement("span", {
|
|
103
103
|
className: "text-sm "
|
|
104
|
-
},
|
|
104
|
+
}, t('group.confirmLeaveAndDelete')),
|
|
105
105
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
106
106
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
107
107
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -111,12 +111,12 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
111
111
|
onClick: function onClick() {
|
|
112
112
|
Modal.destroyAll();
|
|
113
113
|
}
|
|
114
|
-
},
|
|
114
|
+
}, t('common.close')), /*#__PURE__*/React.createElement(Button, {
|
|
115
115
|
type: "primary",
|
|
116
116
|
className: "flex-1",
|
|
117
117
|
size: "large",
|
|
118
118
|
onClick: handleDebounceLeave
|
|
119
|
-
},
|
|
119
|
+
}, t('common.confirm')))
|
|
120
120
|
});
|
|
121
121
|
case 3:
|
|
122
122
|
case "end":
|
|
@@ -197,7 +197,7 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
197
197
|
className: "yuze-conversationItem-action-img"
|
|
198
198
|
}), /*#__PURE__*/React.createElement("span", {
|
|
199
199
|
className: "text-sm delete"
|
|
200
|
-
},
|
|
200
|
+
}, t('conversation.deleteChat'))))
|
|
201
201
|
}, /*#__PURE__*/React.createElement("img", {
|
|
202
202
|
src: img$3,
|
|
203
203
|
className: "cursor-pointer ml-2 yuze-conversationItem-action-img",
|
|
@@ -83,11 +83,12 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
83
83
|
while (1) switch (_context3.prev = _context3.next) {
|
|
84
84
|
case 0:
|
|
85
85
|
event.stopPropagation();
|
|
86
|
-
|
|
86
|
+
setTooltipOpen(false);
|
|
87
|
+
_context3.next = 4;
|
|
87
88
|
return modal.confirm({
|
|
88
89
|
content: /*#__PURE__*/React.createElement("span", {
|
|
89
90
|
className: "text-sm "
|
|
90
|
-
},
|
|
91
|
+
}, t('conversation.confirmDelete')),
|
|
91
92
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
92
93
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
93
94
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -97,14 +98,14 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
97
98
|
onClick: function onClick() {
|
|
98
99
|
Modal.destroyAll();
|
|
99
100
|
}
|
|
100
|
-
},
|
|
101
|
+
}, t('common.close')), /*#__PURE__*/React.createElement(Button, {
|
|
101
102
|
type: "primary",
|
|
102
103
|
className: "flex-1",
|
|
103
104
|
size: "large",
|
|
104
105
|
onClick: handleDebounceDelete
|
|
105
|
-
},
|
|
106
|
+
}, t('common.confirm')))
|
|
106
107
|
});
|
|
107
|
-
case
|
|
108
|
+
case 4:
|
|
108
109
|
case "end":
|
|
109
110
|
return _context3.stop();
|
|
110
111
|
}
|
|
@@ -3,59 +3,43 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
|
3
3
|
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
4
4
|
import React, { useContext, useCallback } from 'react';
|
|
5
5
|
import { Modal, Tooltip, Button } from 'antd';
|
|
6
|
-
import img$
|
|
7
|
-
import img from './image/
|
|
8
|
-
import img$1 from './image/
|
|
9
|
-
import img$2 from './image/
|
|
10
|
-
import img$3 from './image/ban.svg.js';
|
|
6
|
+
import img$3 from './image/more.svg.js';
|
|
7
|
+
import img from './image/logout.svg.js';
|
|
8
|
+
import img$1 from './image/block.svg.js';
|
|
9
|
+
import img$2 from './image/ban.svg.js';
|
|
11
10
|
import { Context } from '../../IM/context.js';
|
|
12
11
|
import { useDebouncedCallback } from 'use-debounce';
|
|
12
|
+
import { useTranslation } from '../../contexts/LocaleContext.js';
|
|
13
|
+
import './style/index.scss';
|
|
13
14
|
|
|
14
15
|
var OperateBtn = function OperateBtn(props) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
sendbirdid = props.sendbirdid
|
|
18
|
-
|
|
19
|
-
onDelete = props.onDelete,
|
|
20
|
-
onBlock = props.onBlock
|
|
21
|
-
|
|
22
|
-
onBan = props.onBan
|
|
23
|
-
|
|
16
|
+
props.userId;
|
|
17
|
+
props.roletype;
|
|
18
|
+
var sendbirdid = props.sendbirdid;
|
|
19
|
+
props.onRoletype;
|
|
20
|
+
var onDelete = props.onDelete,
|
|
21
|
+
onBlock = props.onBlock;
|
|
22
|
+
props.isprohibition;
|
|
23
|
+
var onBan = props.onBan;
|
|
24
|
+
props.groupRoleType;
|
|
24
25
|
var _useContext = useContext(Context),
|
|
25
26
|
http = _useContext.http;
|
|
26
27
|
var _Modal$useModal = Modal.useModal(),
|
|
27
28
|
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
28
29
|
modal = _Modal$useModal2[0],
|
|
29
30
|
contextHolder = _Modal$useModal2[1];
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
http.post("/capi/account/imchannel/updatechanneluserrole", {
|
|
37
|
-
sendbirdid: sendbirdid,
|
|
38
|
-
memberid: userId,
|
|
39
|
-
roletype: iroletype
|
|
40
|
-
});
|
|
41
|
-
onRoletype && onRoletype(iroletype);
|
|
42
|
-
case 3:
|
|
43
|
-
case "end":
|
|
44
|
-
return _context.stop();
|
|
45
|
-
}
|
|
46
|
-
}, _callee);
|
|
47
|
-
})), [http, userId, sendbirdid, onRoletype, roletype]);
|
|
48
|
-
var handleDebounceUpdateAdmin = useDebouncedCallback(handleUpdateAdmin, 150);
|
|
49
|
-
var handleConfirmRemove = /*#__PURE__*/function () {
|
|
50
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
51
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
52
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
31
|
+
var _useTranslation = useTranslation(),
|
|
32
|
+
t = _useTranslation.t;
|
|
33
|
+
var handleConfirmDelete = /*#__PURE__*/function () {
|
|
34
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
36
|
+
while (1) switch (_context.prev = _context.next) {
|
|
53
37
|
case 0:
|
|
54
|
-
|
|
38
|
+
_context.next = 2;
|
|
55
39
|
return modal.confirm({
|
|
56
40
|
content: /*#__PURE__*/React.createElement("span", {
|
|
57
41
|
className: "text-sm "
|
|
58
|
-
},
|
|
42
|
+
}, t('conversation.confirmDelete')),
|
|
59
43
|
footer: /*#__PURE__*/React.createElement("div", {
|
|
60
44
|
className: "yuze-confirm-footer flex justify-center gap-5 mt-4"
|
|
61
45
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -65,83 +49,81 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
65
49
|
onClick: function onClick() {
|
|
66
50
|
Modal.destroyAll();
|
|
67
51
|
}
|
|
68
|
-
},
|
|
52
|
+
}, t('common.close')), /*#__PURE__*/React.createElement(Button, {
|
|
69
53
|
type: "primary",
|
|
70
54
|
className: "flex-1",
|
|
71
55
|
size: "large",
|
|
72
56
|
onClick: handleDebounceRemoveMember
|
|
73
|
-
},
|
|
57
|
+
}, t('common.confirm')))
|
|
74
58
|
});
|
|
75
59
|
case 2:
|
|
76
60
|
case "end":
|
|
77
|
-
return
|
|
61
|
+
return _context.stop();
|
|
78
62
|
}
|
|
79
|
-
},
|
|
63
|
+
}, _callee);
|
|
80
64
|
}));
|
|
81
|
-
return function
|
|
82
|
-
return
|
|
65
|
+
return function handleConfirmDelete() {
|
|
66
|
+
return _ref.apply(this, arguments);
|
|
83
67
|
};
|
|
84
68
|
}();
|
|
85
|
-
var handleRemoveMember = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
86
|
-
return _regeneratorRuntime.wrap(function
|
|
87
|
-
while (1) switch (
|
|
69
|
+
var handleRemoveMember = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
70
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
71
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
88
72
|
case 0:
|
|
89
73
|
http.post("/capi/account/imchannel/removeuser", {
|
|
90
74
|
sendbirdid: sendbirdid,
|
|
91
|
-
memberids: [
|
|
75
|
+
memberids: [sendbirdid]
|
|
92
76
|
});
|
|
93
|
-
onDelete && onDelete(
|
|
77
|
+
onDelete && onDelete(sendbirdid);
|
|
94
78
|
case 2:
|
|
95
79
|
case "end":
|
|
96
|
-
return
|
|
80
|
+
return _context2.stop();
|
|
97
81
|
}
|
|
98
|
-
},
|
|
99
|
-
})), [http, sendbirdid,
|
|
82
|
+
}, _callee2);
|
|
83
|
+
})), [http, sendbirdid, onDelete]);
|
|
100
84
|
var handleDebounceRemoveMember = useDebouncedCallback(handleRemoveMember, 150);
|
|
101
85
|
// /capi/account/imchannelblocks/save
|
|
102
|
-
var handleBlockMember = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
103
|
-
return _regeneratorRuntime.wrap(function
|
|
104
|
-
while (1) switch (
|
|
86
|
+
var handleBlockMember = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
87
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
88
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
105
89
|
case 0:
|
|
106
90
|
http.post("/capi/account/imchannelblocks/save", {
|
|
107
91
|
sendbirdid: sendbirdid,
|
|
108
|
-
userid:
|
|
92
|
+
userid: sendbirdid,
|
|
109
93
|
memo: "xixi"
|
|
110
94
|
});
|
|
111
|
-
onBlock && onBlock(
|
|
95
|
+
onBlock && onBlock(sendbirdid);
|
|
112
96
|
case 2:
|
|
113
97
|
case "end":
|
|
114
|
-
return
|
|
98
|
+
return _context3.stop();
|
|
115
99
|
}
|
|
116
|
-
},
|
|
117
|
-
})), [http, sendbirdid,
|
|
100
|
+
}, _callee3);
|
|
101
|
+
})), [http, sendbirdid, onBlock]);
|
|
118
102
|
var handleDebounceBlockMember = useDebouncedCallback(handleBlockMember, 150);
|
|
119
|
-
var handleBanMember = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
103
|
+
var handleBanMember = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
104
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
105
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
123
106
|
case 0:
|
|
124
|
-
iisprohibition = isprohibition === 0 ? 1 : 0;
|
|
125
107
|
http.post("/capi/account/imchannel/updateprohibition", {
|
|
126
108
|
sendbirdid: sendbirdid,
|
|
127
|
-
memberid:
|
|
128
|
-
isprohibition:
|
|
109
|
+
memberid: sendbirdid,
|
|
110
|
+
isprohibition: 1
|
|
129
111
|
});
|
|
130
|
-
onBan && onBan(
|
|
131
|
-
case
|
|
112
|
+
onBan && onBan(1);
|
|
113
|
+
case 2:
|
|
132
114
|
case "end":
|
|
133
|
-
return
|
|
115
|
+
return _context4.stop();
|
|
134
116
|
}
|
|
135
|
-
},
|
|
136
|
-
})), [
|
|
117
|
+
}, _callee4);
|
|
118
|
+
})), [http, sendbirdid, onBan]);
|
|
137
119
|
var handleDebounceBanMember = useDebouncedCallback(handleBanMember, 150);
|
|
138
120
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
139
121
|
placement: "bottomLeft",
|
|
140
122
|
title: /*#__PURE__*/React.createElement("div", {
|
|
141
123
|
className: "flex flex-col"
|
|
142
|
-
},
|
|
124
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
143
125
|
className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
|
|
144
|
-
onClick:
|
|
126
|
+
onClick: handleConfirmDelete
|
|
145
127
|
}, /*#__PURE__*/React.createElement("img", {
|
|
146
128
|
src: img,
|
|
147
129
|
alt: "",
|
|
@@ -151,23 +133,11 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
151
133
|
}
|
|
152
134
|
}), /*#__PURE__*/React.createElement("span", {
|
|
153
135
|
className: "text-sm"
|
|
154
|
-
},
|
|
155
|
-
className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
|
|
156
|
-
onClick: handleConfirmRemove
|
|
157
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
158
|
-
src: img$1,
|
|
159
|
-
alt: "",
|
|
160
|
-
style: {
|
|
161
|
-
width: "14px",
|
|
162
|
-
height: "14px"
|
|
163
|
-
}
|
|
164
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
165
|
-
className: "text-sm"
|
|
166
|
-
}, "Remove")), /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
}, t('group.removeMember'))), /*#__PURE__*/React.createElement("div", {
|
|
167
137
|
className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
|
|
168
138
|
onClick: handleDebounceBlockMember
|
|
169
139
|
}, /*#__PURE__*/React.createElement("img", {
|
|
170
|
-
src: img$
|
|
140
|
+
src: img$1,
|
|
171
141
|
alt: "",
|
|
172
142
|
style: {
|
|
173
143
|
width: "14px",
|
|
@@ -175,11 +145,11 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
175
145
|
}
|
|
176
146
|
}), /*#__PURE__*/React.createElement("span", {
|
|
177
147
|
className: "text-sm"
|
|
178
|
-
},
|
|
148
|
+
}, t('actions.block'))), /*#__PURE__*/React.createElement("div", {
|
|
179
149
|
className: "yuze-conversationList-header-right-tooltip-item flex flex-row items-center gap-3 cursor-pointer",
|
|
180
150
|
onClick: handleDebounceBanMember
|
|
181
151
|
}, /*#__PURE__*/React.createElement("img", {
|
|
182
|
-
src: img$
|
|
152
|
+
src: img$2,
|
|
183
153
|
alt: "",
|
|
184
154
|
style: {
|
|
185
155
|
width: "14px",
|
|
@@ -187,9 +157,9 @@ var OperateBtn = function OperateBtn(props) {
|
|
|
187
157
|
}
|
|
188
158
|
}), /*#__PURE__*/React.createElement("span", {
|
|
189
159
|
className: "text-sm"
|
|
190
|
-
},
|
|
160
|
+
}, t('actions.ban'))))
|
|
191
161
|
}, contextHolder, /*#__PURE__*/React.createElement("img", {
|
|
192
|
-
src: img$
|
|
162
|
+
src: img$3,
|
|
193
163
|
className: "cursor-pointer ml-2"
|
|
194
164
|
}));
|
|
195
165
|
};
|
|
@@ -7,7 +7,7 @@ import _typeof from '@babel/runtime-corejs3/helpers/esm/typeof';
|
|
|
7
7
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
8
8
|
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/esm/asyncToGenerator';
|
|
9
9
|
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
10
|
-
import React, {
|
|
10
|
+
import React, { useContext, createContext, useState, useEffect, useCallback } from 'react';
|
|
11
11
|
|
|
12
12
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
13
13
|
function _unsupportedIterableToArray(r, a) { if (r) { var _context2; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context2 = {}.toString.call(r)).call(_context2, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|