@messenger-box/slack-ui-mobile 10.0.3-alpha.27 → 10.0.3-alpha.31
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/lib/components/SlackSearchInput/Suggestion.js +1 -1
- package/lib/components/SlackSearchInput/Tag.js +1 -1
- package/lib/components/SlackSearchInput/index.js +1 -1
- package/lib/compute.js +1 -4
- package/lib/routes.json +1 -4
- package/lib/screens/Channels/Channels.js +41 -80
- package/lib/screens/Channels/Channels.js.map +1 -1
- package/lib/screens/Home/Components/Channels/Channels.js +123 -66
- package/lib/screens/Home/Components/Channels/Channels.js.map +1 -1
- package/lib/screens/Home/Components/DirectChannels/DirectChannels.js +211 -111
- package/lib/screens/Home/Components/DirectChannels/DirectChannels.js.map +1 -1
- package/lib/screens/Home/Components/Teams/Teams.js +106 -38
- package/lib/screens/Home/Components/Teams/Teams.js.map +1 -1
- package/lib/screens/Home/Components/TopCommonSlider/TopCommonSlider.js +40 -71
- package/lib/screens/Home/Components/TopCommonSlider/TopCommonSlider.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +39 -24
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/styles.js +2 -2
- package/lib/screens/Home/styles.js.map +1 -1
- package/lib/screens/Search/SearchAddChannel.js +246 -204
- package/lib/screens/Search/SearchAddChannel.js.map +1 -1
- package/lib/screens/Teams/Teams-xstate.js +226 -0
- package/lib/screens/Teams/Teams-xstate.js.map +1 -0
- package/lib/screens/Teams/Teams.js +136 -111
- package/lib/screens/Teams/Teams.js.map +1 -1
- package/lib/screens/Teams/useTeams.js +104 -0
- package/lib/screens/Teams/useTeams.js.map +1 -0
- package/package.json +3 -3
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import React__default,{useState,useEffect,
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
const windowWidth = Dimensions.get("window").width;
|
|
21
|
-
const windowHeight = Dimensions.get("window").height;
|
|
1
|
+
import React__default,{useState,useEffect,useRef}from'react';import {Box,HStack,Text,ScrollView,Avatar,AvatarImage,AvatarFallbackText,AvatarBadge}from'@admin-layout/gluestack-ui-mobile';import {Keyboard,TouchableOpacity,SafeAreaView,StyleSheet,View,TextInput,Dimensions}from'react-native';import {RoomType}from'common';import {useGetChannelsByUserLazyQuery,useGetOrganizationMembersWithChannelsQuery}from'common/graphql';import {MaterialIcons,Feather,SimpleLineIcons,Octicons}from'@expo/vector-icons';import {useNavigation,useIsFocused,useFocusEffect}from'@react-navigation/native';import {userSelector}from'@adminide-stack/user-auth0-client';import {useSelector}from'react-redux';import {startCase,uniqBy}from'lodash-es';import'expo-font';import'expo-splash-screen';import {useDrawerLayout}from'../../hooks/useDrawerLayout.js';import'../../hooks/useExpoNotificationProvider.js';Dimensions.get("window").width;
|
|
2
|
+
Dimensions.get("window").height;
|
|
22
3
|
Dimensions.get("screen").height;
|
|
23
4
|
const defaultChannelType = [RoomType.Channel, RoomType.Private, RoomType.Public, RoomType.Direct];
|
|
24
5
|
const orgMemersDataFetchLimit = 10;
|
|
@@ -42,7 +23,6 @@ const useKeyboard = () => {
|
|
|
42
23
|
return keyboardHeight;
|
|
43
24
|
};
|
|
44
25
|
const SearchAddChannel = (props) => {
|
|
45
|
-
var _a, _b;
|
|
46
26
|
const navigation = useNavigation();
|
|
47
27
|
const {
|
|
48
28
|
orgName,
|
|
@@ -52,18 +32,14 @@ const SearchAddChannel = (props) => {
|
|
|
52
32
|
const user = useSelector(userSelector);
|
|
53
33
|
const [channels, setChannels] = useState([]);
|
|
54
34
|
const [initialOrgMembers, setInitialOrgMembers] = useState([]);
|
|
55
|
-
const [
|
|
56
|
-
const [
|
|
57
|
-
const [showChannels, setShowChannels] = useState(false);
|
|
35
|
+
const [selectedItems, setSelectedItems] = useState([]);
|
|
36
|
+
const [searchText, setSearchText] = useState("");
|
|
58
37
|
const [offset, setOffset] = useState(0);
|
|
59
|
-
const [organizationMembers, setOrganizationMembers] = useState([]);
|
|
60
|
-
const [totalMembers, setTotalMembers] = useState(0);
|
|
61
38
|
const [channelId, setChannelId] = useState(null);
|
|
62
|
-
const [isSetInputFocusOut, setInputFocusOut] = useState(false);
|
|
63
39
|
const [isCreateNewChannel, setIsCreateNewChannel] = useState(false);
|
|
64
40
|
useKeyboard();
|
|
41
|
+
const inputRef = useRef(null);
|
|
65
42
|
const [tags, setTags] = useState([]);
|
|
66
|
-
const labelExtractor = (tag) => (tag == null ? void 0 : tag.id) ? tag == null ? void 0 : tag.id : tag == null ? void 0 : tag.userId;
|
|
67
43
|
const [getChannelByUser, {
|
|
68
44
|
loading: isChannelByUserLoading
|
|
69
45
|
}] = useGetChannelsByUserLazyQuery();
|
|
@@ -106,31 +82,31 @@ const SearchAddChannel = (props) => {
|
|
|
106
82
|
});
|
|
107
83
|
}, []);
|
|
108
84
|
React__default.useEffect(() => {
|
|
109
|
-
var
|
|
85
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
110
86
|
if (data == null ? void 0 : data.channelsByUser) {
|
|
111
|
-
const allChannels = (_d = (_c = (
|
|
112
|
-
var
|
|
113
|
-
return ch.type == RoomType.Direct && ((
|
|
114
|
-
var
|
|
115
|
-
return ((
|
|
87
|
+
const allChannels = (_d = (_c = (_b = (_a = data == null ? void 0 : data.channelsByUser) == null ? void 0 : _a.filter((ch) => {
|
|
88
|
+
var _a2, _b2, _c2;
|
|
89
|
+
return ch.type == RoomType.Direct && ((_a2 = ch == null ? void 0 : ch.members) == null ? void 0 : _a2.length) == 1 && ((_b2 = ch == null ? void 0 : ch.members) == null ? void 0 : _b2.filter((ch2) => {
|
|
90
|
+
var _a3;
|
|
91
|
+
return ((_a3 = ch2 == null ? void 0 : ch2.user) == null ? void 0 : _a3.id) == (user == null ? void 0 : user.id);
|
|
116
92
|
})) ? ch : (_c2 = ch == null ? void 0 : ch.members) == null ? void 0 : _c2.filter((m) => {
|
|
117
|
-
var
|
|
118
|
-
return ((
|
|
93
|
+
var _a3;
|
|
94
|
+
return ((_a3 = m == null ? void 0 : m.user) == null ? void 0 : _a3.id) != (user == null ? void 0 : user.id);
|
|
119
95
|
});
|
|
120
|
-
})) == null ? void 0 :
|
|
121
|
-
var
|
|
96
|
+
})) == null ? void 0 : _b.map((i) => {
|
|
97
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
122
98
|
const ch = {
|
|
123
99
|
id: i == null ? void 0 : i.id,
|
|
124
100
|
title: i == null ? void 0 : i.title,
|
|
125
101
|
type: i == null ? void 0 : i.type
|
|
126
102
|
};
|
|
127
|
-
const channelMembers = (_c2 = (
|
|
128
|
-
var
|
|
129
|
-
return ((
|
|
103
|
+
const channelMembers = (_c2 = (_b2 = (_a2 = i.members) == null ? void 0 : _a2.map((m) => m == null ? void 0 : m.user)) == null ? void 0 : _b2.filter((ch2) => {
|
|
104
|
+
var _a3;
|
|
105
|
+
return ((_a3 = i.members) == null ? void 0 : _a3.length) == 1 && (ch2 == null ? void 0 : ch2.id) == (user == null ? void 0 : user.id) ? ch2 : (ch2 == null ? void 0 : ch2.id) != (user == null ? void 0 : user.id);
|
|
130
106
|
})) != null ? _c2 : null;
|
|
131
107
|
const title = ch.type == RoomType.Direct ? (_f2 = (_e2 = (_d2 = channelMembers == null ? void 0 : channelMembers.map((u) => {
|
|
132
|
-
var
|
|
133
|
-
return (u == null ? void 0 : u.givenName) + " " + ((
|
|
108
|
+
var _a3;
|
|
109
|
+
return (u == null ? void 0 : u.givenName) + " " + ((_a3 = u == null ? void 0 : u.familyName) != null ? _a3 : "");
|
|
134
110
|
})) == null ? void 0 : _d2.filter((mu) => mu)) == null ? void 0 : _e2.join(", ")) != null ? _f2 : "" : ch.title;
|
|
135
111
|
ch.title = title;
|
|
136
112
|
ch.channelImage = (_g2 = channelMembers[0]) == null ? void 0 : _g2.picture;
|
|
@@ -142,20 +118,20 @@ const SearchAddChannel = (props) => {
|
|
|
142
118
|
return ch;
|
|
143
119
|
})) == null ? void 0 : _c.filter((ch) => ch)) != null ? _d : [];
|
|
144
120
|
const existingDirectChannelsToDelete = new Set((_f = (_e = data == null ? void 0 : data.channelsByUser) == null ? void 0 : _e.map((ch) => {
|
|
145
|
-
var
|
|
146
|
-
return (
|
|
147
|
-
var
|
|
148
|
-
return (
|
|
121
|
+
var _a2;
|
|
122
|
+
return (_a2 = ch == null ? void 0 : ch.members) == null ? void 0 : _a2.map((m) => {
|
|
123
|
+
var _a3;
|
|
124
|
+
return (_a3 = m == null ? void 0 : m.user) == null ? void 0 : _a3.id;
|
|
149
125
|
});
|
|
150
126
|
})) == null ? void 0 : _f.flat(1));
|
|
151
127
|
const allOrgMembers = (_k = (_j = (_i = (_h = (_g = data == null ? void 0 : data.getOrganizationMembers) == null ? void 0 : _g.data) == null ? void 0 : _h.filter((m) => {
|
|
152
|
-
var
|
|
153
|
-
return ((
|
|
128
|
+
var _a2;
|
|
129
|
+
return ((_a2 = m == null ? void 0 : m.user) == null ? void 0 : _a2.id) != (user == null ? void 0 : user.id);
|
|
154
130
|
}).filter((obj) => !existingDirectChannelsToDelete.has(obj == null ? void 0 : obj.userId))) == null ? void 0 : _i.map((i) => {
|
|
155
|
-
var
|
|
131
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
156
132
|
const ch = {
|
|
157
133
|
id: null,
|
|
158
|
-
title: ((
|
|
134
|
+
title: ((_a2 = i == null ? void 0 : i.user) == null ? void 0 : _a2.givenName) + " " + ((_b2 = i == null ? void 0 : i.user) == null ? void 0 : _b2.familyName),
|
|
159
135
|
type: RoomType.Direct,
|
|
160
136
|
channelImage: (_c2 = i == null ? void 0 : i.user) == null ? void 0 : _c2.picture,
|
|
161
137
|
imageAcronym: startCase((_e2 = (_d2 = i == null ? void 0 : i.user) == null ? void 0 : _d2.username) == null ? void 0 : _e2.charAt(0)),
|
|
@@ -177,20 +153,20 @@ const SearchAddChannel = (props) => {
|
|
|
177
153
|
}
|
|
178
154
|
}, [data]);
|
|
179
155
|
React__default.useEffect(() => {
|
|
180
|
-
var
|
|
156
|
+
var _a;
|
|
181
157
|
if (channelId && (tags == null ? void 0 : tags.length) === 0)
|
|
182
158
|
setChannelId(null);
|
|
183
159
|
if (!channelId && (tags == null ? void 0 : tags.length) > 0) {
|
|
184
|
-
const userIds = [...new Set((
|
|
185
|
-
var
|
|
186
|
-
return (t == null ? void 0 : t.userId) ? t == null ? void 0 : t.userId : (
|
|
187
|
-
})) == null ? void 0 :
|
|
160
|
+
const userIds = [...new Set((_a = tags == null ? void 0 : tags.map((t) => {
|
|
161
|
+
var _a2;
|
|
162
|
+
return (t == null ? void 0 : t.userId) ? t == null ? void 0 : t.userId : (_a2 = t == null ? void 0 : t.members) == null ? void 0 : _a2.map((m) => m == null ? void 0 : m.id);
|
|
163
|
+
})) == null ? void 0 : _a.flat(1))];
|
|
188
164
|
getChannelId(userIds);
|
|
189
165
|
}
|
|
190
166
|
console.log("channelid", channelId, " tags?.length", tags == null ? void 0 : tags.length);
|
|
191
167
|
}, [channelId, tags, orgName]);
|
|
192
168
|
const getChannelId = React__default.useCallback(async (userIds) => {
|
|
193
|
-
var
|
|
169
|
+
var _a, _b, _c, _d, _e;
|
|
194
170
|
const res = await getChannelByUser({
|
|
195
171
|
variables: {
|
|
196
172
|
criteria: {
|
|
@@ -203,160 +179,226 @@ const SearchAddChannel = (props) => {
|
|
|
203
179
|
limit: 1
|
|
204
180
|
}
|
|
205
181
|
});
|
|
206
|
-
if (((
|
|
182
|
+
if (((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.channelsByUser) == null ? void 0 : _b.length) > 0) {
|
|
207
183
|
setChannelId((_e = (_d = (_c = res == null ? void 0 : res.data) == null ? void 0 : _c.channelsByUser) == null ? void 0 : _d[0]) == null ? void 0 : _e.id);
|
|
208
|
-
setInputFocusOut(true);
|
|
209
184
|
setIsCreateNewChannel(false);
|
|
210
185
|
} else {
|
|
211
186
|
setChannelId(null);
|
|
212
|
-
setInputFocusOut(false);
|
|
213
187
|
setIsCreateNewChannel(true);
|
|
214
188
|
}
|
|
215
189
|
}, [orgName, user]);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
userId: item == null ? void 0 : item.userId
|
|
223
|
-
}] : selectedChannels == null ? void 0 : selectedChannels.filter((ch) => (item == null ? void 0 : item.isOrgMembers) ? (ch == null ? void 0 : ch.userId) !== (item == null ? void 0 : item.userId) : (ch == null ? void 0 : ch.id) !== (item == null ? void 0 : item.id));
|
|
224
|
-
setSelectedChannels(selectedChannelValue);
|
|
225
|
-
}
|
|
226
|
-
}, [selectedChannels]);
|
|
227
|
-
const openInbox = React__default.useCallback((item) => {
|
|
228
|
-
}, [orgName]);
|
|
229
|
-
const renderChannelSuggestions = useCallback((item, onPress, index) => {
|
|
230
|
-
var _a2, _b2, _c, _d;
|
|
231
|
-
return /* @__PURE__ */ React__default.createElement(TouchableOpacity, { key: `channel-suggestions-${index}`, style: {
|
|
232
|
-
marginVertical: 10
|
|
233
|
-
}, onPress: () => onPress(item) }, /* @__PURE__ */ React__default.createElement(HStack, { className: "flex-1 bg-white items-center justify-between" }, /* @__PURE__ */ React__default.createElement(HStack, { className: "flex-1 items-center", space: "sm" }, /* @__PURE__ */ React__default.createElement(Box, { className: "m-0 p-0" }, item.type == RoomType.Direct ? /* @__PURE__ */ React__default.createElement(Avatar, { size: "sm", className: "bg-transparent" }, /* @__PURE__ */ React__default.createElement(AvatarFallbackText, null, item == null ? void 0 : item.imageAcronym), /* @__PURE__ */ React__default.createElement(AvatarImage, { alt: "image", style: {
|
|
234
|
-
borderRadius: 6,
|
|
235
|
-
borderWidth: 2,
|
|
236
|
-
borderColor: "#fff"
|
|
237
|
-
}, source: {
|
|
238
|
-
uri: item == null ? void 0 : item.channelImage
|
|
239
|
-
} }), (item == null ? void 0 : item.totalMembers) > 1 ? /* @__PURE__ */ React__default.createElement(AvatarBadge, { style: {
|
|
240
|
-
width: 20,
|
|
241
|
-
height: 20
|
|
242
|
-
}, className: "right-[-1px] bottom-[-1px] items-center bg-[#211627] rounded-md" }, /* @__PURE__ */ React__default.createElement(Text, { style: {
|
|
243
|
-
fontSize: 12,
|
|
244
|
-
fontWeight: "bold",
|
|
245
|
-
color: "#fff"
|
|
246
|
-
} }, item == null ? void 0 : item.totalMembers)) : /* @__PURE__ */ React__default.createElement(AvatarBadge, { style: {
|
|
247
|
-
width: 10,
|
|
248
|
-
height: 10
|
|
249
|
-
}, className: "bg-green-800" })) : item.type == RoomType.Private ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Octicons, { color: "black", name: "lock", size: 20 })) : /* @__PURE__ */ React__default.createElement(Octicons, { color: "black", name: "hash", size: 20 })), /* @__PURE__ */ React__default.createElement(Text, { className: "text-gray-800 font-bold" }, item.title)), /* @__PURE__ */ React__default.createElement(Checkbox, { value: item == null ? void 0 : item.id, isChecked: selectedChannels && ((_a2 = selectedChannels == null ? void 0 : selectedChannels.filter((ch) => (ch == null ? void 0 : ch.id) === (item == null ? void 0 : item.id) && (ch == null ? void 0 : ch.userId) === (item == null ? void 0 : item.userId))) == null ? void 0 : _a2.length) > 0 ? true : false, accessibilityLabel: (_b2 = item.title) != null ? _b2 : "", "aria-label": (_c = item.title) != null ? _c : "", "aria-labelledby": (_d = item.title) != null ? _d : "", className: "border-gray-600" }, /* @__PURE__ */ React__default.createElement(CheckboxIndicator, null, /* @__PURE__ */ React__default.createElement(CheckboxIcon, { as: CheckIcon })))));
|
|
250
|
-
}, []);
|
|
251
|
-
const onSuggestionPress = useCallback((item) => {
|
|
252
|
-
var _a2, _b2;
|
|
253
|
-
if (tags) {
|
|
254
|
-
const findIndex = tags == null ? void 0 : tags.findIndex((ch) => (ch == null ? void 0 : ch.id) == (item == null ? void 0 : item.id) && (ch == null ? void 0 : ch.userId) == (item == null ? void 0 : item.userId));
|
|
255
|
-
if (findIndex === -1) {
|
|
256
|
-
if ((item == null ? void 0 : item.id) && (item == null ? void 0 : item.type) !== RoomType.Direct) {
|
|
257
|
-
setChannelId(item == null ? void 0 : item.id);
|
|
258
|
-
setInputFocusOut(true);
|
|
259
|
-
setTags([item]);
|
|
260
|
-
} else {
|
|
261
|
-
const previousTags = (_a2 = tags == null ? void 0 : tags.filter((t) => (t == null ? void 0 : t.type) === (item == null ? void 0 : item.type))) != null ? _a2 : [];
|
|
262
|
-
const currentTags = [...previousTags != null ? previousTags : [], item];
|
|
263
|
-
setTags(currentTags);
|
|
264
|
-
const userIds = [...new Set((_b2 = currentTags == null ? void 0 : currentTags.map((t) => {
|
|
265
|
-
var _a3;
|
|
266
|
-
return (t == null ? void 0 : t.userId) ? t == null ? void 0 : t.userId : (_a3 = t == null ? void 0 : t.members) == null ? void 0 : _a3.map((m) => m == null ? void 0 : m.id);
|
|
267
|
-
})) == null ? void 0 : _b2.flat(1))];
|
|
268
|
-
getChannelId(userIds);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}, [tags, orgName]);
|
|
273
|
-
const onTagPress = useCallback((item) => {
|
|
274
|
-
if (tags) {
|
|
275
|
-
const filteredValue = tags == null ? void 0 : tags.filter((ch) => (item == null ? void 0 : item.isOrgMembers) ? (ch == null ? void 0 : ch.userId) !== (item == null ? void 0 : item.userId) : (ch == null ? void 0 : ch.id) !== (item == null ? void 0 : item.id));
|
|
276
|
-
setTags(filteredValue);
|
|
277
|
-
console.log("tagpress");
|
|
190
|
+
const toggleItemSelection = (item) => {
|
|
191
|
+
const itemExists = selectedItems.some((selectedItem) => selectedItem.id && selectedItem.id === item.id || selectedItem.userId && selectedItem.userId === item.userId);
|
|
192
|
+
if (itemExists) {
|
|
193
|
+
setSelectedItems(selectedItems.filter((selectedItem) => !(selectedItem.id && selectedItem.id === item.id || selectedItem.userId && selectedItem.userId === item.userId)));
|
|
194
|
+
} else {
|
|
195
|
+
setSelectedItems([...selectedItems, item]);
|
|
278
196
|
}
|
|
279
|
-
}
|
|
280
|
-
const
|
|
281
|
-
return
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}, []);
|
|
292
|
-
const renderTag = useCallback((item, onPress, index) => {
|
|
293
|
-
var _a2;
|
|
294
|
-
return /* @__PURE__ */ React__default.createElement(TouchableOpacity, { onPress: () => onPress(item), key: `channel-tags-${index}` }, item.isOrgMembers || (item == null ? void 0 : item.type) != RoomType.Direct ? /* @__PURE__ */ React__default.createElement(Box, { className: "mx-1" }, renderTagItem(item == null ? void 0 : item.title, item == null ? void 0 : item.type, item == null ? void 0 : item.channelImage, item == null ? void 0 : item.imageAcronym, index)) : /* @__PURE__ */ React__default.createElement(HStack, { className: "items-center py-1", space: "sm" }, (_a2 = item == null ? void 0 : item.members) == null ? void 0 : _a2.map((m, i) => {
|
|
295
|
-
var _a3;
|
|
296
|
-
const title = (item == null ? void 0 : item.type) == RoomType.Direct ? (m == null ? void 0 : m.givenName) + " " + (m == null ? void 0 : m.familyName) : item.title;
|
|
297
|
-
const acronym = startCase((_a3 = m == null ? void 0 : m.username) == null ? void 0 : _a3.charAt(0));
|
|
298
|
-
return renderTagItem(title, item == null ? void 0 : item.type, m == null ? void 0 : m.picture, acronym, i);
|
|
299
|
-
})));
|
|
300
|
-
}, []);
|
|
301
|
-
return /* @__PURE__ */ React__default.createElement(Box, { className: `flex-1 bg-white w-[${windowWidth}] h-[${windowHeight}]` }, /* @__PURE__ */ React__default.createElement(
|
|
302
|
-
SlackInput,
|
|
303
|
-
{
|
|
304
|
-
tags,
|
|
305
|
-
suggestions: channels,
|
|
306
|
-
onChangeTags: setTags,
|
|
307
|
-
labelExtractor,
|
|
308
|
-
allowCustomTags: false,
|
|
309
|
-
isSetInputFocusOut,
|
|
310
|
-
renderLeftElement: () => /* @__PURE__ */ React__default.createElement(Text, { className: "pl-4 pr-1 text-[15px]" }, "To:"),
|
|
311
|
-
tagContainerStyle: {
|
|
312
|
-
borderBottomWidth: 1,
|
|
313
|
-
borderColor: "#D3D3D3",
|
|
314
|
-
paddingVertical: 5
|
|
315
|
-
},
|
|
316
|
-
inputProps: {
|
|
317
|
-
placeholder: "Search for a channel or conversation",
|
|
318
|
-
placeholderTextColor: "#404040",
|
|
319
|
-
autoCapitalize: "none",
|
|
320
|
-
autoCorrect: false
|
|
321
|
-
},
|
|
322
|
-
inputStyle: {
|
|
323
|
-
fontSize: 15,
|
|
324
|
-
height: 30
|
|
325
|
-
},
|
|
326
|
-
flatListGluestackUiProps: {
|
|
327
|
-
flex: 1,
|
|
328
|
-
pb: "$10",
|
|
329
|
-
contentContainerStyle: {
|
|
330
|
-
flex: 1,
|
|
331
|
-
marginBottom: 100,
|
|
332
|
-
backgroundColor: "white",
|
|
333
|
-
paddingHorizontal: 10
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
flatListStyle: {
|
|
337
|
-
maxHeight: "100%",
|
|
338
|
-
maxWidth: "100%"
|
|
339
|
-
},
|
|
340
|
-
renderSuggestion: renderChannelSuggestions,
|
|
341
|
-
filterSuggestions: (text) => {
|
|
342
|
-
if (!text || text === "") {
|
|
343
|
-
return [];
|
|
344
|
-
}
|
|
345
|
-
return channels == null ? void 0 : channels.filter((item) => {
|
|
346
|
-
var _a2, _b2;
|
|
347
|
-
return (_b2 = (_a2 = item == null ? void 0 : item.title) == null ? void 0 : _a2.toLowerCase()) == null ? void 0 : _b2.includes(text == null ? void 0 : text.toLowerCase());
|
|
348
|
-
});
|
|
349
|
-
},
|
|
350
|
-
onSuggestionPress,
|
|
351
|
-
renderTag,
|
|
352
|
-
onTagPress
|
|
197
|
+
};
|
|
198
|
+
const isItemSelected = (item) => {
|
|
199
|
+
return selectedItems.some((selectedItem) => selectedItem.id && selectedItem.id === item.id || selectedItem.userId && selectedItem.userId === item.userId);
|
|
200
|
+
};
|
|
201
|
+
const renderSelectedItemChip = (item, index) => {
|
|
202
|
+
return /* @__PURE__ */ React__default.createElement(View, { key: index, style: styles.chipContainer }, /* @__PURE__ */ React__default.createElement(Avatar, { size: "xs", style: styles.chipAvatar }, item.channelImage ? /* @__PURE__ */ React__default.createElement(AvatarImage, { source: {
|
|
203
|
+
uri: item.channelImage
|
|
204
|
+
}, alt: item.title }) : /* @__PURE__ */ React__default.createElement(AvatarFallbackText, null, item.imageAcronym || item.title.charAt(0))), /* @__PURE__ */ React__default.createElement(Text, { style: styles.chipText }, item.title));
|
|
205
|
+
};
|
|
206
|
+
const renderListItem = (item, index) => {
|
|
207
|
+
if (item.type === "header") {
|
|
208
|
+
return /* @__PURE__ */ React__default.createElement(HStack, { key: index, style: styles.sectionHeader }, /* @__PURE__ */ React__default.createElement(SimpleLineIcons, { name: "bell", size: 16, color: "#2563EB" }), /* @__PURE__ */ React__default.createElement(Text, { style: styles.sectionHeaderText }, item.title));
|
|
353
209
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
210
|
+
return /* @__PURE__ */ React__default.createElement(HStack, { key: index, style: styles.listItem }, /* @__PURE__ */ React__default.createElement(HStack, { style: styles.listItemLeft }, item.type == RoomType.Channel && /* @__PURE__ */ React__default.createElement(View, { style: styles.iconContainer }, /* @__PURE__ */ React__default.createElement(Octicons, { name: "hash", size: 20, color: "#000" })), item.type == RoomType.Private && /* @__PURE__ */ React__default.createElement(View, { style: styles.iconContainer }, /* @__PURE__ */ React__default.createElement(Octicons, { name: "lock", size: 20, color: "#000" })), item.type == RoomType.Direct && /* @__PURE__ */ React__default.createElement(Avatar, { size: "sm", style: styles.userAvatar }, item.channelImage ? /* @__PURE__ */ React__default.createElement(AvatarImage, { source: {
|
|
211
|
+
uri: item.channelImage
|
|
212
|
+
}, alt: item.title }) : /* @__PURE__ */ React__default.createElement(AvatarFallbackText, null, item.title.charAt(0)), /* @__PURE__ */ React__default.createElement(AvatarBadge, { style: styles.onlineBadge })), /* @__PURE__ */ React__default.createElement(HStack, { style: styles.titleContainer }, /* @__PURE__ */ React__default.createElement(Text, { style: styles.itemTitle }, item.title), item.type === "app" && /* @__PURE__ */ React__default.createElement(View, { style: styles.appLabel }, /* @__PURE__ */ React__default.createElement(Text, { style: styles.appLabelText }, "APP")))), /* @__PURE__ */ React__default.createElement(TouchableOpacity, { onPress: () => toggleItemSelection(item) }, isItemSelected(item) ? /* @__PURE__ */ React__default.createElement(View, { style: styles.checkedBox }, /* @__PURE__ */ React__default.createElement(Feather, { name: "check", size: 18, color: "#fff" })) : /* @__PURE__ */ React__default.createElement(View, { style: styles.uncheckedBox })));
|
|
213
|
+
};
|
|
214
|
+
const listData = [{
|
|
215
|
+
id: "header1",
|
|
216
|
+
type: "header",
|
|
217
|
+
title: "Message with external people"
|
|
218
|
+
}, ...channels];
|
|
219
|
+
const filteredData = searchText.trim() ? listData.filter((item) => item.type !== "header" && item.title.toLowerCase().includes(searchText.toLowerCase())) : listData;
|
|
220
|
+
return /* @__PURE__ */ React__default.createElement(SafeAreaView, { style: {
|
|
221
|
+
flex: 1,
|
|
222
|
+
backgroundColor: "#fff"
|
|
223
|
+
} }, /* @__PURE__ */ React__default.createElement(Box, { style: styles.container }, /* @__PURE__ */ React__default.createElement(HStack, { style: styles.searchContainer }, /* @__PURE__ */ React__default.createElement(Text, { style: styles.toLabel }, "To:"), /* @__PURE__ */ React__default.createElement(View, { style: styles.chipContainerWrapper }, /* @__PURE__ */ React__default.createElement(View, { style: styles.chipWrapView }, selectedItems.map(renderSelectedItemChip), /* @__PURE__ */ React__default.createElement(TextInput, { ref: inputRef, style: styles.searchInput, placeholder: selectedItems.length ? "" : "Search for a channel or conversation", placeholderTextColor: "#9CA3AF", value: searchText, onChangeText: setSearchText })))), /* @__PURE__ */ React__default.createElement(ScrollView, { style: styles.listContainer }, filteredData.map(renderListItem)), /* @__PURE__ */ React__default.createElement(HStack, { style: styles.messageInputContainer }, /* @__PURE__ */ React__default.createElement(TextInput, { style: styles.messageInput, placeholder: `Message ${selectedItems.map((item) => item.title).join(", ")}`, placeholderTextColor: "#9CA3AF" }), /* @__PURE__ */ React__default.createElement(TouchableOpacity, { style: styles.sendButton }, /* @__PURE__ */ React__default.createElement(Feather, { name: "arrow-right", size: 22, color: "#fff" })))));
|
|
361
224
|
};
|
|
225
|
+
const styles = StyleSheet.create({
|
|
226
|
+
container: {
|
|
227
|
+
flex: 1,
|
|
228
|
+
backgroundColor: "#fff"
|
|
229
|
+
},
|
|
230
|
+
header: {
|
|
231
|
+
flexDirection: "row",
|
|
232
|
+
justifyContent: "space-between",
|
|
233
|
+
alignItems: "center",
|
|
234
|
+
paddingHorizontal: 16,
|
|
235
|
+
paddingVertical: 12,
|
|
236
|
+
borderBottomWidth: 1,
|
|
237
|
+
borderBottomColor: "#E5E5E5"
|
|
238
|
+
},
|
|
239
|
+
headerTitle: {
|
|
240
|
+
fontSize: 18,
|
|
241
|
+
fontWeight: "bold"
|
|
242
|
+
},
|
|
243
|
+
searchContainer: {
|
|
244
|
+
paddingHorizontal: 16,
|
|
245
|
+
paddingVertical: 12,
|
|
246
|
+
borderBottomWidth: 1,
|
|
247
|
+
borderBottomColor: "#E5E5E5",
|
|
248
|
+
flexDirection: "row",
|
|
249
|
+
alignItems: "flex-start"
|
|
250
|
+
},
|
|
251
|
+
toLabel: {
|
|
252
|
+
fontSize: 16,
|
|
253
|
+
marginRight: 8,
|
|
254
|
+
marginTop: 8,
|
|
255
|
+
color: "#374151"
|
|
256
|
+
},
|
|
257
|
+
chipContainerWrapper: {
|
|
258
|
+
flex: 1
|
|
259
|
+
},
|
|
260
|
+
chipWrapView: {
|
|
261
|
+
flexDirection: "row",
|
|
262
|
+
flexWrap: "wrap"
|
|
263
|
+
},
|
|
264
|
+
chipScrollView: {
|
|
265
|
+
flex: 1
|
|
266
|
+
},
|
|
267
|
+
chipScrollContent: {
|
|
268
|
+
alignItems: "center",
|
|
269
|
+
flexDirection: "row",
|
|
270
|
+
flexWrap: "wrap"
|
|
271
|
+
},
|
|
272
|
+
chipContainer: {
|
|
273
|
+
flexDirection: "row",
|
|
274
|
+
alignItems: "center",
|
|
275
|
+
backgroundColor: "#EFF6FF",
|
|
276
|
+
borderRadius: 4,
|
|
277
|
+
paddingHorizontal: 8,
|
|
278
|
+
paddingVertical: 6,
|
|
279
|
+
marginRight: 8,
|
|
280
|
+
marginBottom: 8
|
|
281
|
+
},
|
|
282
|
+
chipAvatar: {
|
|
283
|
+
width: 20,
|
|
284
|
+
height: 20,
|
|
285
|
+
marginRight: 4
|
|
286
|
+
},
|
|
287
|
+
chipText: {
|
|
288
|
+
color: "#1E40AF",
|
|
289
|
+
fontSize: 14
|
|
290
|
+
},
|
|
291
|
+
searchInput: {
|
|
292
|
+
flex: 1,
|
|
293
|
+
height: 40,
|
|
294
|
+
fontSize: 16,
|
|
295
|
+
minWidth: 100
|
|
296
|
+
},
|
|
297
|
+
listContainer: {
|
|
298
|
+
flex: 1
|
|
299
|
+
},
|
|
300
|
+
sectionHeader: {
|
|
301
|
+
flexDirection: "row",
|
|
302
|
+
alignItems: "center",
|
|
303
|
+
padding: 16,
|
|
304
|
+
paddingBottom: 8
|
|
305
|
+
},
|
|
306
|
+
sectionHeaderText: {
|
|
307
|
+
marginLeft: 8,
|
|
308
|
+
fontWeight: "bold",
|
|
309
|
+
fontSize: 16,
|
|
310
|
+
color: "#374151"
|
|
311
|
+
},
|
|
312
|
+
listItem: {
|
|
313
|
+
flexDirection: "row",
|
|
314
|
+
alignItems: "center",
|
|
315
|
+
justifyContent: "space-between",
|
|
316
|
+
paddingHorizontal: 16,
|
|
317
|
+
paddingVertical: 12
|
|
318
|
+
},
|
|
319
|
+
listItemLeft: {
|
|
320
|
+
flexDirection: "row",
|
|
321
|
+
alignItems: "center",
|
|
322
|
+
flex: 1
|
|
323
|
+
},
|
|
324
|
+
iconContainer: {
|
|
325
|
+
width: 24,
|
|
326
|
+
height: 24,
|
|
327
|
+
justifyContent: "center",
|
|
328
|
+
alignItems: "center",
|
|
329
|
+
marginRight: 12
|
|
330
|
+
},
|
|
331
|
+
userAvatar: {
|
|
332
|
+
marginRight: 12
|
|
333
|
+
},
|
|
334
|
+
onlineBadge: {
|
|
335
|
+
width: 8,
|
|
336
|
+
height: 8,
|
|
337
|
+
backgroundColor: "#10B981",
|
|
338
|
+
borderWidth: 1,
|
|
339
|
+
borderColor: "#FFFFFF",
|
|
340
|
+
bottom: 0,
|
|
341
|
+
right: 0
|
|
342
|
+
},
|
|
343
|
+
titleContainer: {
|
|
344
|
+
flexDirection: "row",
|
|
345
|
+
alignItems: "center"
|
|
346
|
+
},
|
|
347
|
+
itemTitle: {
|
|
348
|
+
fontSize: 16,
|
|
349
|
+
color: "#1F2937"
|
|
350
|
+
},
|
|
351
|
+
appLabel: {
|
|
352
|
+
backgroundColor: "#E5E5E5",
|
|
353
|
+
borderRadius: 4,
|
|
354
|
+
paddingHorizontal: 6,
|
|
355
|
+
paddingVertical: 2,
|
|
356
|
+
marginLeft: 8
|
|
357
|
+
},
|
|
358
|
+
appLabelText: {
|
|
359
|
+
fontSize: 10,
|
|
360
|
+
fontWeight: "bold",
|
|
361
|
+
color: "#4B5563"
|
|
362
|
+
},
|
|
363
|
+
uncheckedBox: {
|
|
364
|
+
width: 22,
|
|
365
|
+
height: 22,
|
|
366
|
+
borderRadius: 4,
|
|
367
|
+
borderWidth: 1,
|
|
368
|
+
borderColor: "#D1D5DB"
|
|
369
|
+
},
|
|
370
|
+
checkedBox: {
|
|
371
|
+
width: 22,
|
|
372
|
+
height: 22,
|
|
373
|
+
borderRadius: 4,
|
|
374
|
+
backgroundColor: "#2563EB",
|
|
375
|
+
justifyContent: "center",
|
|
376
|
+
alignItems: "center"
|
|
377
|
+
},
|
|
378
|
+
messageInputContainer: {
|
|
379
|
+
borderTopWidth: 1,
|
|
380
|
+
borderTopColor: "#E5E5E5",
|
|
381
|
+
paddingHorizontal: 16,
|
|
382
|
+
paddingVertical: 12,
|
|
383
|
+
flexDirection: "row",
|
|
384
|
+
alignItems: "center"
|
|
385
|
+
},
|
|
386
|
+
messageInput: {
|
|
387
|
+
flex: 1,
|
|
388
|
+
height: 40,
|
|
389
|
+
backgroundColor: "#F9FAFB",
|
|
390
|
+
borderRadius: 20,
|
|
391
|
+
paddingHorizontal: 16,
|
|
392
|
+
marginRight: 12,
|
|
393
|
+
fontSize: 16
|
|
394
|
+
},
|
|
395
|
+
sendButton: {
|
|
396
|
+
width: 40,
|
|
397
|
+
height: 40,
|
|
398
|
+
borderRadius: 20,
|
|
399
|
+
backgroundColor: "#2563EB",
|
|
400
|
+
justifyContent: "center",
|
|
401
|
+
alignItems: "center"
|
|
402
|
+
}
|
|
403
|
+
});
|
|
362
404
|
var SearchAddChannel$1 = React__default.memo(SearchAddChannel);export{SearchAddChannel$1 as default,useKeyboard};//# sourceMappingURL=SearchAddChannel.js.map
|