@poolse/react-native 3.2.0 → 3.4.0
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/CHANGELOG.md +74 -0
- package/README.md +55 -4
- package/dist/index.cjs +1633 -801
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +311 -121
- package/dist/index.d.ts +311 -121
- package/dist/index.js +1634 -802
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useUser, useMe, useConversations, formatCallLogPreview, useAttachmentUpload, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, formatDayLabel, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl, usePoolse } from '@poolse/react';
|
|
2
2
|
import { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo, useCallback, useContext, createElement } from 'react';
|
|
3
|
-
import { StyleSheet, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Image, Keyboard, Platform, ScrollView, ActivityIndicator, FlatList, AppState, KeyboardAvoidingView, Modal, Linking } from 'react-native';
|
|
3
|
+
import { StyleSheet, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Image, Keyboard, Platform, ScrollView, ActivityIndicator, FlatList, AppState, KeyboardAvoidingView, Modal, Linking, useColorScheme } from 'react-native';
|
|
4
|
+
import { toNativeTheme, isBuiltInThemeId } from '@poolse/theme';
|
|
4
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
6
|
import { SvgXml, Svg, Path, Circle, G } from 'react-native-svg';
|
|
6
7
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -152,28 +153,172 @@ var defaultDarkTheme = {
|
|
|
152
153
|
spacing,
|
|
153
154
|
shadows: darkShadows
|
|
154
155
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
156
|
+
function legacyToNative(l) {
|
|
157
|
+
const c = l.colors;
|
|
158
|
+
return {
|
|
159
|
+
id: "default",
|
|
160
|
+
name: "Default",
|
|
161
|
+
scheme: l.mode,
|
|
162
|
+
colors: {
|
|
163
|
+
background: c.paper,
|
|
164
|
+
surface: c.surface,
|
|
165
|
+
surfaceAlt: c.surface2,
|
|
166
|
+
text: c.ink,
|
|
167
|
+
textMuted: c.ink2,
|
|
168
|
+
textSubtle: c.ink3,
|
|
169
|
+
border: c.border,
|
|
170
|
+
accent: c.brand,
|
|
171
|
+
accentText: c.onBrand,
|
|
172
|
+
accentSoft: c.brandSoft,
|
|
173
|
+
accentStrong: c.brandStrong,
|
|
174
|
+
// Links in other people's bubbles have always been brand-coloured.
|
|
175
|
+
link: c.brand,
|
|
176
|
+
sidebar: c.surface2,
|
|
177
|
+
sidebarText: c.ink,
|
|
178
|
+
sidebarActive: c.brandSoft,
|
|
179
|
+
sidebarActiveText: c.brandStrong,
|
|
180
|
+
badge: c.unreadPill,
|
|
181
|
+
badgeText: c.unreadPillText,
|
|
182
|
+
mention: c.brandSoft,
|
|
183
|
+
mentionText: c.brandStrong,
|
|
184
|
+
danger: c.error,
|
|
185
|
+
warning: c.warning,
|
|
186
|
+
success: c.success,
|
|
187
|
+
info: c.info,
|
|
188
|
+
presence: c.presence,
|
|
189
|
+
ownBubble: c.selfBubble,
|
|
190
|
+
ownBubbleText: c.selfBubbleText,
|
|
191
|
+
otherBubble: c.otherBubble,
|
|
192
|
+
otherBubbleText: c.otherBubbleText,
|
|
193
|
+
overlay: "#00000073"
|
|
194
|
+
},
|
|
195
|
+
fonts: {
|
|
196
|
+
body: l.type.fontBody,
|
|
197
|
+
display: l.type.fontDisplay,
|
|
198
|
+
mono: l.type.fontMono,
|
|
199
|
+
sizeXs: 11,
|
|
200
|
+
sizeSm: 13,
|
|
201
|
+
sizeMd: l.type.bodySize,
|
|
202
|
+
sizeLg: 17,
|
|
203
|
+
sizeXl: 20,
|
|
204
|
+
lineHeight: l.type.lineHeight
|
|
205
|
+
},
|
|
206
|
+
radii: { ...l.radii },
|
|
207
|
+
spacing: { ...l.spacing },
|
|
208
|
+
shadows: { sm: l.shadows.sm, md: l.shadows.md, lg: l.shadows.lg }
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function nativeToLegacy(n) {
|
|
212
|
+
const c = n.colors;
|
|
213
|
+
return {
|
|
214
|
+
mode: n.scheme,
|
|
215
|
+
colors: {
|
|
216
|
+
brand: c.accent,
|
|
217
|
+
brandStrong: c.accentStrong,
|
|
218
|
+
brandSoft: c.accentSoft,
|
|
219
|
+
onBrand: c.accentText,
|
|
220
|
+
paper: c.background,
|
|
221
|
+
surface: c.surface,
|
|
222
|
+
surface2: c.surfaceAlt,
|
|
223
|
+
ink: c.text,
|
|
224
|
+
ink2: c.textMuted,
|
|
225
|
+
ink3: c.textSubtle,
|
|
226
|
+
border: c.border,
|
|
227
|
+
presence: c.presence,
|
|
228
|
+
success: c.success,
|
|
229
|
+
warning: c.warning,
|
|
230
|
+
error: c.danger,
|
|
231
|
+
info: c.info,
|
|
232
|
+
selfBubble: c.ownBubble,
|
|
233
|
+
selfBubbleText: c.ownBubbleText,
|
|
234
|
+
otherBubble: c.otherBubble,
|
|
235
|
+
otherBubbleText: c.otherBubbleText,
|
|
236
|
+
unreadPill: c.badge,
|
|
237
|
+
unreadPillText: c.badgeText
|
|
238
|
+
},
|
|
239
|
+
type: {
|
|
240
|
+
...type,
|
|
241
|
+
fontDisplay: n.fonts.display,
|
|
242
|
+
fontBody: n.fonts.body,
|
|
243
|
+
fontMono: n.fonts.mono,
|
|
244
|
+
bodySize: n.fonts.sizeMd,
|
|
245
|
+
lineHeight: n.fonts.lineHeight
|
|
246
|
+
},
|
|
247
|
+
radii: { ...n.radii },
|
|
248
|
+
spacing: { ...n.spacing },
|
|
249
|
+
shadows: { ...n.shadows }
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function isTheme(value) {
|
|
253
|
+
return typeof value === "object" && value !== null && "light" in value && "dark" in value && "id" in value;
|
|
254
|
+
}
|
|
255
|
+
function mergeLegacy(base, theme) {
|
|
256
|
+
return {
|
|
257
|
+
mode: theme.mode ?? base.mode,
|
|
258
|
+
colors: { ...base.colors, ...theme.colors },
|
|
259
|
+
type: { ...base.type, ...theme.type },
|
|
260
|
+
radii: { ...base.radii, ...theme.radii },
|
|
261
|
+
spacing: { ...base.spacing, ...theme.spacing },
|
|
262
|
+
shadows: {
|
|
263
|
+
sm: { ...base.shadows.sm, ...theme.shadows?.sm },
|
|
264
|
+
md: { ...base.shadows.md, ...theme.shadows?.md },
|
|
265
|
+
lg: { ...base.shadows.lg, ...theme.shadows?.lg }
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function isNamedTheme(theme) {
|
|
270
|
+
return isBuiltInThemeId(theme) || isTheme(theme);
|
|
271
|
+
}
|
|
272
|
+
function selectedScheme(selection, system) {
|
|
273
|
+
const { theme } = selection;
|
|
274
|
+
const named = isNamedTheme(theme);
|
|
275
|
+
const legacyMode = !named && theme ? theme.mode : void 0;
|
|
276
|
+
const preference = selection.colorScheme ?? selection.mode ?? legacyMode ?? (named ? "system" : "light");
|
|
277
|
+
return preference === "system" ? system : preference;
|
|
278
|
+
}
|
|
279
|
+
function resolveThemeValue(selection, scheme) {
|
|
280
|
+
const { theme, fonts } = selection;
|
|
281
|
+
if (isNamedTheme(theme)) {
|
|
282
|
+
const native = toNativeTheme(theme, scheme, {
|
|
283
|
+
fonts: {
|
|
284
|
+
...fonts?.body ? { body: fonts.body } : {},
|
|
285
|
+
...fonts?.display ? { display: fonts.display } : {},
|
|
286
|
+
...fonts?.mono ? { mono: fonts.mono } : {}
|
|
170
287
|
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
|
|
288
|
+
});
|
|
289
|
+
return { native, legacy: nativeToLegacy(native) };
|
|
290
|
+
}
|
|
291
|
+
const base = scheme === "dark" ? defaultDarkTheme : defaultLightTheme;
|
|
292
|
+
const legacy = theme ? { ...mergeLegacy(base, theme), mode: scheme } : base;
|
|
293
|
+
return { native: legacyToNative(legacy), legacy };
|
|
294
|
+
}
|
|
295
|
+
var ThemeContext = createContext(null);
|
|
296
|
+
var FALLBACK = {
|
|
297
|
+
native: legacyToNative(defaultLightTheme)};
|
|
298
|
+
function PoolseTheme({ theme, colorScheme, mode, fonts, children }) {
|
|
299
|
+
const system = useColorScheme() === "dark" ? "dark" : "light";
|
|
300
|
+
const scheme = selectedScheme({ theme, colorScheme, mode }, system);
|
|
301
|
+
const fontBody = fonts?.body;
|
|
302
|
+
const fontDisplay = fonts?.display;
|
|
303
|
+
const fontMono = fonts?.mono;
|
|
304
|
+
const value = useMemo(
|
|
305
|
+
() => resolveThemeValue(
|
|
306
|
+
{
|
|
307
|
+
theme,
|
|
308
|
+
fonts: {
|
|
309
|
+
...fontBody ? { body: fontBody } : {},
|
|
310
|
+
...fontDisplay ? { display: fontDisplay } : {},
|
|
311
|
+
...fontMono ? { mono: fontMono } : {}
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
scheme
|
|
315
|
+
),
|
|
316
|
+
[theme, scheme, fontBody, fontDisplay, fontMono]
|
|
317
|
+
);
|
|
318
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children });
|
|
174
319
|
}
|
|
175
|
-
function
|
|
176
|
-
return useContext(ThemeContext) ??
|
|
320
|
+
function useTheme() {
|
|
321
|
+
return (useContext(ThemeContext) ?? FALLBACK).native;
|
|
177
322
|
}
|
|
178
323
|
|
|
179
324
|
// src/primitives/userColor.ts
|
|
@@ -202,13 +347,13 @@ function userColor(id) {
|
|
|
202
347
|
}
|
|
203
348
|
return PALETTE[Math.abs(h) % PALETTE.length];
|
|
204
349
|
}
|
|
205
|
-
var SIZES = { sm: 28, md: 40, lg: 56 };
|
|
350
|
+
var SIZES = { xs: 20, sm: 28, md: 40, lg: 56 };
|
|
206
351
|
function Avatar({ src, name, seed, online, size = "md" }) {
|
|
207
|
-
const theme =
|
|
352
|
+
const theme = useTheme();
|
|
208
353
|
const dim = SIZES[size];
|
|
209
354
|
const initials = computeInitials(name);
|
|
210
|
-
const tint = seed ? userColor(seed) : theme.colors.
|
|
211
|
-
const fontSize = size === "sm" ? 11 : size === "lg" ? 22 : 15;
|
|
355
|
+
const tint = seed ? userColor(seed) : theme.colors.accent;
|
|
356
|
+
const fontSize = size === "xs" ? 9 : size === "sm" ? 11 : size === "lg" ? 22 : 15;
|
|
212
357
|
return /* @__PURE__ */ jsxs(
|
|
213
358
|
View,
|
|
214
359
|
{
|
|
@@ -235,10 +380,10 @@ function Avatar({ src, name, seed, online, size = "md" }) {
|
|
|
235
380
|
Text,
|
|
236
381
|
{
|
|
237
382
|
style: {
|
|
238
|
-
color: theme.colors.
|
|
383
|
+
color: theme.colors.accentText,
|
|
239
384
|
fontSize,
|
|
240
385
|
fontWeight: "600",
|
|
241
|
-
fontFamily: theme.
|
|
386
|
+
fontFamily: theme.fonts.body
|
|
242
387
|
},
|
|
243
388
|
children: initials
|
|
244
389
|
}
|
|
@@ -545,10 +690,10 @@ var ICONS = {
|
|
|
545
690
|
}
|
|
546
691
|
};
|
|
547
692
|
function PoolseIcon({ name, size = 20, color, label }) {
|
|
548
|
-
const theme =
|
|
693
|
+
const theme = useTheme();
|
|
549
694
|
const def = ICONS[name];
|
|
550
695
|
if (!def) return null;
|
|
551
|
-
const stroke = color ?? theme.colors.
|
|
696
|
+
const stroke = color ?? theme.colors.text;
|
|
552
697
|
const xml = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${def.vb}" fill="none" stroke="${stroke}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${def.d}</svg>`;
|
|
553
698
|
const a11y = label === null ? { accessibilityRole: "none" } : { accessibilityRole: "image", accessibilityLabel: label ?? name };
|
|
554
699
|
return /* @__PURE__ */ jsx(SvgXml, { xml, width: size, height: size, ...a11y });
|
|
@@ -562,30 +707,30 @@ function MemberList({
|
|
|
562
707
|
renderItem,
|
|
563
708
|
emptyState
|
|
564
709
|
}) {
|
|
565
|
-
const theme =
|
|
710
|
+
const theme = useTheme();
|
|
566
711
|
const { members, loading, error, removeMember } = useMembers(conversationId);
|
|
567
712
|
const { online: presenceOnline } = usePresence(
|
|
568
713
|
onlineExternalIds === void 0 ? conversationId : ""
|
|
569
714
|
);
|
|
570
715
|
const effectiveOnline = onlineExternalIds ?? presenceOnline;
|
|
571
716
|
if (loading && members.length === 0) {
|
|
572
|
-
return /* @__PURE__ */ jsx(View, { style: [styles2.placeholder, { backgroundColor: theme.colors.
|
|
717
|
+
return /* @__PURE__ */ jsx(View, { style: [styles2.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }) });
|
|
573
718
|
}
|
|
574
719
|
if (error) {
|
|
575
|
-
return /* @__PURE__ */ jsxs(View, { style: [styles2.placeholder, { backgroundColor: theme.colors.
|
|
576
|
-
/* @__PURE__ */ jsx(Text, { style: { color: theme.colors.
|
|
577
|
-
error.message ? /* @__PURE__ */ jsx(Text, { style: [styles2.errorDetail, { color: theme.colors.
|
|
720
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles2.placeholder, { backgroundColor: theme.colors.background }], children: [
|
|
721
|
+
/* @__PURE__ */ jsx(Text, { style: { color: theme.colors.danger, fontFamily: theme.fonts.body }, children: "Failed to load members." }),
|
|
722
|
+
error.message ? /* @__PURE__ */ jsx(Text, { style: [styles2.errorDetail, { color: theme.colors.textSubtle }], children: error.message }) : null
|
|
578
723
|
] });
|
|
579
724
|
}
|
|
580
725
|
if (members.length === 0) {
|
|
581
|
-
return /* @__PURE__ */ jsx(View, { style: [styles2.placeholder, { backgroundColor: theme.colors.
|
|
726
|
+
return /* @__PURE__ */ jsx(View, { style: [styles2.placeholder, { backgroundColor: theme.colors.background }], children: typeof emptyState === "string" || emptyState == null ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState ?? "No members." }) : emptyState });
|
|
582
727
|
}
|
|
583
728
|
return /* @__PURE__ */ jsx(
|
|
584
729
|
FlatList,
|
|
585
730
|
{
|
|
586
731
|
data: members,
|
|
587
732
|
keyExtractor: (m) => m.user_id,
|
|
588
|
-
style: { backgroundColor: theme.colors.
|
|
733
|
+
style: { backgroundColor: theme.colors.background },
|
|
589
734
|
renderItem: ({ item }) => {
|
|
590
735
|
if (renderItem) return /* @__PURE__ */ jsx(Fragment, { children: renderItem(item) });
|
|
591
736
|
const isOnline = effectiveOnline.has(item.external_id);
|
|
@@ -613,7 +758,7 @@ function MemberRow({
|
|
|
613
758
|
avatarFor,
|
|
614
759
|
onRemove
|
|
615
760
|
}) {
|
|
616
|
-
const theme =
|
|
761
|
+
const theme = useTheme();
|
|
617
762
|
const resolved = useUser(externalId);
|
|
618
763
|
const name = labelFor?.(externalId) ?? resolved.profile?.displayName ?? externalId;
|
|
619
764
|
const avatarUrl = avatarFor?.(externalId) ?? resolved.profile?.avatarUrl ?? null;
|
|
@@ -623,14 +768,14 @@ function MemberRow({
|
|
|
623
768
|
/* @__PURE__ */ jsx(
|
|
624
769
|
Text,
|
|
625
770
|
{
|
|
626
|
-
style: [styles2.name, { color: theme.colors.
|
|
771
|
+
style: [styles2.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
|
|
627
772
|
numberOfLines: 1,
|
|
628
773
|
children: name
|
|
629
774
|
}
|
|
630
775
|
),
|
|
631
|
-
/* @__PURE__ */ jsx(Text, { style: [styles2.role, { color: theme.colors.
|
|
776
|
+
/* @__PURE__ */ jsx(Text, { style: [styles2.role, { color: theme.colors.textSubtle }], children: role })
|
|
632
777
|
] }),
|
|
633
|
-
onRemove ? /* @__PURE__ */ jsx(Pressable, { onPress: onRemove, hitSlop: 8, style: styles2.removeBtn, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.
|
|
778
|
+
onRemove ? /* @__PURE__ */ jsx(Pressable, { onPress: onRemove, hitSlop: 8, style: styles2.removeBtn, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
|
|
634
779
|
] });
|
|
635
780
|
}
|
|
636
781
|
var styles2 = StyleSheet.create({
|
|
@@ -725,7 +870,7 @@ function GroupDetailsSheet({
|
|
|
725
870
|
avatarFor,
|
|
726
871
|
canRemoveMember
|
|
727
872
|
}) {
|
|
728
|
-
const theme =
|
|
873
|
+
const theme = useTheme();
|
|
729
874
|
const { conversation } = useConversation(conversationId);
|
|
730
875
|
const { members } = useMembers(conversationId);
|
|
731
876
|
const insets = useSafeInsets();
|
|
@@ -759,7 +904,7 @@ function GroupDetailsSheet({
|
|
|
759
904
|
style: [
|
|
760
905
|
styles3.sheet,
|
|
761
906
|
{
|
|
762
|
-
backgroundColor: theme.colors.
|
|
907
|
+
backgroundColor: theme.colors.background,
|
|
763
908
|
borderTopLeftRadius: theme.radii.xl,
|
|
764
909
|
borderTopRightRadius: theme.radii.xl,
|
|
765
910
|
// Header stays below the status bar even on short screens.
|
|
@@ -772,16 +917,16 @@ function GroupDetailsSheet({
|
|
|
772
917
|
theme.shadows.lg
|
|
773
918
|
],
|
|
774
919
|
children: [
|
|
775
|
-
/* @__PURE__ */ jsx(View, { ...panHandlers, style: styles3.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles3.dragPill, { backgroundColor: theme.colors.
|
|
920
|
+
/* @__PURE__ */ jsx(View, { ...panHandlers, style: styles3.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles3.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
|
|
776
921
|
/* @__PURE__ */ jsxs(View, { style: styles3.headerRow, children: [
|
|
777
922
|
/* @__PURE__ */ jsx(
|
|
778
923
|
Pressable,
|
|
779
924
|
{
|
|
780
925
|
onPress: onClose,
|
|
781
926
|
hitSlop: 16,
|
|
782
|
-
style: [styles3.closeBtn, { backgroundColor: theme.colors.
|
|
927
|
+
style: [styles3.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
|
|
783
928
|
accessibilityLabel: "Close",
|
|
784
|
-
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.
|
|
929
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
|
|
785
930
|
}
|
|
786
931
|
),
|
|
787
932
|
/* @__PURE__ */ jsx(
|
|
@@ -789,7 +934,7 @@ function GroupDetailsSheet({
|
|
|
789
934
|
{
|
|
790
935
|
style: [
|
|
791
936
|
styles3.headerTitle,
|
|
792
|
-
{ color: theme.colors.
|
|
937
|
+
{ color: theme.colors.text, fontFamily: theme.fonts.display }
|
|
793
938
|
],
|
|
794
939
|
children: "Group details"
|
|
795
940
|
}
|
|
@@ -800,15 +945,12 @@ function GroupDetailsSheet({
|
|
|
800
945
|
/* @__PURE__ */ jsx(
|
|
801
946
|
Text,
|
|
802
947
|
{
|
|
803
|
-
style: [
|
|
804
|
-
styles3.title,
|
|
805
|
-
{ color: theme.colors.ink, fontFamily: theme.type.fontDisplay }
|
|
806
|
-
],
|
|
948
|
+
style: [styles3.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
|
|
807
949
|
numberOfLines: 1,
|
|
808
950
|
children: title
|
|
809
951
|
}
|
|
810
952
|
),
|
|
811
|
-
/* @__PURE__ */ jsx(Text, { style: [styles3.subtitle, { color: theme.colors.
|
|
953
|
+
/* @__PURE__ */ jsx(Text, { style: [styles3.subtitle, { color: theme.colors.textSubtle }], children: subtitle })
|
|
812
954
|
] }),
|
|
813
955
|
/* @__PURE__ */ jsx(View, { style: [styles3.divider, { backgroundColor: theme.colors.border }] }),
|
|
814
956
|
/* @__PURE__ */ jsx(View, { style: styles3.sectionLabelRow, children: /* @__PURE__ */ jsx(
|
|
@@ -816,7 +958,7 @@ function GroupDetailsSheet({
|
|
|
816
958
|
{
|
|
817
959
|
style: [
|
|
818
960
|
styles3.sectionLabel,
|
|
819
|
-
{ color: theme.colors.
|
|
961
|
+
{ color: theme.colors.textMuted, fontFamily: theme.fonts.body }
|
|
820
962
|
],
|
|
821
963
|
children: "Members"
|
|
822
964
|
}
|
|
@@ -917,7 +1059,7 @@ function ChatHeader({
|
|
|
917
1059
|
onPress,
|
|
918
1060
|
onBack
|
|
919
1061
|
}) {
|
|
920
|
-
const theme =
|
|
1062
|
+
const theme = useTheme();
|
|
921
1063
|
const { conversation } = useConversation(conversationId);
|
|
922
1064
|
const { members } = useMembers(conversationId);
|
|
923
1065
|
const { me } = useMe();
|
|
@@ -964,18 +1106,18 @@ function ChatHeader({
|
|
|
964
1106
|
}
|
|
965
1107
|
],
|
|
966
1108
|
children: [
|
|
967
|
-
onBack ? /* @__PURE__ */ jsx(Pressable, { onPress: onBack, hitSlop: 12, style: styles4.backBtn, accessibilityLabel: "Back", children: /* @__PURE__ */ jsx(PoolseIcon, { name: "reply", size: 20, color: theme.colors.
|
|
1109
|
+
onBack ? /* @__PURE__ */ jsx(Pressable, { onPress: onBack, hitSlop: 12, style: styles4.backBtn, accessibilityLabel: "Back", children: /* @__PURE__ */ jsx(PoolseIcon, { name: "reply", size: 20, color: theme.colors.text }) }) : null,
|
|
968
1110
|
/* @__PURE__ */ jsx(Avatar, { src: avatarUrl, name: title, seed: avatarSeed, online: isOnline, size: "md" }),
|
|
969
1111
|
/* @__PURE__ */ jsxs(View, { style: styles4.titleCol, children: [
|
|
970
1112
|
/* @__PURE__ */ jsx(
|
|
971
1113
|
Text,
|
|
972
1114
|
{
|
|
973
|
-
style: [styles4.title, { color: theme.colors.
|
|
1115
|
+
style: [styles4.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
|
|
974
1116
|
numberOfLines: 1,
|
|
975
1117
|
children: title
|
|
976
1118
|
}
|
|
977
1119
|
),
|
|
978
|
-
subtitle ? /* @__PURE__ */ jsx(Text, { style: [styles4.subtitle, { color: theme.colors.
|
|
1120
|
+
subtitle ? /* @__PURE__ */ jsx(Text, { style: [styles4.subtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: subtitle }) : null
|
|
979
1121
|
] }),
|
|
980
1122
|
onMembersPress ? /* @__PURE__ */ jsx(
|
|
981
1123
|
Pressable,
|
|
@@ -984,7 +1126,7 @@ function ChatHeader({
|
|
|
984
1126
|
hitSlop: 12,
|
|
985
1127
|
style: styles4.actionBtn,
|
|
986
1128
|
accessibilityLabel: "Show members",
|
|
987
|
-
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "users", size: 20, color: theme.colors.
|
|
1129
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "users", size: 20, color: theme.colors.textMuted })
|
|
988
1130
|
}
|
|
989
1131
|
) : null
|
|
990
1132
|
]
|
|
@@ -1050,7 +1192,7 @@ function ConversationList({
|
|
|
1050
1192
|
labelFor,
|
|
1051
1193
|
avatarFor
|
|
1052
1194
|
}) {
|
|
1053
|
-
const theme =
|
|
1195
|
+
const theme = useTheme();
|
|
1054
1196
|
const auto = useConversations();
|
|
1055
1197
|
const { me } = useMe();
|
|
1056
1198
|
const meExternalId = me?.external_id ?? null;
|
|
@@ -1061,20 +1203,20 @@ function ConversationList({
|
|
|
1061
1203
|
const error = isControlled ? controlledError ?? null : auto.error;
|
|
1062
1204
|
const counts = unreadCounts ?? (isControlled ? void 0 : auto.unreadCounts);
|
|
1063
1205
|
if (loading && conversations.length === 0) {
|
|
1064
|
-
return /* @__PURE__ */ jsx(View, { style: [styles5.placeholder, { backgroundColor: theme.colors.
|
|
1206
|
+
return /* @__PURE__ */ jsx(View, { style: [styles5.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }) });
|
|
1065
1207
|
}
|
|
1066
1208
|
if (error) {
|
|
1067
|
-
return /* @__PURE__ */ jsx(View, { style: [styles5.placeholder, { backgroundColor: theme.colors.
|
|
1209
|
+
return /* @__PURE__ */ jsx(View, { style: [styles5.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.danger, fontFamily: theme.fonts.body }, children: "Failed to load conversations." }) });
|
|
1068
1210
|
}
|
|
1069
1211
|
if (conversations.length === 0) {
|
|
1070
|
-
return /* @__PURE__ */ jsx(View, { style: [styles5.placeholder, { backgroundColor: theme.colors.
|
|
1212
|
+
return /* @__PURE__ */ jsx(View, { style: [styles5.placeholder, { backgroundColor: theme.colors.background }], children: typeof emptyState === "string" || emptyState == null ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState ?? "No conversations yet." }) : emptyState });
|
|
1071
1213
|
}
|
|
1072
1214
|
return /* @__PURE__ */ jsx(
|
|
1073
1215
|
FlatList,
|
|
1074
1216
|
{
|
|
1075
1217
|
data: conversations,
|
|
1076
1218
|
keyExtractor: (c) => c.id,
|
|
1077
|
-
style: { backgroundColor: theme.colors.
|
|
1219
|
+
style: { backgroundColor: theme.colors.background },
|
|
1078
1220
|
renderItem: ({ item }) => {
|
|
1079
1221
|
const selected = selectedId === item.id;
|
|
1080
1222
|
if (renderItem) {
|
|
@@ -1107,7 +1249,7 @@ function ConversationRow({
|
|
|
1107
1249
|
avatarFor,
|
|
1108
1250
|
onSelect
|
|
1109
1251
|
}) {
|
|
1110
|
-
const theme =
|
|
1252
|
+
const theme = useTheme();
|
|
1111
1253
|
const isDirect = conv.type === "direct";
|
|
1112
1254
|
const otherExtId = isDirect && meExternalId ? (conv.member_external_ids ?? []).find((x) => x !== meExternalId) ?? null : null;
|
|
1113
1255
|
const resolvedOther = useUser(isDirect ? otherExtId : null);
|
|
@@ -1121,7 +1263,7 @@ function ConversationRow({
|
|
|
1121
1263
|
style: [
|
|
1122
1264
|
styles5.row,
|
|
1123
1265
|
{
|
|
1124
|
-
backgroundColor: selected ? theme.colors.
|
|
1266
|
+
backgroundColor: selected ? theme.colors.surfaceAlt : "transparent"
|
|
1125
1267
|
}
|
|
1126
1268
|
],
|
|
1127
1269
|
children: [
|
|
@@ -1130,14 +1272,14 @@ function ConversationRow({
|
|
|
1130
1272
|
/* @__PURE__ */ jsx(
|
|
1131
1273
|
Text,
|
|
1132
1274
|
{
|
|
1133
|
-
style: [styles5.name, { color: theme.colors.
|
|
1275
|
+
style: [styles5.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
|
|
1134
1276
|
numberOfLines: 1,
|
|
1135
1277
|
children: title
|
|
1136
1278
|
}
|
|
1137
1279
|
),
|
|
1138
|
-
conv.last_message_preview ? /* @__PURE__ */ jsx(Text, { style: [styles5.preview, { color: theme.colors.
|
|
1280
|
+
conv.last_message_preview ? /* @__PURE__ */ jsx(Text, { style: [styles5.preview, { color: theme.colors.textSubtle }], numberOfLines: 1, children: formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview }) : conv.last_message_at ? /* @__PURE__ */ jsx(Text, { style: [styles5.preview, { color: theme.colors.textSubtle }], numberOfLines: 1, children: formatRelative(conv.last_message_at) }) : null
|
|
1139
1281
|
] }),
|
|
1140
|
-
unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles5.unreadPill, { backgroundColor: theme.colors.
|
|
1282
|
+
unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles5.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles5.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
|
|
1141
1283
|
]
|
|
1142
1284
|
}
|
|
1143
1285
|
);
|
|
@@ -1228,7 +1370,7 @@ function AttachmentPicker({
|
|
|
1228
1370
|
onPickInputs,
|
|
1229
1371
|
camera = true
|
|
1230
1372
|
}) {
|
|
1231
|
-
const theme =
|
|
1373
|
+
const theme = useTheme();
|
|
1232
1374
|
const insets = useSafeInsets();
|
|
1233
1375
|
const upload = useSharedUpload();
|
|
1234
1376
|
const { setPreview } = useUploadPreview();
|
|
@@ -1275,18 +1417,18 @@ function AttachmentPicker({
|
|
|
1275
1417
|
],
|
|
1276
1418
|
children: [
|
|
1277
1419
|
camera ? /* @__PURE__ */ jsxs(Pressable, { style: styles6.item, onPress: () => pickFromKind("camera"), children: [
|
|
1278
|
-
/* @__PURE__ */ jsx(PoolseIcon, { name: "camera", size: 20, color: theme.colors.
|
|
1279
|
-
/* @__PURE__ */ jsx(Text, { style: [styles6.itemText, { color: theme.colors.
|
|
1420
|
+
/* @__PURE__ */ jsx(PoolseIcon, { name: "camera", size: 20, color: theme.colors.textMuted }),
|
|
1421
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.itemText, { color: theme.colors.text }], children: "Camera" })
|
|
1280
1422
|
] }) : null,
|
|
1281
1423
|
/* @__PURE__ */ jsxs(Pressable, { style: styles6.item, onPress: () => pickFromKind("image"), children: [
|
|
1282
|
-
/* @__PURE__ */ jsx(PoolseIcon, { name: "image", size: 20, color: theme.colors.
|
|
1283
|
-
/* @__PURE__ */ jsx(Text, { style: [styles6.itemText, { color: theme.colors.
|
|
1424
|
+
/* @__PURE__ */ jsx(PoolseIcon, { name: "image", size: 20, color: theme.colors.textMuted }),
|
|
1425
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.itemText, { color: theme.colors.text }], children: "Photo or video" })
|
|
1284
1426
|
] }),
|
|
1285
1427
|
/* @__PURE__ */ jsxs(Pressable, { style: styles6.item, onPress: () => pickFromKind("document"), children: [
|
|
1286
|
-
/* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 20, color: theme.colors.
|
|
1287
|
-
/* @__PURE__ */ jsx(Text, { style: [styles6.itemText, { color: theme.colors.
|
|
1428
|
+
/* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 20, color: theme.colors.textMuted }),
|
|
1429
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.itemText, { color: theme.colors.text }], children: "File" })
|
|
1288
1430
|
] }),
|
|
1289
|
-
/* @__PURE__ */ jsx(Pressable, { style: styles6.cancel, onPress: onClose, children: /* @__PURE__ */ jsx(Text, { style: [styles6.itemText, { color: theme.colors.
|
|
1431
|
+
/* @__PURE__ */ jsx(Pressable, { style: styles6.cancel, onPress: onClose, children: /* @__PURE__ */ jsx(Text, { style: [styles6.itemText, { color: theme.colors.accent }], children: "Cancel" }) })
|
|
1290
1432
|
]
|
|
1291
1433
|
}
|
|
1292
1434
|
) })
|
|
@@ -1464,39 +1606,53 @@ var styles6 = StyleSheet.create({
|
|
|
1464
1606
|
fontWeight: "500"
|
|
1465
1607
|
}
|
|
1466
1608
|
});
|
|
1467
|
-
function DaySeparator({ label }) {
|
|
1468
|
-
const theme =
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1609
|
+
function DaySeparator({ label, variant = "pill" }) {
|
|
1610
|
+
const theme = useTheme();
|
|
1611
|
+
const rule = variant === "rule" ? /* @__PURE__ */ jsx(View, { style: [styles7.rule, { backgroundColor: theme.colors.border }] }) : null;
|
|
1612
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles7.wrap, rule ? styles7.wrapRule : null], children: [
|
|
1613
|
+
rule,
|
|
1614
|
+
/* @__PURE__ */ jsx(
|
|
1615
|
+
View,
|
|
1616
|
+
{
|
|
1617
|
+
style: [
|
|
1618
|
+
styles7.chip,
|
|
1619
|
+
{
|
|
1620
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
1621
|
+
borderColor: theme.colors.border
|
|
1622
|
+
}
|
|
1623
|
+
],
|
|
1624
|
+
children: /* @__PURE__ */ jsx(
|
|
1625
|
+
Text,
|
|
1626
|
+
{
|
|
1627
|
+
style: [
|
|
1628
|
+
styles7.label,
|
|
1629
|
+
{
|
|
1630
|
+
color: theme.colors.textMuted,
|
|
1631
|
+
fontFamily: theme.fonts.body
|
|
1632
|
+
}
|
|
1633
|
+
],
|
|
1634
|
+
children: label
|
|
1635
|
+
}
|
|
1636
|
+
)
|
|
1637
|
+
}
|
|
1638
|
+
),
|
|
1639
|
+
rule
|
|
1640
|
+
] });
|
|
1494
1641
|
}
|
|
1495
1642
|
var styles7 = StyleSheet.create({
|
|
1496
1643
|
wrap: {
|
|
1497
1644
|
alignItems: "center",
|
|
1498
1645
|
marginVertical: 8
|
|
1499
1646
|
},
|
|
1647
|
+
wrapRule: {
|
|
1648
|
+
flexDirection: "row",
|
|
1649
|
+
gap: 10,
|
|
1650
|
+
paddingHorizontal: 12
|
|
1651
|
+
},
|
|
1652
|
+
rule: {
|
|
1653
|
+
flex: 1,
|
|
1654
|
+
height: StyleSheet.hairlineWidth
|
|
1655
|
+
},
|
|
1500
1656
|
chip: {
|
|
1501
1657
|
paddingHorizontal: 12,
|
|
1502
1658
|
paddingVertical: 4,
|
|
@@ -1510,7 +1666,7 @@ var styles7 = StyleSheet.create({
|
|
|
1510
1666
|
}
|
|
1511
1667
|
});
|
|
1512
1668
|
function LiveCallBanner({ call, inCall, onJoin }) {
|
|
1513
|
-
const theme =
|
|
1669
|
+
const theme = useTheme();
|
|
1514
1670
|
const what = call.kind === "room" ? call.media === "video" ? "Video room" : "Voice room" : call.media === "video" ? "Video call in progress" : "Voice call in progress";
|
|
1515
1671
|
const who = inCall > 0 ? `${inCall} ${call.kind === "room" ? "in the room" : "on the call"}` : call.kind === "room" ? "Starting" : "Ringing";
|
|
1516
1672
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1530,8 +1686,8 @@ function LiveCallBanner({ call, inCall, onJoin }) {
|
|
|
1530
1686
|
}
|
|
1531
1687
|
),
|
|
1532
1688
|
/* @__PURE__ */ jsxs(View, { style: styles8.text, children: [
|
|
1533
|
-
/* @__PURE__ */ jsx(Text, { style: [styles8.title, { fontFamily: theme.
|
|
1534
|
-
/* @__PURE__ */ jsx(Text, { style: [styles8.meta, { fontFamily: theme.
|
|
1689
|
+
/* @__PURE__ */ jsx(Text, { style: [styles8.title, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: what }),
|
|
1690
|
+
/* @__PURE__ */ jsx(Text, { style: [styles8.meta, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: who })
|
|
1535
1691
|
] }),
|
|
1536
1692
|
/* @__PURE__ */ jsx(
|
|
1537
1693
|
Pressable,
|
|
@@ -1544,10 +1700,7 @@ function LiveCallBanner({ call, inCall, onJoin }) {
|
|
|
1544
1700
|
children: /* @__PURE__ */ jsx(
|
|
1545
1701
|
Text,
|
|
1546
1702
|
{
|
|
1547
|
-
style: [
|
|
1548
|
-
styles8.joinText,
|
|
1549
|
-
{ color: theme.colors.success, fontFamily: theme.type.fontBody }
|
|
1550
|
-
],
|
|
1703
|
+
style: [styles8.joinText, { color: theme.colors.success, fontFamily: theme.fonts.body }],
|
|
1551
1704
|
children: "Join"
|
|
1552
1705
|
}
|
|
1553
1706
|
)
|
|
@@ -1578,7 +1731,7 @@ var styles8 = StyleSheet.create({
|
|
|
1578
1731
|
joinText: { fontSize: 14, fontWeight: "700" }
|
|
1579
1732
|
});
|
|
1580
1733
|
function UploadQueueStrip() {
|
|
1581
|
-
const theme =
|
|
1734
|
+
const theme = useTheme();
|
|
1582
1735
|
const upload = useSharedUpload();
|
|
1583
1736
|
const { getPreview } = useUploadPreview();
|
|
1584
1737
|
if (upload.queue.length === 0) return null;
|
|
@@ -1619,7 +1772,7 @@ function UploadQueueStrip() {
|
|
|
1619
1772
|
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 11, color: "#fff" })
|
|
1620
1773
|
}
|
|
1621
1774
|
) : null,
|
|
1622
|
-
isUploading ? /* @__PURE__ */ jsx(View, { style: styles9.progressOverlay, children: /* @__PURE__ */ jsx(View, { style: [styles9.spinner, { borderColor: theme.colors.
|
|
1775
|
+
isUploading ? /* @__PURE__ */ jsx(View, { style: styles9.progressOverlay, children: /* @__PURE__ */ jsx(View, { style: [styles9.spinner, { borderColor: theme.colors.accentText }] }) }) : null,
|
|
1623
1776
|
isError ? /* @__PURE__ */ jsx(View, { style: [styles9.errorOverlay, { backgroundColor: "rgba(229,72,77,0.85)" }], children: /* @__PURE__ */ jsx(Text, { style: [styles9.errorText, { color: "#fff" }], children: "Failed" }) }) : null
|
|
1624
1777
|
] }, item.localId);
|
|
1625
1778
|
})
|
|
@@ -1627,7 +1780,7 @@ function UploadQueueStrip() {
|
|
|
1627
1780
|
);
|
|
1628
1781
|
}
|
|
1629
1782
|
function ImageTile({ uri, uploading, error }) {
|
|
1630
|
-
const theme =
|
|
1783
|
+
const theme = useTheme();
|
|
1631
1784
|
return /* @__PURE__ */ jsx(
|
|
1632
1785
|
Image,
|
|
1633
1786
|
{
|
|
@@ -1635,8 +1788,8 @@ function ImageTile({ uri, uploading, error }) {
|
|
|
1635
1788
|
style: [
|
|
1636
1789
|
styles9.imageTile,
|
|
1637
1790
|
{
|
|
1638
|
-
backgroundColor: theme.colors.
|
|
1639
|
-
borderColor: error ? theme.colors.
|
|
1791
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
1792
|
+
borderColor: error ? theme.colors.danger : "transparent",
|
|
1640
1793
|
opacity: uploading ? 0.65 : 1
|
|
1641
1794
|
}
|
|
1642
1795
|
],
|
|
@@ -1650,29 +1803,29 @@ function FileTile({
|
|
|
1650
1803
|
uploading,
|
|
1651
1804
|
error
|
|
1652
1805
|
}) {
|
|
1653
|
-
const theme =
|
|
1806
|
+
const theme = useTheme();
|
|
1654
1807
|
return /* @__PURE__ */ jsxs(
|
|
1655
1808
|
View,
|
|
1656
1809
|
{
|
|
1657
1810
|
style: [
|
|
1658
1811
|
styles9.fileTile,
|
|
1659
1812
|
{
|
|
1660
|
-
backgroundColor: theme.colors.
|
|
1661
|
-
borderColor: error ? theme.colors.
|
|
1813
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
1814
|
+
borderColor: error ? theme.colors.danger : uploading ? theme.colors.accent : theme.colors.border
|
|
1662
1815
|
}
|
|
1663
1816
|
],
|
|
1664
1817
|
children: [
|
|
1665
|
-
/* @__PURE__ */ jsx(View, { style: [styles9.fileIconBox, { backgroundColor: theme.colors.
|
|
1818
|
+
/* @__PURE__ */ jsx(View, { style: [styles9.fileIconBox, { backgroundColor: theme.colors.accentSoft }], children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 18, color: theme.colors.accent }) }),
|
|
1666
1819
|
/* @__PURE__ */ jsxs(View, { style: styles9.fileInfo, children: [
|
|
1667
1820
|
/* @__PURE__ */ jsx(
|
|
1668
1821
|
Text,
|
|
1669
1822
|
{
|
|
1670
|
-
style: [styles9.fileName, { color: theme.colors.
|
|
1823
|
+
style: [styles9.fileName, { color: theme.colors.text, fontFamily: theme.fonts.body }],
|
|
1671
1824
|
numberOfLines: 1,
|
|
1672
1825
|
children: filename
|
|
1673
1826
|
}
|
|
1674
1827
|
),
|
|
1675
|
-
/* @__PURE__ */ jsx(Text, { style: [styles9.fileSize, { color: theme.colors.
|
|
1828
|
+
/* @__PURE__ */ jsx(Text, { style: [styles9.fileSize, { color: theme.colors.textSubtle }], children: formatBytes(size) })
|
|
1676
1829
|
] })
|
|
1677
1830
|
]
|
|
1678
1831
|
}
|
|
@@ -1821,7 +1974,7 @@ var MessageComposer = forwardRef(
|
|
|
1821
1974
|
onCancelEdit,
|
|
1822
1975
|
onSaveEdit
|
|
1823
1976
|
}, ref) {
|
|
1824
|
-
const theme =
|
|
1977
|
+
const theme = useTheme();
|
|
1825
1978
|
const inputRef = useRef(null);
|
|
1826
1979
|
const [value, setValue] = useState("");
|
|
1827
1980
|
const [sending, setSending] = useState(false);
|
|
@@ -1921,7 +2074,7 @@ var MessageComposer = forwardRef(
|
|
|
1921
2074
|
hitSlop: 8,
|
|
1922
2075
|
style: styles10.iconBtn,
|
|
1923
2076
|
accessibilityLabel: "Attach file",
|
|
1924
|
-
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 22, color: theme.colors.
|
|
2077
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 22, color: theme.colors.textMuted })
|
|
1925
2078
|
}
|
|
1926
2079
|
) : null,
|
|
1927
2080
|
/* @__PURE__ */ jsx(
|
|
@@ -1934,17 +2087,17 @@ var MessageComposer = forwardRef(
|
|
|
1934
2087
|
onTyping?.();
|
|
1935
2088
|
},
|
|
1936
2089
|
placeholder,
|
|
1937
|
-
placeholderTextColor: theme.colors.
|
|
2090
|
+
placeholderTextColor: theme.colors.textSubtle,
|
|
1938
2091
|
multiline: true,
|
|
1939
2092
|
editable: !disabled,
|
|
1940
2093
|
style: [
|
|
1941
2094
|
styles10.input,
|
|
1942
2095
|
{
|
|
1943
|
-
color: theme.colors.
|
|
1944
|
-
backgroundColor: theme.colors.
|
|
2096
|
+
color: theme.colors.text,
|
|
2097
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
1945
2098
|
borderRadius: theme.radii.lg,
|
|
1946
|
-
fontFamily: theme.
|
|
1947
|
-
fontSize: theme.
|
|
2099
|
+
fontFamily: theme.fonts.body,
|
|
2100
|
+
fontSize: theme.fonts.sizeMd
|
|
1948
2101
|
}
|
|
1949
2102
|
]
|
|
1950
2103
|
}
|
|
@@ -1957,12 +2110,12 @@ var MessageComposer = forwardRef(
|
|
|
1957
2110
|
style: [
|
|
1958
2111
|
styles10.sendBtn,
|
|
1959
2112
|
{
|
|
1960
|
-
backgroundColor: submitDisabled ? theme.colors.
|
|
2113
|
+
backgroundColor: submitDisabled ? theme.colors.textSubtle : theme.colors.accent,
|
|
1961
2114
|
opacity: submitDisabled ? 0.6 : 1
|
|
1962
2115
|
}
|
|
1963
2116
|
],
|
|
1964
2117
|
accessibilityLabel: "Send message",
|
|
1965
|
-
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "send", size: 18, color: theme.colors.
|
|
2118
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "send", size: 18, color: theme.colors.accentText })
|
|
1966
2119
|
}
|
|
1967
2120
|
)
|
|
1968
2121
|
] })
|
|
@@ -1972,23 +2125,23 @@ var MessageComposer = forwardRef(
|
|
|
1972
2125
|
}
|
|
1973
2126
|
);
|
|
1974
2127
|
function EditChip({ message, onCancel }) {
|
|
1975
|
-
const theme =
|
|
2128
|
+
const theme = useTheme();
|
|
1976
2129
|
return /* @__PURE__ */ jsxs(
|
|
1977
2130
|
View,
|
|
1978
2131
|
{
|
|
1979
2132
|
style: [
|
|
1980
2133
|
styles10.replyChip,
|
|
1981
2134
|
{
|
|
1982
|
-
backgroundColor: theme.colors.
|
|
1983
|
-
borderLeftColor: theme.colors.
|
|
2135
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
2136
|
+
borderLeftColor: theme.colors.accent
|
|
1984
2137
|
}
|
|
1985
2138
|
],
|
|
1986
2139
|
children: [
|
|
1987
2140
|
/* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
|
|
1988
|
-
/* @__PURE__ */ jsx(Text, { style: [styles10.replyName, { color: theme.colors.
|
|
1989
|
-
/* @__PURE__ */ jsx(Text, { style: [styles10.replyBody, { color: theme.colors.
|
|
2141
|
+
/* @__PURE__ */ jsx(Text, { style: [styles10.replyName, { color: theme.colors.accent }], children: "Editing message" }),
|
|
2142
|
+
/* @__PURE__ */ jsx(Text, { style: [styles10.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
|
|
1990
2143
|
] }),
|
|
1991
|
-
onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles10.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.
|
|
2144
|
+
onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles10.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
|
|
1992
2145
|
]
|
|
1993
2146
|
}
|
|
1994
2147
|
);
|
|
@@ -1998,7 +2151,7 @@ function ReplyChip({
|
|
|
1998
2151
|
labelFor,
|
|
1999
2152
|
onCancel
|
|
2000
2153
|
}) {
|
|
2001
|
-
const theme =
|
|
2154
|
+
const theme = useTheme();
|
|
2002
2155
|
const resolved = useUser(message.sender_external_id);
|
|
2003
2156
|
const senderName = message.sender_external_id ? labelFor?.(message.sender_external_id) ?? resolved.profile?.displayName ?? message.sender_external_id : "Unknown";
|
|
2004
2157
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2007,19 +2160,19 @@ function ReplyChip({
|
|
|
2007
2160
|
style: [
|
|
2008
2161
|
styles10.replyChip,
|
|
2009
2162
|
{
|
|
2010
|
-
backgroundColor: theme.colors.
|
|
2011
|
-
borderLeftColor: theme.colors.
|
|
2163
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
2164
|
+
borderLeftColor: theme.colors.accent
|
|
2012
2165
|
}
|
|
2013
2166
|
],
|
|
2014
2167
|
children: [
|
|
2015
2168
|
/* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
|
|
2016
|
-
/* @__PURE__ */ jsxs(Text, { style: [styles10.replyName, { color: theme.colors.
|
|
2169
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles10.replyName, { color: theme.colors.accent }], children: [
|
|
2017
2170
|
"Replying to ",
|
|
2018
2171
|
senderName
|
|
2019
2172
|
] }),
|
|
2020
|
-
/* @__PURE__ */ jsx(Text, { style: [styles10.replyBody, { color: theme.colors.
|
|
2173
|
+
/* @__PURE__ */ jsx(Text, { style: [styles10.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
|
|
2021
2174
|
] }),
|
|
2022
|
-
onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles10.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.
|
|
2175
|
+
onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles10.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
|
|
2023
2176
|
]
|
|
2024
2177
|
}
|
|
2025
2178
|
);
|
|
@@ -2082,7 +2235,7 @@ var styles10 = StyleSheet.create({
|
|
|
2082
2235
|
}
|
|
2083
2236
|
});
|
|
2084
2237
|
function MentionInput({ conversationId, onSend, ...composerProps }) {
|
|
2085
|
-
const theme =
|
|
2238
|
+
const theme = useTheme();
|
|
2086
2239
|
const insets = useSafeInsets();
|
|
2087
2240
|
const keyboardOpen = useKeyboardOpen();
|
|
2088
2241
|
const { members } = useMembers(conversationId);
|
|
@@ -2144,7 +2297,7 @@ function MentionInput({ conversationId, onSend, ...composerProps }) {
|
|
|
2144
2297
|
/* @__PURE__ */ jsx(
|
|
2145
2298
|
Text,
|
|
2146
2299
|
{
|
|
2147
|
-
style: [styles11.title, { color: theme.colors.
|
|
2300
|
+
style: [styles11.title, { color: theme.colors.text, fontFamily: theme.fonts.body }],
|
|
2148
2301
|
children: "Mention a member"
|
|
2149
2302
|
}
|
|
2150
2303
|
),
|
|
@@ -2175,10 +2328,10 @@ function MentionInput({ conversationId, onSend, ...composerProps }) {
|
|
|
2175
2328
|
] });
|
|
2176
2329
|
}
|
|
2177
2330
|
function MentionRow({ member, onPress }) {
|
|
2178
|
-
const theme =
|
|
2331
|
+
const theme = useTheme();
|
|
2179
2332
|
return /* @__PURE__ */ jsxs(Pressable, { onPress, style: styles11.row, children: [
|
|
2180
2333
|
/* @__PURE__ */ jsx(Avatar, { src: null, name: member.external_id, seed: member.external_id, size: "sm" }),
|
|
2181
|
-
/* @__PURE__ */ jsx(Text, { style: [styles11.rowText, { color: theme.colors.
|
|
2334
|
+
/* @__PURE__ */ jsx(Text, { style: [styles11.rowText, { color: theme.colors.text, fontFamily: theme.fonts.body }], children: member.external_id })
|
|
2182
2335
|
] });
|
|
2183
2336
|
}
|
|
2184
2337
|
var styles11 = StyleSheet.create({
|
|
@@ -2211,6 +2364,18 @@ var styles11 = StyleSheet.create({
|
|
|
2211
2364
|
fontSize: 14
|
|
2212
2365
|
}
|
|
2213
2366
|
});
|
|
2367
|
+
|
|
2368
|
+
// src/internal/messageFocus.ts
|
|
2369
|
+
function latestMarkableId(messages) {
|
|
2370
|
+
const latest = messages[messages.length - 1];
|
|
2371
|
+
if (!latest?.id) return null;
|
|
2372
|
+
if (typeof latest.sequence !== "number" || latest.sequence <= 0) return null;
|
|
2373
|
+
if (latest.sequence === Number.MAX_SAFE_INTEGER) return null;
|
|
2374
|
+
return latest.id;
|
|
2375
|
+
}
|
|
2376
|
+
function indexOfMessage(items, messageId) {
|
|
2377
|
+
return items.findIndex((it) => it.kind === "msg" && it.msg?.id === messageId);
|
|
2378
|
+
}
|
|
2214
2379
|
var AT_BOTTOM_THRESHOLD = 32;
|
|
2215
2380
|
function MessageList({
|
|
2216
2381
|
messages,
|
|
@@ -2222,9 +2387,11 @@ function MessageList({
|
|
|
2222
2387
|
ListHeader = null,
|
|
2223
2388
|
ListFooter = null,
|
|
2224
2389
|
emptyState,
|
|
2225
|
-
meId = null
|
|
2390
|
+
meId = null,
|
|
2391
|
+
scrollToMessageId = null,
|
|
2392
|
+
scrollRequest = 0
|
|
2226
2393
|
}) {
|
|
2227
|
-
const theme =
|
|
2394
|
+
const theme = useTheme();
|
|
2228
2395
|
const flatListRef = useRef(null);
|
|
2229
2396
|
const [atBottom, setAtBottom] = useState(true);
|
|
2230
2397
|
const [newCount, setNewCount] = useState(0);
|
|
@@ -2251,6 +2418,34 @@ function MessageList({
|
|
|
2251
2418
|
setAtBottom((prev) => prev === next ? prev : next);
|
|
2252
2419
|
if (next) setNewCount(0);
|
|
2253
2420
|
}, []);
|
|
2421
|
+
const dataRef = useRef(data);
|
|
2422
|
+
dataRef.current = data;
|
|
2423
|
+
const scrollRetriesRef = useRef(0);
|
|
2424
|
+
useEffect(() => {
|
|
2425
|
+
if (!scrollToMessageId) return;
|
|
2426
|
+
const index = indexOfMessage(dataRef.current, scrollToMessageId);
|
|
2427
|
+
if (index === -1) return;
|
|
2428
|
+
scrollRetriesRef.current = 0;
|
|
2429
|
+
flatListRef.current?.scrollToIndex({ index, animated: true, viewPosition: 0.5 });
|
|
2430
|
+
}, [scrollToMessageId, scrollRequest]);
|
|
2431
|
+
const onScrollToIndexFailed = useCallback(
|
|
2432
|
+
(info) => {
|
|
2433
|
+
flatListRef.current?.scrollToOffset({
|
|
2434
|
+
offset: info.averageItemLength * info.index,
|
|
2435
|
+
animated: false
|
|
2436
|
+
});
|
|
2437
|
+
if (scrollRetriesRef.current >= 3) return;
|
|
2438
|
+
scrollRetriesRef.current += 1;
|
|
2439
|
+
setTimeout(() => {
|
|
2440
|
+
flatListRef.current?.scrollToIndex({
|
|
2441
|
+
index: info.index,
|
|
2442
|
+
animated: true,
|
|
2443
|
+
viewPosition: 0.5
|
|
2444
|
+
});
|
|
2445
|
+
}, 120);
|
|
2446
|
+
},
|
|
2447
|
+
[]
|
|
2448
|
+
);
|
|
2254
2449
|
const scrollToBottom = useCallback(() => {
|
|
2255
2450
|
flatListRef.current?.scrollToOffset({ offset: 0, animated: true });
|
|
2256
2451
|
setNewCount(0);
|
|
@@ -2264,10 +2459,10 @@ function MessageList({
|
|
|
2264
2459
|
[renderItem, data.length]
|
|
2265
2460
|
);
|
|
2266
2461
|
if (loading && messages.length === 0) {
|
|
2267
|
-
return /* @__PURE__ */ jsx(View, { style: [styles12.placeholder, { backgroundColor: theme.colors.
|
|
2462
|
+
return /* @__PURE__ */ jsx(View, { style: [styles12.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }) });
|
|
2268
2463
|
}
|
|
2269
2464
|
if (messages.length === 0) {
|
|
2270
|
-
return /* @__PURE__ */ jsx(View, { style: [styles12.placeholder, { backgroundColor: theme.colors.
|
|
2465
|
+
return /* @__PURE__ */ jsx(View, { style: [styles12.placeholder, { backgroundColor: theme.colors.background }], children: typeof emptyState === "string" ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState }) : emptyState ?? null });
|
|
2271
2466
|
}
|
|
2272
2467
|
return /* @__PURE__ */ jsxs(View, { style: styles12.root, children: [
|
|
2273
2468
|
/* @__PURE__ */ jsx(
|
|
@@ -2280,14 +2475,15 @@ function MessageList({
|
|
|
2280
2475
|
renderItem: handleRender,
|
|
2281
2476
|
onEndReached: hasMore ? onLoadMore : void 0,
|
|
2282
2477
|
onEndReachedThreshold: 0.3,
|
|
2478
|
+
onScrollToIndexFailed,
|
|
2283
2479
|
onScroll: handleScroll,
|
|
2284
2480
|
scrollEventThrottle: 32,
|
|
2285
2481
|
ListHeaderComponent: ListHeader,
|
|
2286
2482
|
ListFooterComponent: /* @__PURE__ */ jsxs(View, { children: [
|
|
2287
|
-
hasMore && loading ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.
|
|
2483
|
+
hasMore && loading ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.textSubtle, style: { marginVertical: 8 } }) : null,
|
|
2288
2484
|
ListFooter
|
|
2289
2485
|
] }),
|
|
2290
|
-
style: { backgroundColor: theme.colors.
|
|
2486
|
+
style: { backgroundColor: theme.colors.background },
|
|
2291
2487
|
contentContainerStyle: { paddingVertical: 8 }
|
|
2292
2488
|
}
|
|
2293
2489
|
),
|
|
@@ -2298,14 +2494,14 @@ function MessageList({
|
|
|
2298
2494
|
style: [
|
|
2299
2495
|
styles12.jumpButton,
|
|
2300
2496
|
{
|
|
2301
|
-
backgroundColor: theme.colors.
|
|
2497
|
+
backgroundColor: theme.colors.accent
|
|
2302
2498
|
},
|
|
2303
2499
|
theme.shadows.sm
|
|
2304
2500
|
],
|
|
2305
2501
|
accessibilityLabel: `${newCount} new ${newCount === 1 ? "message" : "messages"}, jump to latest`,
|
|
2306
2502
|
children: [
|
|
2307
|
-
/* @__PURE__ */ jsx(PoolseIcon, { name: "chevron-down", size: 14, color: theme.colors.
|
|
2308
|
-
/* @__PURE__ */ jsxs(Text, { style: [styles12.jumpText, { color: theme.colors.
|
|
2503
|
+
/* @__PURE__ */ jsx(PoolseIcon, { name: "chevron-down", size: 14, color: theme.colors.accentText }),
|
|
2504
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles12.jumpText, { color: theme.colors.accentText }], children: [
|
|
2309
2505
|
newCount,
|
|
2310
2506
|
" new ",
|
|
2311
2507
|
newCount === 1 ? "message" : "messages"
|
|
@@ -2342,13 +2538,13 @@ var styles12 = StyleSheet.create({
|
|
|
2342
2538
|
}
|
|
2343
2539
|
});
|
|
2344
2540
|
function CallLogRow({ msg, meId, onCallBack }) {
|
|
2345
|
-
const theme =
|
|
2541
|
+
const theme = useTheme();
|
|
2346
2542
|
const display = callLogDisplayFor(msg, meId);
|
|
2347
2543
|
if (!display) return null;
|
|
2348
|
-
const accent = display.missed ? theme.colors.
|
|
2544
|
+
const accent = display.missed ? theme.colors.danger : theme.colors.textSubtle;
|
|
2349
2545
|
const time = formatTime(msg.inserted_at);
|
|
2350
2546
|
const label = [display.title, display.detail, time].filter(Boolean).join(", ");
|
|
2351
|
-
const metaStyle = [styles13.meta, { color: theme.colors.
|
|
2547
|
+
const metaStyle = [styles13.meta, { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }];
|
|
2352
2548
|
return /* @__PURE__ */ jsxs(View, { style: styles13.wrap, accessible: true, accessibilityLabel: label, children: [
|
|
2353
2549
|
/* @__PURE__ */ jsxs(
|
|
2354
2550
|
View,
|
|
@@ -2356,7 +2552,7 @@ function CallLogRow({ msg, meId, onCallBack }) {
|
|
|
2356
2552
|
style: [
|
|
2357
2553
|
styles13.chip,
|
|
2358
2554
|
{
|
|
2359
|
-
backgroundColor: theme.colors.
|
|
2555
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
2360
2556
|
borderColor: theme.colors.border
|
|
2361
2557
|
}
|
|
2362
2558
|
],
|
|
@@ -2368,8 +2564,8 @@ function CallLogRow({ msg, meId, onCallBack }) {
|
|
|
2368
2564
|
style: [
|
|
2369
2565
|
styles13.title,
|
|
2370
2566
|
{
|
|
2371
|
-
color: display.missed ? theme.colors.
|
|
2372
|
-
fontFamily: theme.
|
|
2567
|
+
color: display.missed ? theme.colors.danger : theme.colors.textMuted,
|
|
2568
|
+
fontFamily: theme.fonts.body
|
|
2373
2569
|
}
|
|
2374
2570
|
],
|
|
2375
2571
|
numberOfLines: 1,
|
|
@@ -2400,7 +2596,7 @@ function CallLogRow({ msg, meId, onCallBack }) {
|
|
|
2400
2596
|
{
|
|
2401
2597
|
style: [
|
|
2402
2598
|
styles13.callBackText,
|
|
2403
|
-
{ color: theme.colors.
|
|
2599
|
+
{ color: theme.colors.accent, fontFamily: theme.fonts.body }
|
|
2404
2600
|
],
|
|
2405
2601
|
children: "Call back"
|
|
2406
2602
|
}
|
|
@@ -2448,149 +2644,13 @@ var styles13 = StyleSheet.create({
|
|
|
2448
2644
|
fontVariant: ["tabular-nums"]
|
|
2449
2645
|
}
|
|
2450
2646
|
});
|
|
2451
|
-
var DEFAULT_REACTION_EMOJIS = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}", "\u{1F64F}", "\u{1F525}"];
|
|
2452
|
-
function MessageActions({
|
|
2453
|
-
visible,
|
|
2454
|
-
onClose,
|
|
2455
|
-
isSelf,
|
|
2456
|
-
emojis = DEFAULT_REACTION_EMOJIS,
|
|
2457
|
-
onPickReaction,
|
|
2458
|
-
onReply,
|
|
2459
|
-
onReplyInThread,
|
|
2460
|
-
onQuote,
|
|
2461
|
-
onEdit,
|
|
2462
|
-
onDelete,
|
|
2463
|
-
onCopy
|
|
2464
|
-
}) {
|
|
2465
|
-
const theme = usePoolseTheme();
|
|
2466
|
-
const insets = useSafeInsets();
|
|
2467
|
-
const items = [];
|
|
2468
|
-
if (onReply) items.push({ label: "Reply", icon: "reply", onPress: onReply });
|
|
2469
|
-
if (onQuote) items.push({ label: "Quote reply", icon: "reply", onPress: onQuote });
|
|
2470
|
-
if (onReplyInThread)
|
|
2471
|
-
items.push({ label: "Reply in thread", icon: "messages", onPress: onReplyInThread });
|
|
2472
|
-
if (onCopy) items.push({ label: "Copy text", icon: "copy", onPress: onCopy });
|
|
2473
|
-
if (isSelf && onEdit) items.push({ label: "Edit", icon: "edit", onPress: onEdit });
|
|
2474
|
-
if (isSelf && onDelete)
|
|
2475
|
-
items.push({ label: "Delete", icon: "trash", onPress: onDelete, danger: true });
|
|
2476
|
-
const showEmojiRow = !!onPickReaction && emojis.length > 0;
|
|
2477
|
-
return /* @__PURE__ */ jsx(
|
|
2478
|
-
Modal,
|
|
2479
|
-
{
|
|
2480
|
-
visible,
|
|
2481
|
-
transparent: true,
|
|
2482
|
-
animationType: "fade",
|
|
2483
|
-
onRequestClose: onClose,
|
|
2484
|
-
...EDGE_TO_EDGE_MODAL,
|
|
2485
|
-
children: /* @__PURE__ */ jsx(Pressable, { style: styles14.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
|
|
2486
|
-
View,
|
|
2487
|
-
{
|
|
2488
|
-
style: [
|
|
2489
|
-
styles14.sheet,
|
|
2490
|
-
{
|
|
2491
|
-
backgroundColor: theme.colors.surface,
|
|
2492
|
-
borderTopLeftRadius: theme.radii.lg,
|
|
2493
|
-
borderTopRightRadius: theme.radii.lg,
|
|
2494
|
-
// Last action row must sit above the nav bar / home indicator.
|
|
2495
|
-
paddingBottom: 24 + insets.bottom,
|
|
2496
|
-
paddingLeft: insets.left,
|
|
2497
|
-
paddingRight: insets.right
|
|
2498
|
-
},
|
|
2499
|
-
theme.shadows.lg
|
|
2500
|
-
],
|
|
2501
|
-
children: [
|
|
2502
|
-
showEmojiRow ? /* @__PURE__ */ jsx(View, { style: [styles14.emojiRow, { borderBottomColor: theme.colors.border }], children: emojis.map((emoji) => /* @__PURE__ */ jsx(
|
|
2503
|
-
Pressable,
|
|
2504
|
-
{
|
|
2505
|
-
onPress: () => {
|
|
2506
|
-
onPickReaction(emoji);
|
|
2507
|
-
onClose();
|
|
2508
|
-
},
|
|
2509
|
-
style: styles14.emojiBtn,
|
|
2510
|
-
hitSlop: 6,
|
|
2511
|
-
accessibilityLabel: `React with ${emoji}`,
|
|
2512
|
-
children: /* @__PURE__ */ jsx(Text, { style: styles14.emoji, children: emoji })
|
|
2513
|
-
},
|
|
2514
|
-
emoji
|
|
2515
|
-
)) }) : null,
|
|
2516
|
-
items.map((item) => /* @__PURE__ */ jsxs(Pressable, { onPress: item.onPress, style: styles14.item, children: [
|
|
2517
|
-
/* @__PURE__ */ jsx(
|
|
2518
|
-
PoolseIcon,
|
|
2519
|
-
{
|
|
2520
|
-
name: item.icon,
|
|
2521
|
-
size: 18,
|
|
2522
|
-
color: item.danger ? theme.colors.error : theme.colors.ink2
|
|
2523
|
-
}
|
|
2524
|
-
),
|
|
2525
|
-
/* @__PURE__ */ jsx(
|
|
2526
|
-
Text,
|
|
2527
|
-
{
|
|
2528
|
-
style: [
|
|
2529
|
-
styles14.itemText,
|
|
2530
|
-
{
|
|
2531
|
-
color: item.danger ? theme.colors.error : theme.colors.ink,
|
|
2532
|
-
fontFamily: theme.type.fontBody
|
|
2533
|
-
}
|
|
2534
|
-
],
|
|
2535
|
-
children: item.label
|
|
2536
|
-
}
|
|
2537
|
-
)
|
|
2538
|
-
] }, item.label))
|
|
2539
|
-
]
|
|
2540
|
-
}
|
|
2541
|
-
) })
|
|
2542
|
-
}
|
|
2543
|
-
);
|
|
2544
|
-
}
|
|
2545
|
-
var styles14 = StyleSheet.create({
|
|
2546
|
-
backdrop: {
|
|
2547
|
-
flex: 1,
|
|
2548
|
-
backgroundColor: "rgba(0,0,0,0.35)",
|
|
2549
|
-
justifyContent: "flex-end"
|
|
2550
|
-
},
|
|
2551
|
-
sheet: {
|
|
2552
|
-
paddingTop: 8,
|
|
2553
|
-
paddingBottom: 24
|
|
2554
|
-
},
|
|
2555
|
-
emojiRow: {
|
|
2556
|
-
flexDirection: "row",
|
|
2557
|
-
alignItems: "center",
|
|
2558
|
-
justifyContent: "space-around",
|
|
2559
|
-
paddingHorizontal: 12,
|
|
2560
|
-
paddingVertical: 10,
|
|
2561
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
2562
|
-
marginBottom: 6
|
|
2563
|
-
},
|
|
2564
|
-
emojiBtn: {
|
|
2565
|
-
paddingHorizontal: 6,
|
|
2566
|
-
paddingVertical: 6,
|
|
2567
|
-
borderRadius: 999,
|
|
2568
|
-
alignItems: "center",
|
|
2569
|
-
justifyContent: "center"
|
|
2570
|
-
},
|
|
2571
|
-
emoji: {
|
|
2572
|
-
fontSize: 30,
|
|
2573
|
-
lineHeight: 36
|
|
2574
|
-
},
|
|
2575
|
-
item: {
|
|
2576
|
-
flexDirection: "row",
|
|
2577
|
-
alignItems: "center",
|
|
2578
|
-
paddingHorizontal: 20,
|
|
2579
|
-
paddingVertical: 14,
|
|
2580
|
-
gap: 14
|
|
2581
|
-
},
|
|
2582
|
-
itemText: {
|
|
2583
|
-
fontSize: 15,
|
|
2584
|
-
fontWeight: "500"
|
|
2585
|
-
}
|
|
2586
|
-
});
|
|
2587
2647
|
function AttachmentPreview({
|
|
2588
2648
|
attachment,
|
|
2589
2649
|
onPress,
|
|
2590
2650
|
maxWidth = 280,
|
|
2591
2651
|
tone = "default"
|
|
2592
2652
|
}) {
|
|
2593
|
-
const theme =
|
|
2653
|
+
const theme = useTheme();
|
|
2594
2654
|
const isImage = (attachment.content_type ?? "").startsWith("image/");
|
|
2595
2655
|
const { url } = useAttachmentUrl(attachment.id);
|
|
2596
2656
|
if (isImage) {
|
|
@@ -2602,7 +2662,7 @@ function AttachmentPreview({
|
|
|
2602
2662
|
width: maxWidth,
|
|
2603
2663
|
height: 200,
|
|
2604
2664
|
borderRadius: theme.radii.md,
|
|
2605
|
-
backgroundColor: theme.colors.
|
|
2665
|
+
backgroundColor: theme.colors.surfaceAlt
|
|
2606
2666
|
},
|
|
2607
2667
|
resizeMode: "cover",
|
|
2608
2668
|
accessible: true,
|
|
@@ -2612,45 +2672,45 @@ function AttachmentPreview({
|
|
|
2612
2672
|
View,
|
|
2613
2673
|
{
|
|
2614
2674
|
style: [
|
|
2615
|
-
|
|
2675
|
+
styles14.imagePlaceholder,
|
|
2616
2676
|
{
|
|
2617
2677
|
width: maxWidth,
|
|
2618
2678
|
height: 200,
|
|
2619
2679
|
borderRadius: theme.radii.md,
|
|
2620
|
-
backgroundColor: theme.colors.
|
|
2680
|
+
backgroundColor: theme.colors.surfaceAlt
|
|
2621
2681
|
}
|
|
2622
2682
|
]
|
|
2623
2683
|
}
|
|
2624
2684
|
) });
|
|
2625
2685
|
}
|
|
2626
2686
|
const onBrand = tone === "onBrand";
|
|
2627
|
-
const ink = onBrand ? theme.colors.
|
|
2628
|
-
const inkSoft = onBrand ? theme.colors.
|
|
2687
|
+
const ink = onBrand ? theme.colors.ownBubbleText : theme.colors.text;
|
|
2688
|
+
const inkSoft = onBrand ? theme.colors.ownBubbleText : theme.colors.textSubtle;
|
|
2629
2689
|
return /* @__PURE__ */ jsxs(
|
|
2630
2690
|
Pressable,
|
|
2631
2691
|
{
|
|
2632
2692
|
onPress,
|
|
2633
2693
|
disabled: !onPress,
|
|
2634
2694
|
style: [
|
|
2635
|
-
|
|
2695
|
+
styles14.fileCard,
|
|
2636
2696
|
{
|
|
2637
|
-
backgroundColor: onBrand ? "rgba(255,255,255,0.18)" : theme.colors.
|
|
2697
|
+
backgroundColor: onBrand ? "rgba(255,255,255,0.18)" : theme.colors.surfaceAlt,
|
|
2638
2698
|
borderColor: onBrand ? "transparent" : theme.colors.border,
|
|
2639
2699
|
borderRadius: theme.radii.md
|
|
2640
2700
|
}
|
|
2641
2701
|
],
|
|
2642
2702
|
children: [
|
|
2643
|
-
/* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 18, color: onBrand ? ink : theme.colors.
|
|
2703
|
+
/* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 18, color: onBrand ? ink : theme.colors.textMuted }),
|
|
2644
2704
|
/* @__PURE__ */ jsxs(View, { style: { flex: 1, marginLeft: 8 }, children: [
|
|
2645
2705
|
/* @__PURE__ */ jsx(
|
|
2646
2706
|
Text,
|
|
2647
2707
|
{
|
|
2648
|
-
style: [
|
|
2708
|
+
style: [styles14.fileName, { color: ink, fontFamily: theme.fonts.body }],
|
|
2649
2709
|
numberOfLines: 1,
|
|
2650
2710
|
children: attachment.original_filename ?? "file"
|
|
2651
2711
|
}
|
|
2652
2712
|
),
|
|
2653
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
2713
|
+
/* @__PURE__ */ jsx(Text, { style: [styles14.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }], children: formatBytes2(attachment.byte_size) })
|
|
2654
2714
|
] })
|
|
2655
2715
|
]
|
|
2656
2716
|
}
|
|
@@ -2662,7 +2722,7 @@ function formatBytes2(n) {
|
|
|
2662
2722
|
if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
2663
2723
|
return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;
|
|
2664
2724
|
}
|
|
2665
|
-
var
|
|
2725
|
+
var styles14 = StyleSheet.create({
|
|
2666
2726
|
imagePlaceholder: {},
|
|
2667
2727
|
fileCard: {
|
|
2668
2728
|
flexDirection: "row",
|
|
@@ -2685,7 +2745,7 @@ function ImageMosaic({
|
|
|
2685
2745
|
squareBottom = false,
|
|
2686
2746
|
onLongPress
|
|
2687
2747
|
}) {
|
|
2688
|
-
const theme =
|
|
2748
|
+
const theme = useTheme();
|
|
2689
2749
|
const r = radius ?? theme.radii.md;
|
|
2690
2750
|
const rBottom = squareBottom ? 5 : r;
|
|
2691
2751
|
const [viewerIndex, setViewerIndex] = useState(null);
|
|
@@ -2698,7 +2758,7 @@ function ImageMosaic({
|
|
|
2698
2758
|
View,
|
|
2699
2759
|
{
|
|
2700
2760
|
style: [
|
|
2701
|
-
|
|
2761
|
+
styles15.root,
|
|
2702
2762
|
{
|
|
2703
2763
|
borderTopLeftRadius: r,
|
|
2704
2764
|
borderTopRightRadius: r,
|
|
@@ -2719,18 +2779,18 @@ function ImageMosaic({
|
|
|
2719
2779
|
{
|
|
2720
2780
|
onLongPress,
|
|
2721
2781
|
attachment: visible[0],
|
|
2722
|
-
style:
|
|
2782
|
+
style: styles15.tileFull,
|
|
2723
2783
|
onPress: () => setViewerIndex(0),
|
|
2724
2784
|
overlay: null
|
|
2725
2785
|
}
|
|
2726
2786
|
) : null,
|
|
2727
|
-
n === 2 ? /* @__PURE__ */ jsxs(View, { style:
|
|
2787
|
+
n === 2 ? /* @__PURE__ */ jsxs(View, { style: styles15.rowEven, children: [
|
|
2728
2788
|
/* @__PURE__ */ jsx(
|
|
2729
2789
|
Tile,
|
|
2730
2790
|
{
|
|
2731
2791
|
onLongPress,
|
|
2732
2792
|
attachment: visible[0],
|
|
2733
|
-
style:
|
|
2793
|
+
style: styles15.tileHalfSquare,
|
|
2734
2794
|
onPress: () => setViewerIndex(0),
|
|
2735
2795
|
overlay: null
|
|
2736
2796
|
}
|
|
@@ -2740,7 +2800,7 @@ function ImageMosaic({
|
|
|
2740
2800
|
{
|
|
2741
2801
|
onLongPress,
|
|
2742
2802
|
attachment: visible[1],
|
|
2743
|
-
style:
|
|
2803
|
+
style: styles15.tileHalfSquare,
|
|
2744
2804
|
onPress: () => setViewerIndex(1),
|
|
2745
2805
|
overlay: null
|
|
2746
2806
|
}
|
|
@@ -2752,18 +2812,18 @@ function ImageMosaic({
|
|
|
2752
2812
|
{
|
|
2753
2813
|
onLongPress,
|
|
2754
2814
|
attachment: visible[0],
|
|
2755
|
-
style:
|
|
2815
|
+
style: styles15.tileHero,
|
|
2756
2816
|
onPress: () => setViewerIndex(0),
|
|
2757
2817
|
overlay: null
|
|
2758
2818
|
}
|
|
2759
2819
|
),
|
|
2760
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
2820
|
+
/* @__PURE__ */ jsxs(View, { style: [styles15.rowEven, { marginTop: 2 }], children: [
|
|
2761
2821
|
/* @__PURE__ */ jsx(
|
|
2762
2822
|
Tile,
|
|
2763
2823
|
{
|
|
2764
2824
|
onLongPress,
|
|
2765
2825
|
attachment: visible[1],
|
|
2766
|
-
style:
|
|
2826
|
+
style: styles15.tileHalfSquare,
|
|
2767
2827
|
onPress: () => setViewerIndex(1),
|
|
2768
2828
|
overlay: null
|
|
2769
2829
|
}
|
|
@@ -2773,7 +2833,7 @@ function ImageMosaic({
|
|
|
2773
2833
|
{
|
|
2774
2834
|
onLongPress,
|
|
2775
2835
|
attachment: visible[2],
|
|
2776
|
-
style:
|
|
2836
|
+
style: styles15.tileHalfSquare,
|
|
2777
2837
|
onPress: () => setViewerIndex(2),
|
|
2778
2838
|
overlay: null
|
|
2779
2839
|
}
|
|
@@ -2781,13 +2841,13 @@ function ImageMosaic({
|
|
|
2781
2841
|
] })
|
|
2782
2842
|
] }) : null,
|
|
2783
2843
|
n === 4 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2784
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
2844
|
+
/* @__PURE__ */ jsxs(View, { style: styles15.rowEven, children: [
|
|
2785
2845
|
/* @__PURE__ */ jsx(
|
|
2786
2846
|
Tile,
|
|
2787
2847
|
{
|
|
2788
2848
|
onLongPress,
|
|
2789
2849
|
attachment: visible[0],
|
|
2790
|
-
style:
|
|
2850
|
+
style: styles15.tileHalfSquare,
|
|
2791
2851
|
onPress: () => setViewerIndex(0),
|
|
2792
2852
|
overlay: null
|
|
2793
2853
|
}
|
|
@@ -2797,19 +2857,19 @@ function ImageMosaic({
|
|
|
2797
2857
|
{
|
|
2798
2858
|
onLongPress,
|
|
2799
2859
|
attachment: visible[1],
|
|
2800
|
-
style:
|
|
2860
|
+
style: styles15.tileHalfSquare,
|
|
2801
2861
|
onPress: () => setViewerIndex(1),
|
|
2802
2862
|
overlay: null
|
|
2803
2863
|
}
|
|
2804
2864
|
)
|
|
2805
2865
|
] }),
|
|
2806
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
2866
|
+
/* @__PURE__ */ jsxs(View, { style: [styles15.rowEven, { marginTop: 2 }], children: [
|
|
2807
2867
|
/* @__PURE__ */ jsx(
|
|
2808
2868
|
Tile,
|
|
2809
2869
|
{
|
|
2810
2870
|
onLongPress,
|
|
2811
2871
|
attachment: visible[2],
|
|
2812
|
-
style:
|
|
2872
|
+
style: styles15.tileHalfSquare,
|
|
2813
2873
|
onPress: () => setViewerIndex(2),
|
|
2814
2874
|
overlay: null
|
|
2815
2875
|
}
|
|
@@ -2819,7 +2879,7 @@ function ImageMosaic({
|
|
|
2819
2879
|
{
|
|
2820
2880
|
onLongPress,
|
|
2821
2881
|
attachment: visible[3],
|
|
2822
|
-
style:
|
|
2882
|
+
style: styles15.tileHalfSquare,
|
|
2823
2883
|
onPress: () => setViewerIndex(3),
|
|
2824
2884
|
overlay: overflow > 0 ? `+${overflow}` : null
|
|
2825
2885
|
}
|
|
@@ -2855,20 +2915,20 @@ function Tile({
|
|
|
2855
2915
|
onPress,
|
|
2856
2916
|
onLongPress
|
|
2857
2917
|
}) {
|
|
2858
|
-
const theme =
|
|
2918
|
+
const theme = useTheme();
|
|
2859
2919
|
const { url } = useAttachmentUrl(attachment.id);
|
|
2860
|
-
return /* @__PURE__ */ jsxs(Pressable, { onPress, onLongPress, style: [
|
|
2920
|
+
return /* @__PURE__ */ jsxs(Pressable, { onPress, onLongPress, style: [styles15.tileBase, style], children: [
|
|
2861
2921
|
url ? /* @__PURE__ */ jsx(
|
|
2862
2922
|
Image,
|
|
2863
2923
|
{
|
|
2864
2924
|
source: { uri: url },
|
|
2865
|
-
style: [
|
|
2925
|
+
style: [styles15.tileImage, { backgroundColor: theme.colors.surfaceAlt }],
|
|
2866
2926
|
resizeMode: "cover",
|
|
2867
2927
|
accessible: true,
|
|
2868
2928
|
accessibilityLabel: attachment.original_filename ?? "image"
|
|
2869
2929
|
}
|
|
2870
|
-
) : /* @__PURE__ */ jsx(View, { style: [
|
|
2871
|
-
overlay ? /* @__PURE__ */ jsx(View, { style:
|
|
2930
|
+
) : /* @__PURE__ */ jsx(View, { style: [styles15.tileImage, { backgroundColor: theme.colors.surfaceAlt }] }),
|
|
2931
|
+
overlay ? /* @__PURE__ */ jsx(View, { style: styles15.overflow, children: /* @__PURE__ */ jsx(Text, { style: styles15.overflowText, children: overlay }) }) : null
|
|
2872
2932
|
] });
|
|
2873
2933
|
}
|
|
2874
2934
|
function FullScreenViewer({
|
|
@@ -2878,7 +2938,7 @@ function FullScreenViewer({
|
|
|
2878
2938
|
const { url } = useAttachmentUrl(attachment.id);
|
|
2879
2939
|
const { width, height } = useWindowDimensions();
|
|
2880
2940
|
const insets = useSafeInsets();
|
|
2881
|
-
return /* @__PURE__ */ jsxs(Pressable, { style:
|
|
2941
|
+
return /* @__PURE__ */ jsxs(Pressable, { style: styles15.viewer, onPress: onClose, children: [
|
|
2882
2942
|
url ? /* @__PURE__ */ jsx(
|
|
2883
2943
|
Image,
|
|
2884
2944
|
{
|
|
@@ -2894,14 +2954,14 @@ function FullScreenViewer({
|
|
|
2894
2954
|
{
|
|
2895
2955
|
onPress: onClose,
|
|
2896
2956
|
hitSlop: 12,
|
|
2897
|
-
style: [
|
|
2957
|
+
style: [styles15.closeBtn, { top: insets.top + 12, right: insets.right + 16 }],
|
|
2898
2958
|
accessibilityLabel: "Close viewer",
|
|
2899
2959
|
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 20, color: "#ffffff" })
|
|
2900
2960
|
}
|
|
2901
2961
|
)
|
|
2902
2962
|
] });
|
|
2903
2963
|
}
|
|
2904
|
-
var
|
|
2964
|
+
var styles15 = StyleSheet.create({
|
|
2905
2965
|
root: {
|
|
2906
2966
|
width: "100%",
|
|
2907
2967
|
overflow: "hidden",
|
|
@@ -3027,53 +3087,219 @@ function renderMarkdown(body, args) {
|
|
|
3027
3087
|
};
|
|
3028
3088
|
return createElement(Markdown, { style, markdownit, onLinkPress: args.onLinkPress }, body);
|
|
3029
3089
|
}
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
groupPosition = "standalone",
|
|
3037
|
-
maxBodyLength = 0,
|
|
3038
|
-
showSenderName = false,
|
|
3039
|
-
actionsTrigger,
|
|
3040
|
-
showAttachments = true,
|
|
3041
|
-
markdown = true,
|
|
3042
|
-
onLongPress
|
|
3043
|
-
}) {
|
|
3044
|
-
const theme = usePoolseTheme();
|
|
3045
|
-
const { width: screenWidth } = useWindowDimensions();
|
|
3046
|
-
const isSelf = currentUserId !== null && message.sender_id === currentUserId;
|
|
3047
|
-
const [expanded, setExpanded] = useState(false);
|
|
3048
|
-
const [lastLineWidth, setLastLineWidth] = useState(null);
|
|
3049
|
-
const [textBoxWidth, setTextBoxWidth] = useState(null);
|
|
3050
|
-
const [metaWidth, setMetaWidth] = useState(null);
|
|
3051
|
-
const bubbleMaxWidth = Math.floor(screenWidth * 0.78);
|
|
3052
|
-
const mediaWidth = Math.min(bubbleMaxWidth - 6, 420);
|
|
3053
|
-
const sender = useUser(!isSelf ? message.sender_external_id : null);
|
|
3054
|
-
const senderFallbackName = message.sender_external_id ?? "Unknown";
|
|
3055
|
-
const senderLabel = sender.profile?.displayName ?? (message.sender_external_id ? labelFor?.(message.sender_external_id) ?? senderFallbackName : senderFallbackName);
|
|
3056
|
-
const senderTint = userColor(message.sender_external_id ?? message.sender_id ?? message.id);
|
|
3057
|
-
const tailCorner = groupPosition === "last" || groupPosition === "standalone";
|
|
3058
|
-
const bubbleRadius = theme.radii.bubble;
|
|
3059
|
-
const textColor = isSelf ? theme.colors.selfBubbleText : theme.colors.otherBubbleText;
|
|
3060
|
-
const mutedOnBubble = isSelf ? theme.colors.onBrand : theme.colors.ink3;
|
|
3061
|
-
const radii2 = {
|
|
3062
|
-
topLeft: bubbleRadius,
|
|
3063
|
-
topRight: bubbleRadius,
|
|
3064
|
-
bottomLeft: bubbleRadius,
|
|
3065
|
-
bottomRight: bubbleRadius
|
|
3066
|
-
};
|
|
3067
|
-
if (tailCorner) {
|
|
3068
|
-
if (isSelf) radii2.bottomRight = 5;
|
|
3069
|
-
else radii2.bottomLeft = 5;
|
|
3090
|
+
|
|
3091
|
+
// src/layout.ts
|
|
3092
|
+
function formatClock(date, format2) {
|
|
3093
|
+
if (typeof format2 === "function") return format2(date);
|
|
3094
|
+
if (format2 === "12h") {
|
|
3095
|
+
return date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit", hour12: true });
|
|
3070
3096
|
}
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3097
|
+
if (format2 === "24h") {
|
|
3098
|
+
return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
|
|
3099
|
+
}
|
|
3100
|
+
return date.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
|
|
3101
|
+
}
|
|
3102
|
+
function formatMessageTime(iso, format2) {
|
|
3103
|
+
if (!iso) return "";
|
|
3104
|
+
const date = new Date(iso);
|
|
3105
|
+
if (Number.isNaN(date.getTime())) return "";
|
|
3106
|
+
return formatClock(date, format2);
|
|
3107
|
+
}
|
|
3108
|
+
function mentionsViewer(msg, meId) {
|
|
3109
|
+
return meId !== null && msg.sender_id !== meId && (msg.mentions ?? []).includes(meId);
|
|
3110
|
+
}
|
|
3111
|
+
function renderSlot(slot, ctx, children) {
|
|
3112
|
+
return slot && ctx ? slot({ ...ctx, children }) : children;
|
|
3113
|
+
}
|
|
3114
|
+
var DEFAULT_REACTION_EMOJIS = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}", "\u{1F64F}", "\u{1F525}"];
|
|
3115
|
+
function MessageActions({
|
|
3116
|
+
visible,
|
|
3117
|
+
onClose,
|
|
3118
|
+
isSelf,
|
|
3119
|
+
emojis = DEFAULT_REACTION_EMOJIS,
|
|
3120
|
+
onPickReaction,
|
|
3121
|
+
onReply,
|
|
3122
|
+
onReplyInThread,
|
|
3123
|
+
onQuote,
|
|
3124
|
+
onEdit,
|
|
3125
|
+
onDelete,
|
|
3126
|
+
onCopy
|
|
3127
|
+
}) {
|
|
3128
|
+
const theme = useTheme();
|
|
3129
|
+
const insets = useSafeInsets();
|
|
3130
|
+
const items = [];
|
|
3131
|
+
if (onReply) items.push({ label: "Reply", icon: "reply", onPress: onReply });
|
|
3132
|
+
if (onQuote) items.push({ label: "Quote reply", icon: "reply", onPress: onQuote });
|
|
3133
|
+
if (onReplyInThread)
|
|
3134
|
+
items.push({ label: "Reply in thread", icon: "messages", onPress: onReplyInThread });
|
|
3135
|
+
if (onCopy) items.push({ label: "Copy text", icon: "copy", onPress: onCopy });
|
|
3136
|
+
if (isSelf && onEdit) items.push({ label: "Edit", icon: "edit", onPress: onEdit });
|
|
3137
|
+
if (isSelf && onDelete)
|
|
3138
|
+
items.push({ label: "Delete", icon: "trash", onPress: onDelete, danger: true });
|
|
3139
|
+
const showEmojiRow = !!onPickReaction && emojis.length > 0;
|
|
3140
|
+
return /* @__PURE__ */ jsx(
|
|
3141
|
+
Modal,
|
|
3142
|
+
{
|
|
3143
|
+
visible,
|
|
3144
|
+
transparent: true,
|
|
3145
|
+
animationType: "fade",
|
|
3146
|
+
onRequestClose: onClose,
|
|
3147
|
+
...EDGE_TO_EDGE_MODAL,
|
|
3148
|
+
children: /* @__PURE__ */ jsx(Pressable, { style: styles16.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
|
|
3149
|
+
View,
|
|
3150
|
+
{
|
|
3151
|
+
style: [
|
|
3152
|
+
styles16.sheet,
|
|
3153
|
+
{
|
|
3154
|
+
backgroundColor: theme.colors.surface,
|
|
3155
|
+
borderTopLeftRadius: theme.radii.lg,
|
|
3156
|
+
borderTopRightRadius: theme.radii.lg,
|
|
3157
|
+
// Last action row must sit above the nav bar / home indicator.
|
|
3158
|
+
paddingBottom: 24 + insets.bottom,
|
|
3159
|
+
paddingLeft: insets.left,
|
|
3160
|
+
paddingRight: insets.right
|
|
3161
|
+
},
|
|
3162
|
+
theme.shadows.lg
|
|
3163
|
+
],
|
|
3164
|
+
children: [
|
|
3165
|
+
showEmojiRow ? /* @__PURE__ */ jsx(View, { style: [styles16.emojiRow, { borderBottomColor: theme.colors.border }], children: emojis.map((emoji) => /* @__PURE__ */ jsx(
|
|
3166
|
+
Pressable,
|
|
3167
|
+
{
|
|
3168
|
+
onPress: () => {
|
|
3169
|
+
onPickReaction(emoji);
|
|
3170
|
+
onClose();
|
|
3171
|
+
},
|
|
3172
|
+
style: styles16.emojiBtn,
|
|
3173
|
+
hitSlop: 6,
|
|
3174
|
+
accessibilityLabel: `React with ${emoji}`,
|
|
3175
|
+
children: /* @__PURE__ */ jsx(Text, { style: styles16.emoji, children: emoji })
|
|
3176
|
+
},
|
|
3177
|
+
emoji
|
|
3178
|
+
)) }) : null,
|
|
3179
|
+
items.map((item) => /* @__PURE__ */ jsxs(Pressable, { onPress: item.onPress, style: styles16.item, children: [
|
|
3180
|
+
/* @__PURE__ */ jsx(
|
|
3181
|
+
PoolseIcon,
|
|
3182
|
+
{
|
|
3183
|
+
name: item.icon,
|
|
3184
|
+
size: 18,
|
|
3185
|
+
color: item.danger ? theme.colors.danger : theme.colors.textMuted
|
|
3186
|
+
}
|
|
3187
|
+
),
|
|
3188
|
+
/* @__PURE__ */ jsx(
|
|
3189
|
+
Text,
|
|
3190
|
+
{
|
|
3191
|
+
style: [
|
|
3192
|
+
styles16.itemText,
|
|
3193
|
+
{
|
|
3194
|
+
color: item.danger ? theme.colors.danger : theme.colors.text,
|
|
3195
|
+
fontFamily: theme.fonts.body
|
|
3196
|
+
}
|
|
3197
|
+
],
|
|
3198
|
+
children: item.label
|
|
3199
|
+
}
|
|
3200
|
+
)
|
|
3201
|
+
] }, item.label))
|
|
3202
|
+
]
|
|
3203
|
+
}
|
|
3204
|
+
) })
|
|
3205
|
+
}
|
|
3206
|
+
);
|
|
3207
|
+
}
|
|
3208
|
+
var styles16 = StyleSheet.create({
|
|
3209
|
+
backdrop: {
|
|
3210
|
+
flex: 1,
|
|
3211
|
+
backgroundColor: "rgba(0,0,0,0.35)",
|
|
3212
|
+
justifyContent: "flex-end"
|
|
3213
|
+
},
|
|
3214
|
+
sheet: {
|
|
3215
|
+
paddingTop: 8,
|
|
3216
|
+
paddingBottom: 24
|
|
3217
|
+
},
|
|
3218
|
+
emojiRow: {
|
|
3219
|
+
flexDirection: "row",
|
|
3220
|
+
alignItems: "center",
|
|
3221
|
+
justifyContent: "space-around",
|
|
3222
|
+
paddingHorizontal: 12,
|
|
3223
|
+
paddingVertical: 10,
|
|
3224
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
3225
|
+
marginBottom: 6
|
|
3226
|
+
},
|
|
3227
|
+
emojiBtn: {
|
|
3228
|
+
paddingHorizontal: 6,
|
|
3229
|
+
paddingVertical: 6,
|
|
3230
|
+
borderRadius: 999,
|
|
3231
|
+
alignItems: "center",
|
|
3232
|
+
justifyContent: "center"
|
|
3233
|
+
},
|
|
3234
|
+
emoji: {
|
|
3235
|
+
fontSize: 30,
|
|
3236
|
+
lineHeight: 36
|
|
3237
|
+
},
|
|
3238
|
+
item: {
|
|
3239
|
+
flexDirection: "row",
|
|
3240
|
+
alignItems: "center",
|
|
3241
|
+
paddingHorizontal: 20,
|
|
3242
|
+
paddingVertical: 14,
|
|
3243
|
+
gap: 14
|
|
3244
|
+
},
|
|
3245
|
+
itemText: {
|
|
3246
|
+
fontSize: 15,
|
|
3247
|
+
fontWeight: "500"
|
|
3248
|
+
}
|
|
3249
|
+
});
|
|
3250
|
+
function MessageBubble({
|
|
3251
|
+
message,
|
|
3252
|
+
currentUserId,
|
|
3253
|
+
readState,
|
|
3254
|
+
labelFor,
|
|
3255
|
+
onQuotedClick,
|
|
3256
|
+
groupPosition = "standalone",
|
|
3257
|
+
maxBodyLength = 0,
|
|
3258
|
+
showSenderName = false,
|
|
3259
|
+
onSenderPress,
|
|
3260
|
+
actionsTrigger,
|
|
3261
|
+
showAttachments = true,
|
|
3262
|
+
markdown = true,
|
|
3263
|
+
onLongPress,
|
|
3264
|
+
timeFormat,
|
|
3265
|
+
density = "comfortable",
|
|
3266
|
+
slots,
|
|
3267
|
+
slotContext
|
|
3268
|
+
}) {
|
|
3269
|
+
const dense = density === "compact";
|
|
3270
|
+
const theme = useTheme();
|
|
3271
|
+
const { width: screenWidth } = useWindowDimensions();
|
|
3272
|
+
const isSelf = currentUserId !== null && message.sender_id === currentUserId;
|
|
3273
|
+
const [expanded, setExpanded] = useState(false);
|
|
3274
|
+
const [lastLineWidth, setLastLineWidth] = useState(null);
|
|
3275
|
+
const [textBoxWidth, setTextBoxWidth] = useState(null);
|
|
3276
|
+
const [metaWidth, setMetaWidth] = useState(null);
|
|
3277
|
+
const bubbleMaxWidth = Math.floor(screenWidth * 0.78);
|
|
3278
|
+
const mediaWidth = Math.min(bubbleMaxWidth - 6, 420);
|
|
3279
|
+
const sender = useUser(!isSelf ? message.sender_external_id : null);
|
|
3280
|
+
const senderFallbackName = message.sender_external_id ?? "Unknown";
|
|
3281
|
+
const senderLabel = sender.profile?.displayName ?? (message.sender_external_id ? labelFor?.(message.sender_external_id) ?? senderFallbackName : senderFallbackName);
|
|
3282
|
+
const senderTint = userColor(message.sender_external_id ?? message.sender_id ?? message.id);
|
|
3283
|
+
const tailCorner = groupPosition === "last" || groupPosition === "standalone";
|
|
3284
|
+
const bubbleRadius = theme.radii.bubble;
|
|
3285
|
+
const textColor = isSelf ? theme.colors.ownBubbleText : theme.colors.otherBubbleText;
|
|
3286
|
+
const mutedOnBubble = isSelf ? theme.colors.ownBubbleText : theme.colors.textSubtle;
|
|
3287
|
+
const radii2 = {
|
|
3288
|
+
topLeft: bubbleRadius,
|
|
3289
|
+
topRight: bubbleRadius,
|
|
3290
|
+
bottomLeft: bubbleRadius,
|
|
3291
|
+
bottomRight: bubbleRadius
|
|
3292
|
+
};
|
|
3293
|
+
if (tailCorner) {
|
|
3294
|
+
if (isSelf) radii2.bottomRight = 5;
|
|
3295
|
+
else radii2.bottomLeft = 5;
|
|
3296
|
+
}
|
|
3297
|
+
const body = message.body ?? "";
|
|
3298
|
+
const isDeleted = !!message.deleted_at;
|
|
3299
|
+
const isEdited = !!message.edited_at && !isDeleted;
|
|
3300
|
+
const trimmable = maxBodyLength > 0 && body.length > maxBodyLength;
|
|
3075
3301
|
const truncated = trimmable && !expanded ? body.slice(0, maxBodyLength) + "\u2026" : body;
|
|
3076
|
-
const time = formatTime2(message.inserted_at);
|
|
3302
|
+
const time = formatTime2(message.inserted_at, timeFormat);
|
|
3077
3303
|
const images = showAttachments && !isDeleted ? (message.attachments ?? []).filter((a) => isImageContentType(a.content_type)) : [];
|
|
3078
3304
|
const files = showAttachments && !isDeleted ? (message.attachments ?? []).filter((a) => !isImageContentType(a.content_type)) : [];
|
|
3079
3305
|
const hasMedia = images.length > 0;
|
|
@@ -3085,13 +3311,14 @@ function MessageBubble({
|
|
|
3085
3311
|
const sectionAbove = hasMedia || hasFiles || !!message.quoted_message || isDeleted;
|
|
3086
3312
|
const metaFits = lastLineWidth !== null && textBoxWidth !== null && metaWidth !== null && lastLineWidth + metaWidth + 14 <= textBoxWidth;
|
|
3087
3313
|
const metaRow = (variant) => {
|
|
3088
|
-
const color = variant === "overlay" ? "#FFFFFF" : variant === "jumbo" ? theme.colors.
|
|
3314
|
+
const color = variant === "overlay" ? "#FFFFFF" : variant === "jumbo" ? theme.colors.textSubtle : mutedOnBubble;
|
|
3089
3315
|
return /* @__PURE__ */ jsxs(
|
|
3090
3316
|
View,
|
|
3091
3317
|
{
|
|
3092
3318
|
style: [
|
|
3093
3319
|
styles17.metaRow,
|
|
3094
3320
|
variant === "inline" && styles17.metaInline,
|
|
3321
|
+
variant === "inline" && dense && styles17.metaInlineDense,
|
|
3095
3322
|
variant === "wrapped" && styles17.metaWrapped,
|
|
3096
3323
|
variant === "overlay" && styles17.metaOverlay,
|
|
3097
3324
|
variant === "block" && styles17.metaBlock,
|
|
@@ -3117,141 +3344,188 @@ function MessageBubble({
|
|
|
3117
3344
|
}
|
|
3118
3345
|
);
|
|
3119
3346
|
};
|
|
3120
|
-
return /* @__PURE__ */ jsxs(
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
style: [styles17.senderName, { color: senderTint, fontFamily: theme.type.fontBody }],
|
|
3141
|
-
children: senderLabel
|
|
3142
|
-
}
|
|
3143
|
-
) : null,
|
|
3144
|
-
message.quoted_message ? /* @__PURE__ */ jsx(
|
|
3145
|
-
QuotedCard,
|
|
3146
|
-
{
|
|
3147
|
-
quoted: message.quoted_message,
|
|
3148
|
-
isSelf,
|
|
3149
|
-
...labelFor ? { labelFor } : {},
|
|
3150
|
-
...onQuotedClick ? { onPress: () => onQuotedClick(message.quoted_message.id) } : {}
|
|
3151
|
-
}
|
|
3152
|
-
) : null,
|
|
3153
|
-
hasMedia ? (
|
|
3154
|
-
// 3px of bubble color framing the picture; the mosaic clips
|
|
3155
|
-
// itself 3px tighter than the bubble so the curves stay
|
|
3156
|
-
// concentric.
|
|
3157
|
-
/* @__PURE__ */ jsxs(View, { style: styles17.mediaFrame, children: [
|
|
3158
|
-
/* @__PURE__ */ jsx(
|
|
3159
|
-
ImageMosaic,
|
|
3160
|
-
{
|
|
3161
|
-
images,
|
|
3162
|
-
maxWidth: mediaWidth,
|
|
3163
|
-
radius: Math.max(bubbleRadius - 3, 8),
|
|
3164
|
-
squareBottom: !metaOverlay,
|
|
3165
|
-
...onLongPress ? { onLongPress } : {}
|
|
3166
|
-
}
|
|
3167
|
-
),
|
|
3168
|
-
metaOverlay ? metaRow("overlay") : null
|
|
3169
|
-
] })
|
|
3170
|
-
) : null,
|
|
3171
|
-
hasFiles ? /* @__PURE__ */ jsx(View, { style: styles17.filesBlock, children: files.map((att) => /* @__PURE__ */ jsx(
|
|
3172
|
-
AttachmentPreview,
|
|
3173
|
-
{
|
|
3174
|
-
attachment: att,
|
|
3175
|
-
maxWidth: bubbleMaxWidth - 12,
|
|
3176
|
-
tone: isSelf ? "onBrand" : "default"
|
|
3177
|
-
},
|
|
3178
|
-
att.id
|
|
3179
|
-
)) }) : null,
|
|
3180
|
-
isDeleted ? /* @__PURE__ */ jsx(View, { style: [styles17.textBlock, sectionAbove && styles17.textBlockAfter], children: /* @__PURE__ */ jsx(
|
|
3181
|
-
Text,
|
|
3182
|
-
{
|
|
3183
|
-
style: {
|
|
3184
|
-
color: mutedOnBubble,
|
|
3185
|
-
opacity: 0.7,
|
|
3186
|
-
fontFamily: theme.type.fontBody,
|
|
3187
|
-
fontSize: theme.type.bodySize,
|
|
3188
|
-
lineHeight: theme.type.lineHeight,
|
|
3189
|
-
fontStyle: "italic"
|
|
3347
|
+
return /* @__PURE__ */ jsxs(
|
|
3348
|
+
View,
|
|
3349
|
+
{
|
|
3350
|
+
style: [
|
|
3351
|
+
styles17.wrap,
|
|
3352
|
+
{ alignSelf: isSelf ? "flex-end" : "flex-start", maxWidth: bubbleMaxWidth }
|
|
3353
|
+
],
|
|
3354
|
+
children: [
|
|
3355
|
+
/* @__PURE__ */ jsxs(
|
|
3356
|
+
View,
|
|
3357
|
+
{
|
|
3358
|
+
style: [
|
|
3359
|
+
jumboCount === 0 && {
|
|
3360
|
+
backgroundColor: isSelf ? theme.colors.ownBubble : theme.colors.otherBubble,
|
|
3361
|
+
borderColor: isSelf ? "transparent" : theme.colors.border,
|
|
3362
|
+
borderWidth: isSelf ? 0 : StyleSheet.hairlineWidth,
|
|
3363
|
+
borderTopLeftRadius: radii2.topLeft,
|
|
3364
|
+
borderTopRightRadius: radii2.topRight,
|
|
3365
|
+
borderBottomLeftRadius: radii2.bottomLeft,
|
|
3366
|
+
borderBottomRightRadius: radii2.bottomRight
|
|
3190
3367
|
},
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
children: body
|
|
3199
|
-
}
|
|
3200
|
-
) }) : null,
|
|
3201
|
-
hasBody && jumboCount === 0 ? /* @__PURE__ */ jsxs(
|
|
3202
|
-
View,
|
|
3203
|
-
{
|
|
3204
|
-
style: [styles17.textBlock, sectionAbove && styles17.textBlockAfter],
|
|
3205
|
-
onLayout: inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : void 0,
|
|
3206
|
-
children: [
|
|
3207
|
-
markdown && !inlineMeta ? renderMarkdown(truncated, {
|
|
3208
|
-
textColor,
|
|
3209
|
-
linkColor: isSelf ? theme.colors.onBrand : theme.colors.brand,
|
|
3210
|
-
fontFamily: theme.type.fontBody,
|
|
3211
|
-
fontSize: theme.type.bodySize,
|
|
3212
|
-
lineHeight: theme.type.lineHeight,
|
|
3213
|
-
onLinkPress: (url) => {
|
|
3214
|
-
void Linking.openURL(url).catch(() => void 0);
|
|
3215
|
-
return false;
|
|
3216
|
-
}
|
|
3217
|
-
}) : /* @__PURE__ */ jsx(
|
|
3218
|
-
Text,
|
|
3219
|
-
{
|
|
3220
|
-
style: {
|
|
3221
|
-
color: textColor,
|
|
3222
|
-
fontFamily: theme.type.fontBody,
|
|
3223
|
-
fontSize: theme.type.bodySize,
|
|
3224
|
-
lineHeight: theme.type.lineHeight
|
|
3225
|
-
},
|
|
3226
|
-
onTextLayout: inlineMeta ? (e) => {
|
|
3227
|
-
const lines = e.nativeEvent.lines;
|
|
3228
|
-
const last = lines[lines.length - 1];
|
|
3229
|
-
setLastLineWidth(last ? Math.ceil(last.width) : 0);
|
|
3230
|
-
} : void 0,
|
|
3231
|
-
children: truncated
|
|
3232
|
-
}
|
|
3233
|
-
),
|
|
3234
|
-
trimmable ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsx(
|
|
3368
|
+
jumboCount === 0 && theme.shadows.sm
|
|
3369
|
+
],
|
|
3370
|
+
children: [
|
|
3371
|
+
renderSlot(
|
|
3372
|
+
slots?.header,
|
|
3373
|
+
slotContext,
|
|
3374
|
+
showSenderName && !isSelf && jumboCount === 0 && (groupPosition === "first" || groupPosition === "standalone") ? /* @__PURE__ */ jsx(
|
|
3235
3375
|
Text,
|
|
3236
3376
|
{
|
|
3237
|
-
style: [
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3377
|
+
style: [styles17.senderName, { color: senderTint, fontFamily: theme.fonts.body }],
|
|
3378
|
+
...onSenderPress ? {
|
|
3379
|
+
onPress: onSenderPress,
|
|
3380
|
+
accessibilityRole: "button",
|
|
3381
|
+
suppressHighlighting: true
|
|
3382
|
+
} : {},
|
|
3383
|
+
children: senderLabel
|
|
3242
3384
|
}
|
|
3243
|
-
)
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3385
|
+
) : null
|
|
3386
|
+
),
|
|
3387
|
+
message.quoted_message ? /* @__PURE__ */ jsx(
|
|
3388
|
+
QuotedCard,
|
|
3389
|
+
{
|
|
3390
|
+
quoted: message.quoted_message,
|
|
3391
|
+
isSelf,
|
|
3392
|
+
...labelFor ? { labelFor } : {},
|
|
3393
|
+
...onQuotedClick ? { onPress: () => onQuotedClick(message.quoted_message.id) } : {}
|
|
3394
|
+
}
|
|
3395
|
+
) : null,
|
|
3396
|
+
renderSlot(
|
|
3397
|
+
slots?.attachments,
|
|
3398
|
+
slotContext,
|
|
3399
|
+
hasMedia || hasFiles ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3400
|
+
hasMedia ? (
|
|
3401
|
+
// 3px of bubble color framing the picture; the mosaic clips
|
|
3402
|
+
// itself 3px tighter than the bubble so the curves stay
|
|
3403
|
+
// concentric.
|
|
3404
|
+
/* @__PURE__ */ jsxs(View, { style: styles17.mediaFrame, children: [
|
|
3405
|
+
/* @__PURE__ */ jsx(
|
|
3406
|
+
ImageMosaic,
|
|
3407
|
+
{
|
|
3408
|
+
images,
|
|
3409
|
+
maxWidth: mediaWidth,
|
|
3410
|
+
radius: Math.max(bubbleRadius - 3, 8),
|
|
3411
|
+
squareBottom: !metaOverlay,
|
|
3412
|
+
...onLongPress ? { onLongPress } : {}
|
|
3413
|
+
}
|
|
3414
|
+
),
|
|
3415
|
+
metaOverlay ? metaRow("overlay") : null
|
|
3416
|
+
] })
|
|
3417
|
+
) : null,
|
|
3418
|
+
hasFiles ? /* @__PURE__ */ jsx(View, { style: styles17.filesBlock, children: files.map((att) => /* @__PURE__ */ jsx(
|
|
3419
|
+
AttachmentPreview,
|
|
3420
|
+
{
|
|
3421
|
+
attachment: att,
|
|
3422
|
+
maxWidth: bubbleMaxWidth - 12,
|
|
3423
|
+
tone: isSelf ? "onBrand" : "default"
|
|
3424
|
+
},
|
|
3425
|
+
att.id
|
|
3426
|
+
)) }) : null
|
|
3427
|
+
] }) : null
|
|
3428
|
+
),
|
|
3429
|
+
renderSlot(
|
|
3430
|
+
slots?.body,
|
|
3431
|
+
slotContext,
|
|
3432
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3433
|
+
isDeleted ? /* @__PURE__ */ jsx(
|
|
3434
|
+
View,
|
|
3435
|
+
{
|
|
3436
|
+
style: [
|
|
3437
|
+
styles17.textBlock,
|
|
3438
|
+
dense && styles17.textBlockDense,
|
|
3439
|
+
sectionAbove && styles17.textBlockAfter
|
|
3440
|
+
],
|
|
3441
|
+
children: /* @__PURE__ */ jsx(
|
|
3442
|
+
Text,
|
|
3443
|
+
{
|
|
3444
|
+
style: {
|
|
3445
|
+
color: mutedOnBubble,
|
|
3446
|
+
opacity: 0.7,
|
|
3447
|
+
fontFamily: theme.fonts.body,
|
|
3448
|
+
fontSize: theme.fonts.sizeMd,
|
|
3449
|
+
lineHeight: theme.fonts.lineHeight,
|
|
3450
|
+
fontStyle: "italic"
|
|
3451
|
+
},
|
|
3452
|
+
children: "Message deleted"
|
|
3453
|
+
}
|
|
3454
|
+
)
|
|
3455
|
+
}
|
|
3456
|
+
) : null,
|
|
3457
|
+
hasBody && jumboCount > 0 ? /* @__PURE__ */ jsx(View, { style: styles17.jumboBlock, children: /* @__PURE__ */ jsx(
|
|
3458
|
+
Text,
|
|
3459
|
+
{
|
|
3460
|
+
style: {
|
|
3461
|
+
fontSize: emojiFontSize(jumboCount),
|
|
3462
|
+
lineHeight: emojiFontSize(jumboCount) + 8
|
|
3463
|
+
},
|
|
3464
|
+
children: body
|
|
3465
|
+
}
|
|
3466
|
+
) }) : null,
|
|
3467
|
+
hasBody && jumboCount === 0 ? /* @__PURE__ */ jsxs(
|
|
3468
|
+
View,
|
|
3469
|
+
{
|
|
3470
|
+
style: [
|
|
3471
|
+
styles17.textBlock,
|
|
3472
|
+
dense && styles17.textBlockDense,
|
|
3473
|
+
sectionAbove && styles17.textBlockAfter
|
|
3474
|
+
],
|
|
3475
|
+
onLayout: inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : void 0,
|
|
3476
|
+
children: [
|
|
3477
|
+
markdown && !inlineMeta ? renderMarkdown(truncated, {
|
|
3478
|
+
textColor,
|
|
3479
|
+
linkColor: isSelf ? theme.colors.ownBubbleText : theme.colors.link,
|
|
3480
|
+
fontFamily: theme.fonts.body,
|
|
3481
|
+
fontSize: theme.fonts.sizeMd,
|
|
3482
|
+
lineHeight: theme.fonts.lineHeight,
|
|
3483
|
+
onLinkPress: (url) => {
|
|
3484
|
+
void Linking.openURL(url).catch(() => void 0);
|
|
3485
|
+
return false;
|
|
3486
|
+
}
|
|
3487
|
+
}) : /* @__PURE__ */ jsx(
|
|
3488
|
+
Text,
|
|
3489
|
+
{
|
|
3490
|
+
style: {
|
|
3491
|
+
color: textColor,
|
|
3492
|
+
fontFamily: theme.fonts.body,
|
|
3493
|
+
fontSize: theme.fonts.sizeMd,
|
|
3494
|
+
lineHeight: theme.fonts.lineHeight
|
|
3495
|
+
},
|
|
3496
|
+
onTextLayout: inlineMeta ? (e) => {
|
|
3497
|
+
const lines = e.nativeEvent.lines;
|
|
3498
|
+
const last = lines[lines.length - 1];
|
|
3499
|
+
setLastLineWidth(last ? Math.ceil(last.width) : 0);
|
|
3500
|
+
} : void 0,
|
|
3501
|
+
children: truncated
|
|
3502
|
+
}
|
|
3503
|
+
),
|
|
3504
|
+
trimmable ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsx(
|
|
3505
|
+
Text,
|
|
3506
|
+
{
|
|
3507
|
+
style: [
|
|
3508
|
+
styles17.readMore,
|
|
3509
|
+
{ color: isSelf ? theme.colors.ownBubbleText : theme.colors.link }
|
|
3510
|
+
],
|
|
3511
|
+
children: expanded ? "Show less" : "Read more"
|
|
3512
|
+
}
|
|
3513
|
+
) }) : null,
|
|
3514
|
+
inlineMeta ? metaRow(metaFits ? "inline" : "wrapped") : null
|
|
3515
|
+
]
|
|
3516
|
+
}
|
|
3517
|
+
) : null
|
|
3518
|
+
] })
|
|
3519
|
+
),
|
|
3520
|
+
!inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow("block") : null,
|
|
3521
|
+
actionsTrigger ? /* @__PURE__ */ jsx(View, { style: styles17.actionsSlot, children: actionsTrigger }) : null
|
|
3522
|
+
]
|
|
3523
|
+
}
|
|
3524
|
+
),
|
|
3525
|
+
jumboCount > 0 ? /* @__PURE__ */ jsx(View, { style: { alignSelf: isSelf ? "flex-end" : "flex-start" }, children: metaRow("jumbo") }) : null
|
|
3526
|
+
]
|
|
3527
|
+
}
|
|
3528
|
+
);
|
|
3255
3529
|
}
|
|
3256
3530
|
function QuotedCard({
|
|
3257
3531
|
quoted,
|
|
@@ -3259,12 +3533,12 @@ function QuotedCard({
|
|
|
3259
3533
|
labelFor,
|
|
3260
3534
|
onPress
|
|
3261
3535
|
}) {
|
|
3262
|
-
const theme =
|
|
3536
|
+
const theme = useTheme();
|
|
3263
3537
|
const resolved = useUser(quoted.sender_external_id);
|
|
3264
3538
|
const senderName = quoted.sender_external_id ? labelFor?.(quoted.sender_external_id) ?? resolved.profile?.displayName ?? quoted.sender_external_id : "Unknown";
|
|
3265
|
-
const bg = isSelf ? "rgba(0,0,0,0.16)" : theme.colors.
|
|
3266
|
-
const accent = isSelf ? theme.colors.
|
|
3267
|
-
const txt = isSelf ? theme.colors.
|
|
3539
|
+
const bg = isSelf ? "rgba(0,0,0,0.16)" : theme.colors.surfaceAlt;
|
|
3540
|
+
const accent = isSelf ? theme.colors.ownBubbleText : theme.colors.accent;
|
|
3541
|
+
const txt = isSelf ? theme.colors.ownBubbleText : theme.colors.text;
|
|
3268
3542
|
return /* @__PURE__ */ jsxs(
|
|
3269
3543
|
Pressable,
|
|
3270
3544
|
{
|
|
@@ -3288,12 +3562,13 @@ function isImageContentType(ct) {
|
|
|
3288
3562
|
if (!ct) return false;
|
|
3289
3563
|
return ct.startsWith("image/");
|
|
3290
3564
|
}
|
|
3291
|
-
function formatTime2(iso) {
|
|
3565
|
+
function formatTime2(iso, format2) {
|
|
3292
3566
|
try {
|
|
3293
3567
|
const d = new Date(iso);
|
|
3568
|
+
if (typeof format2 === "function") return format2(d);
|
|
3294
3569
|
const now = /* @__PURE__ */ new Date();
|
|
3295
3570
|
const sameDay2 = isSameDay(d, now);
|
|
3296
|
-
const time = d
|
|
3571
|
+
const time = formatClock(d, format2);
|
|
3297
3572
|
if (sameDay2) return time;
|
|
3298
3573
|
const yesterday = new Date(now);
|
|
3299
3574
|
yesterday.setDate(now.getDate() - 1);
|
|
@@ -3333,6 +3608,9 @@ var styles17 = StyleSheet.create({
|
|
|
3333
3608
|
paddingHorizontal: 12,
|
|
3334
3609
|
paddingVertical: 7
|
|
3335
3610
|
},
|
|
3611
|
+
textBlockDense: {
|
|
3612
|
+
paddingVertical: 4
|
|
3613
|
+
},
|
|
3336
3614
|
// A hair less air when media / files / a quote already sit above.
|
|
3337
3615
|
textBlockAfter: {
|
|
3338
3616
|
paddingTop: 6
|
|
@@ -3364,6 +3642,10 @@ var styles17 = StyleSheet.create({
|
|
|
3364
3642
|
// sat visibly low beside a one-line message.
|
|
3365
3643
|
bottom: 11
|
|
3366
3644
|
},
|
|
3645
|
+
// Same centring for the tighter `density="compact"` text block.
|
|
3646
|
+
metaInlineDense: {
|
|
3647
|
+
bottom: 8
|
|
3648
|
+
},
|
|
3367
3649
|
metaOverlay: {
|
|
3368
3650
|
position: "absolute",
|
|
3369
3651
|
right: 6,
|
|
@@ -3430,7 +3712,7 @@ function ReactionStrip({
|
|
|
3430
3712
|
meId,
|
|
3431
3713
|
initialReactions
|
|
3432
3714
|
}) {
|
|
3433
|
-
const theme =
|
|
3715
|
+
const theme = useTheme();
|
|
3434
3716
|
const { reactions, addReaction, removeReaction } = useReactions(messageId, {
|
|
3435
3717
|
conversationId,
|
|
3436
3718
|
currentUserId: meId,
|
|
@@ -3448,8 +3730,8 @@ function ReactionStrip({
|
|
|
3448
3730
|
style: [
|
|
3449
3731
|
styles18.chip,
|
|
3450
3732
|
{
|
|
3451
|
-
backgroundColor: meReacted ? theme.colors.
|
|
3452
|
-
borderColor: meReacted ? theme.colors.
|
|
3733
|
+
backgroundColor: meReacted ? theme.colors.accentSoft : theme.colors.surfaceAlt,
|
|
3734
|
+
borderColor: meReacted ? theme.colors.accent : theme.colors.border,
|
|
3453
3735
|
borderWidth: meReacted ? 1.5 : 1,
|
|
3454
3736
|
transform: meReacted ? [{ scale: 1.04 }] : void 0
|
|
3455
3737
|
}
|
|
@@ -3462,7 +3744,7 @@ function ReactionStrip({
|
|
|
3462
3744
|
style: [
|
|
3463
3745
|
styles18.count,
|
|
3464
3746
|
{
|
|
3465
|
-
color: meReacted ? theme.colors.
|
|
3747
|
+
color: meReacted ? theme.colors.accent : theme.colors.textMuted,
|
|
3466
3748
|
fontWeight: meReacted ? "700" : "600"
|
|
3467
3749
|
}
|
|
3468
3750
|
],
|
|
@@ -3481,7 +3763,7 @@ function ReactionPicker({
|
|
|
3481
3763
|
onPick,
|
|
3482
3764
|
emojis = DEFAULT_EMOJIS
|
|
3483
3765
|
}) {
|
|
3484
|
-
const theme =
|
|
3766
|
+
const theme = useTheme();
|
|
3485
3767
|
const insets = useSafeInsets();
|
|
3486
3768
|
return /* @__PURE__ */ jsx(
|
|
3487
3769
|
Modal,
|
|
@@ -3522,64 +3804,436 @@ function ReactionPicker({
|
|
|
3522
3804
|
}
|
|
3523
3805
|
)
|
|
3524
3806
|
}
|
|
3525
|
-
)
|
|
3807
|
+
)
|
|
3808
|
+
}
|
|
3809
|
+
);
|
|
3810
|
+
}
|
|
3811
|
+
var styles18 = StyleSheet.create({
|
|
3812
|
+
strip: {
|
|
3813
|
+
flexDirection: "row",
|
|
3814
|
+
flexWrap: "wrap",
|
|
3815
|
+
gap: 4,
|
|
3816
|
+
marginTop: 2
|
|
3817
|
+
},
|
|
3818
|
+
chip: {
|
|
3819
|
+
flexDirection: "row",
|
|
3820
|
+
alignItems: "center",
|
|
3821
|
+
paddingHorizontal: 9,
|
|
3822
|
+
paddingVertical: 4,
|
|
3823
|
+
borderRadius: 14,
|
|
3824
|
+
gap: 5,
|
|
3825
|
+
minHeight: 26,
|
|
3826
|
+
// Subtle elevation so chips lift off the surface
|
|
3827
|
+
shadowColor: "#000",
|
|
3828
|
+
shadowOffset: { width: 0, height: 1 },
|
|
3829
|
+
shadowOpacity: 0.06,
|
|
3830
|
+
shadowRadius: 2,
|
|
3831
|
+
elevation: 1
|
|
3832
|
+
},
|
|
3833
|
+
emoji: {
|
|
3834
|
+
fontSize: 15,
|
|
3835
|
+
lineHeight: 18
|
|
3836
|
+
},
|
|
3837
|
+
count: {
|
|
3838
|
+
fontSize: 12,
|
|
3839
|
+
fontVariant: ["tabular-nums"]
|
|
3840
|
+
},
|
|
3841
|
+
backdrop: {
|
|
3842
|
+
flex: 1,
|
|
3843
|
+
backgroundColor: "rgba(0,0,0,0.4)",
|
|
3844
|
+
justifyContent: "center",
|
|
3845
|
+
alignItems: "center",
|
|
3846
|
+
paddingHorizontal: 24
|
|
3847
|
+
},
|
|
3848
|
+
sheet: {
|
|
3849
|
+
flexDirection: "row",
|
|
3850
|
+
paddingHorizontal: 12,
|
|
3851
|
+
paddingVertical: 12,
|
|
3852
|
+
gap: 4,
|
|
3853
|
+
alignItems: "center"
|
|
3854
|
+
},
|
|
3855
|
+
emojiBtn: {
|
|
3856
|
+
paddingHorizontal: 8,
|
|
3857
|
+
paddingVertical: 6,
|
|
3858
|
+
borderRadius: 999,
|
|
3859
|
+
alignItems: "center",
|
|
3860
|
+
justifyContent: "center"
|
|
3861
|
+
},
|
|
3862
|
+
bigEmoji: {
|
|
3863
|
+
fontSize: 32,
|
|
3864
|
+
lineHeight: 38
|
|
3865
|
+
}
|
|
3866
|
+
});
|
|
3867
|
+
var GUTTER = 40;
|
|
3868
|
+
function FlatMessageRow({
|
|
3869
|
+
msg,
|
|
3870
|
+
meId,
|
|
3871
|
+
layout,
|
|
3872
|
+
reactions = true,
|
|
3873
|
+
attachments = true,
|
|
3874
|
+
actions = true,
|
|
3875
|
+
threads = true,
|
|
3876
|
+
quotations = true,
|
|
3877
|
+
markdown = true,
|
|
3878
|
+
readState,
|
|
3879
|
+
isEditing = false,
|
|
3880
|
+
onStartEdit,
|
|
3881
|
+
onDelete,
|
|
3882
|
+
onOpenThread,
|
|
3883
|
+
onQuote,
|
|
3884
|
+
labelFor,
|
|
3885
|
+
onQuotedClick,
|
|
3886
|
+
groupPosition = "standalone",
|
|
3887
|
+
maxBodyLength = 0,
|
|
3888
|
+
showAvatar = layout === "list",
|
|
3889
|
+
avatarFor,
|
|
3890
|
+
onSenderPress,
|
|
3891
|
+
onAvatarPress,
|
|
3892
|
+
density = "comfortable",
|
|
3893
|
+
timeFormat,
|
|
3894
|
+
slots,
|
|
3895
|
+
mentionsMe = false
|
|
3896
|
+
}) {
|
|
3897
|
+
const theme = useTheme();
|
|
3898
|
+
const { width: screenWidth } = useWindowDimensions();
|
|
3899
|
+
const compact = layout === "compact";
|
|
3900
|
+
const dense = density === "compact";
|
|
3901
|
+
const isSelf = meId !== null && msg.sender_id === meId;
|
|
3902
|
+
const [actionsOpen, setActionsOpen] = useState(false);
|
|
3903
|
+
const [expanded, setExpanded] = useState(false);
|
|
3904
|
+
const reactionsApi = useReactions(msg.id, {
|
|
3905
|
+
conversationId: msg.conversation_id,
|
|
3906
|
+
currentUserId: meId,
|
|
3907
|
+
...msg.reactions ? { initialReactions: msg.reactions } : {}
|
|
3908
|
+
});
|
|
3909
|
+
const resolved = useUser(msg.sender_external_id);
|
|
3910
|
+
const ext = msg.sender_external_id;
|
|
3911
|
+
const senderName = ext ? labelFor?.(ext) ?? resolved.profile?.displayName ?? ext : msg.sender_id ? `User ${msg.sender_id.slice(0, 6)}` : "Unknown";
|
|
3912
|
+
const avatarUrl = ext ? avatarFor?.(ext) ?? resolved.profile?.avatarUrl ?? null : null;
|
|
3913
|
+
const sender = {
|
|
3914
|
+
userId: msg.sender_id,
|
|
3915
|
+
externalId: ext,
|
|
3916
|
+
displayName: senderName,
|
|
3917
|
+
avatarUrl
|
|
3918
|
+
};
|
|
3919
|
+
const isRunStart = compact || groupPosition === "first" || groupPosition === "standalone";
|
|
3920
|
+
const ctx = { message: msg, isSelf, sender, layout, isRunStart };
|
|
3921
|
+
const deleted = !!msg.deleted_at;
|
|
3922
|
+
const time = formatMessageTime(msg.inserted_at, timeFormat);
|
|
3923
|
+
const openActions = () => {
|
|
3924
|
+
if (actions && !deleted) setActionsOpen(true);
|
|
3925
|
+
};
|
|
3926
|
+
const text = { fontFamily: theme.fonts.body, color: theme.colors.text };
|
|
3927
|
+
const avatarEl = showAvatar ? /* @__PURE__ */ jsx(Avatar, { src: avatarUrl, name: senderName, seed: ext, size: compact ? "xs" : "md" }) : null;
|
|
3928
|
+
const avatar = avatarEl && onAvatarPress && !isSelf ? /* @__PURE__ */ jsx(
|
|
3929
|
+
Pressable,
|
|
3930
|
+
{
|
|
3931
|
+
onPress: () => onAvatarPress(sender),
|
|
3932
|
+
accessibilityRole: "button",
|
|
3933
|
+
accessibilityLabel: senderName,
|
|
3934
|
+
hitSlop: 6,
|
|
3935
|
+
children: avatarEl
|
|
3936
|
+
}
|
|
3937
|
+
) : avatarEl;
|
|
3938
|
+
const name = /* @__PURE__ */ jsx(
|
|
3939
|
+
Text,
|
|
3940
|
+
{
|
|
3941
|
+
style: [
|
|
3942
|
+
styles19.name,
|
|
3943
|
+
text,
|
|
3944
|
+
compact ? { color: userColor(ext ?? msg.sender_id ?? msg.id) } : null,
|
|
3945
|
+
compact ? styles19.nameCompact : null
|
|
3946
|
+
],
|
|
3947
|
+
numberOfLines: 1,
|
|
3948
|
+
...onSenderPress && !isSelf ? {
|
|
3949
|
+
onPress: () => onSenderPress(sender),
|
|
3950
|
+
accessibilityRole: "button",
|
|
3951
|
+
suppressHighlighting: true
|
|
3952
|
+
} : {},
|
|
3953
|
+
children: senderName
|
|
3954
|
+
}
|
|
3955
|
+
);
|
|
3956
|
+
const timeText = (dim) => /* @__PURE__ */ jsx(
|
|
3957
|
+
Text,
|
|
3958
|
+
{
|
|
3959
|
+
style: [
|
|
3960
|
+
styles19.time,
|
|
3961
|
+
{ color: theme.colors.textSubtle, fontFamily: theme.fonts.body },
|
|
3962
|
+
dim ? styles19.timeDim : null
|
|
3963
|
+
],
|
|
3964
|
+
children: time
|
|
3965
|
+
}
|
|
3966
|
+
);
|
|
3967
|
+
const header = compact ? name : isRunStart ? /* @__PURE__ */ jsxs(View, { style: styles19.header, children: [
|
|
3968
|
+
name,
|
|
3969
|
+
timeText(false)
|
|
3970
|
+
] }) : null;
|
|
3971
|
+
const images = attachments && !deleted ? (msg.attachments ?? []).filter((a) => isImageContentType(a.content_type)) : [];
|
|
3972
|
+
const files = attachments && !deleted ? (msg.attachments ?? []).filter((a) => !isImageContentType(a.content_type)) : [];
|
|
3973
|
+
const mediaWidth = Math.min(screenWidth - GUTTER - 48, 320);
|
|
3974
|
+
const attachmentsEl = images.length > 0 || files.length > 0 ? /* @__PURE__ */ jsxs(View, { style: styles19.attachments, children: [
|
|
3975
|
+
images.length > 0 ? /* @__PURE__ */ jsx(
|
|
3976
|
+
ImageMosaic,
|
|
3977
|
+
{
|
|
3978
|
+
images,
|
|
3979
|
+
maxWidth: mediaWidth,
|
|
3980
|
+
radius: theme.radii.md,
|
|
3981
|
+
onLongPress: openActions
|
|
3982
|
+
}
|
|
3983
|
+
) : null,
|
|
3984
|
+
files.map((att) => /* @__PURE__ */ jsx(AttachmentPreview, { attachment: att, maxWidth: mediaWidth }, att.id))
|
|
3985
|
+
] }) : null;
|
|
3986
|
+
const raw = msg.body ?? "";
|
|
3987
|
+
const trimmable = maxBodyLength > 0 && raw.length > maxBodyLength;
|
|
3988
|
+
const shown = trimmable && !expanded ? raw.slice(0, maxBodyLength) + "\u2026" : raw;
|
|
3989
|
+
const jumbo = raw && images.length === 0 && files.length === 0 && !msg.quoted_message_id ? emojiOnlyCount(raw) : 0;
|
|
3990
|
+
const bodyText = {
|
|
3991
|
+
...text,
|
|
3992
|
+
fontSize: dense ? theme.fonts.sizeMd - 1 : theme.fonts.sizeMd,
|
|
3993
|
+
lineHeight: dense ? theme.fonts.lineHeight - 3 : theme.fonts.lineHeight
|
|
3994
|
+
};
|
|
3995
|
+
const edited = !!msg.edited_at && !deleted;
|
|
3996
|
+
const meta = edited || isSelf && readState ? /* @__PURE__ */ jsxs(View, { style: styles19.meta, children: [
|
|
3997
|
+
edited ? /* @__PURE__ */ jsx(Text, { style: [styles19.edited, { color: theme.colors.textSubtle }], children: "(edited)" }) : null,
|
|
3998
|
+
isSelf && readState ? /* @__PURE__ */ jsx(
|
|
3999
|
+
PoolseIcon,
|
|
4000
|
+
{
|
|
4001
|
+
name: readState === "read" ? "check-double" : "check",
|
|
4002
|
+
size: 13,
|
|
4003
|
+
color: readState === "read" ? theme.colors.accent : theme.colors.textSubtle
|
|
4004
|
+
}
|
|
4005
|
+
) : null
|
|
4006
|
+
] }) : null;
|
|
4007
|
+
const body = deleted ? /* @__PURE__ */ jsx(Text, { style: [bodyText, styles19.deleted, { color: theme.colors.textMuted }], children: "Message deleted" }) : raw ? /* @__PURE__ */ jsxs(View, { children: [
|
|
4008
|
+
jumbo > 0 ? /* @__PURE__ */ jsx(Text, { style: { fontSize: emojiFontSize(jumbo), lineHeight: emojiFontSize(jumbo) + 8 }, children: raw }) : markdown && hasMarkdown(shown) ? renderMarkdown(shown, {
|
|
4009
|
+
textColor: bodyText.color,
|
|
4010
|
+
linkColor: theme.colors.link,
|
|
4011
|
+
fontFamily: theme.fonts.body,
|
|
4012
|
+
fontSize: bodyText.fontSize,
|
|
4013
|
+
lineHeight: bodyText.lineHeight,
|
|
4014
|
+
onLinkPress: (url) => {
|
|
4015
|
+
void Linking.openURL(url).catch(() => void 0);
|
|
4016
|
+
return false;
|
|
4017
|
+
}
|
|
4018
|
+
}) : /* @__PURE__ */ jsx(Text, { style: bodyText, children: shown }),
|
|
4019
|
+
trimmable ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsx(Text, { style: [styles19.readMore, { color: theme.colors.link }], children: expanded ? "Show less" : "Read more" }) }) : null,
|
|
4020
|
+
meta
|
|
4021
|
+
] }) : meta;
|
|
4022
|
+
const replyCount = msg.reply_count ?? 0;
|
|
4023
|
+
const threadEl = threads && !deleted && !msg.thread_root_id && replyCount > 0 && onOpenThread ? /* @__PURE__ */ jsxs(Pressable, { onPress: onOpenThread, style: styles19.thread, accessibilityRole: "button", children: [
|
|
4024
|
+
/* @__PURE__ */ jsx(PoolseIcon, { name: "messages", size: 13, color: theme.colors.link }),
|
|
4025
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles19.threadText, { color: theme.colors.link }], children: [
|
|
4026
|
+
replyCount,
|
|
4027
|
+
" ",
|
|
4028
|
+
replyCount === 1 ? "reply" : "replies"
|
|
4029
|
+
] })
|
|
4030
|
+
] }) : null;
|
|
4031
|
+
const reactionsEl = reactions && !deleted ? /* @__PURE__ */ jsx(View, { style: styles19.reactions, children: /* @__PURE__ */ jsx(
|
|
4032
|
+
ReactionStrip,
|
|
4033
|
+
{
|
|
4034
|
+
messageId: msg.id,
|
|
4035
|
+
conversationId: msg.conversation_id,
|
|
4036
|
+
meId,
|
|
4037
|
+
...msg.reactions ? { initialReactions: msg.reactions } : {}
|
|
4038
|
+
}
|
|
4039
|
+
) }) : null;
|
|
4040
|
+
const quote = msg.quoted_message ? /* @__PURE__ */ jsx(
|
|
4041
|
+
QuotedCard,
|
|
4042
|
+
{
|
|
4043
|
+
quoted: msg.quoted_message,
|
|
4044
|
+
isSelf: false,
|
|
4045
|
+
...labelFor ? { labelFor } : {},
|
|
4046
|
+
...onQuotedClick ? { onPress: () => onQuotedClick(msg.quoted_message.id) } : {}
|
|
4047
|
+
}
|
|
4048
|
+
) : null;
|
|
4049
|
+
const content = /* @__PURE__ */ jsxs(View, { style: styles19.content, children: [
|
|
4050
|
+
!compact ? renderSlot(slots?.header, ctx, header) : null,
|
|
4051
|
+
quote,
|
|
4052
|
+
renderSlot(slots?.attachments, ctx, attachmentsEl),
|
|
4053
|
+
renderSlot(slots?.body, ctx, body),
|
|
4054
|
+
renderSlot(slots?.reactions, ctx, reactionsEl),
|
|
4055
|
+
renderSlot(slots?.thread, ctx, threadEl)
|
|
4056
|
+
] });
|
|
4057
|
+
const close = () => setActionsOpen(false);
|
|
4058
|
+
const sheet = actions && actionsOpen ? /* @__PURE__ */ jsx(
|
|
4059
|
+
MessageActions,
|
|
4060
|
+
{
|
|
4061
|
+
visible: true,
|
|
4062
|
+
onClose: close,
|
|
4063
|
+
isSelf,
|
|
4064
|
+
...reactions ? { onPickReaction: (emoji) => void reactionsApi.addReaction(emoji) } : {},
|
|
4065
|
+
...msg.body && !deleted ? {
|
|
4066
|
+
onCopy: () => {
|
|
4067
|
+
close();
|
|
4068
|
+
void Clipboard.setStringAsync(msg.body ?? "");
|
|
4069
|
+
}
|
|
4070
|
+
} : {},
|
|
4071
|
+
...onStartEdit ? {
|
|
4072
|
+
onEdit: () => {
|
|
4073
|
+
close();
|
|
4074
|
+
onStartEdit();
|
|
4075
|
+
}
|
|
4076
|
+
} : {},
|
|
4077
|
+
...onDelete ? {
|
|
4078
|
+
onDelete: () => {
|
|
4079
|
+
close();
|
|
4080
|
+
onDelete();
|
|
4081
|
+
}
|
|
4082
|
+
} : {},
|
|
4083
|
+
...threads && onOpenThread ? {
|
|
4084
|
+
onReplyInThread: () => {
|
|
4085
|
+
close();
|
|
4086
|
+
onOpenThread();
|
|
4087
|
+
}
|
|
4088
|
+
} : {},
|
|
4089
|
+
...quotations && onQuote ? {
|
|
4090
|
+
onQuote: () => {
|
|
4091
|
+
close();
|
|
4092
|
+
onQuote();
|
|
4093
|
+
}
|
|
4094
|
+
} : {}
|
|
4095
|
+
}
|
|
4096
|
+
) : null;
|
|
4097
|
+
return /* @__PURE__ */ jsxs(
|
|
4098
|
+
View,
|
|
4099
|
+
{
|
|
4100
|
+
style: [
|
|
4101
|
+
styles19.row,
|
|
4102
|
+
compact ? styles19.rowCompact : null,
|
|
4103
|
+
dense ? styles19.rowDense : null,
|
|
4104
|
+
!compact && isRunStart ? dense ? styles19.runStartDense : styles19.runStart : null,
|
|
4105
|
+
mentionsMe ? { backgroundColor: theme.colors.mention, borderLeftColor: theme.colors.accent } : null,
|
|
4106
|
+
isEditing ? styles19.rowEditing : null
|
|
4107
|
+
],
|
|
4108
|
+
children: [
|
|
4109
|
+
/* @__PURE__ */ jsx(
|
|
4110
|
+
Pressable,
|
|
4111
|
+
{
|
|
4112
|
+
onLongPress: openActions,
|
|
4113
|
+
style: [styles19.line, compact ? styles19.lineCompact : null],
|
|
4114
|
+
accessibilityRole: "button",
|
|
4115
|
+
accessibilityLabel: "Message actions",
|
|
4116
|
+
children: compact ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4117
|
+
timeText(false),
|
|
4118
|
+
avatar ? /* @__PURE__ */ jsx(View, { style: styles19.avatarCompact, children: avatar }) : null,
|
|
4119
|
+
renderSlot(slots?.header, ctx, header),
|
|
4120
|
+
content
|
|
4121
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4122
|
+
/* @__PURE__ */ jsx(View, { style: styles19.gutter, children: isRunStart ? avatar : timeText(true) }),
|
|
4123
|
+
content
|
|
4124
|
+
] })
|
|
4125
|
+
}
|
|
4126
|
+
),
|
|
4127
|
+
renderSlot(slots?.actions, ctx, sheet)
|
|
4128
|
+
]
|
|
3526
4129
|
}
|
|
3527
4130
|
);
|
|
3528
4131
|
}
|
|
3529
|
-
var
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
4132
|
+
var styles19 = StyleSheet.create({
|
|
4133
|
+
row: {
|
|
4134
|
+
// 3px left border reserved for the mention accent bar.
|
|
4135
|
+
borderLeftWidth: 3,
|
|
4136
|
+
borderLeftColor: "transparent",
|
|
4137
|
+
paddingLeft: 9,
|
|
4138
|
+
paddingRight: 12,
|
|
4139
|
+
paddingVertical: 2
|
|
3535
4140
|
},
|
|
3536
|
-
|
|
4141
|
+
rowCompact: {
|
|
4142
|
+
paddingVertical: 1
|
|
4143
|
+
},
|
|
4144
|
+
rowDense: {
|
|
4145
|
+
paddingVertical: 0
|
|
4146
|
+
},
|
|
4147
|
+
runStart: {
|
|
4148
|
+
marginTop: 8,
|
|
4149
|
+
paddingTop: 4
|
|
4150
|
+
},
|
|
4151
|
+
runStartDense: {
|
|
4152
|
+
marginTop: 4,
|
|
4153
|
+
paddingTop: 2
|
|
4154
|
+
},
|
|
4155
|
+
rowEditing: {
|
|
4156
|
+
// Above ConversationView's edit backdrop, like the bubble row.
|
|
4157
|
+
zIndex: 10,
|
|
4158
|
+
elevation: 10
|
|
4159
|
+
},
|
|
4160
|
+
line: {
|
|
3537
4161
|
flexDirection: "row",
|
|
3538
|
-
alignItems: "
|
|
3539
|
-
|
|
3540
|
-
paddingVertical: 4,
|
|
3541
|
-
borderRadius: 14,
|
|
3542
|
-
gap: 5,
|
|
3543
|
-
minHeight: 26,
|
|
3544
|
-
// Subtle elevation so chips lift off the surface
|
|
3545
|
-
shadowColor: "#000",
|
|
3546
|
-
shadowOffset: { width: 0, height: 1 },
|
|
3547
|
-
shadowOpacity: 0.06,
|
|
3548
|
-
shadowRadius: 2,
|
|
3549
|
-
elevation: 1
|
|
4162
|
+
alignItems: "flex-start",
|
|
4163
|
+
gap: 8
|
|
3550
4164
|
},
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
lineHeight: 18
|
|
4165
|
+
lineCompact: {
|
|
4166
|
+
gap: 6
|
|
3554
4167
|
},
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
4168
|
+
gutter: {
|
|
4169
|
+
width: GUTTER,
|
|
4170
|
+
alignItems: "center"
|
|
3558
4171
|
},
|
|
3559
|
-
|
|
4172
|
+
avatarCompact: {
|
|
4173
|
+
marginTop: 1
|
|
4174
|
+
},
|
|
4175
|
+
content: {
|
|
3560
4176
|
flex: 1,
|
|
3561
|
-
|
|
3562
|
-
justifyContent: "center",
|
|
3563
|
-
alignItems: "center",
|
|
3564
|
-
paddingHorizontal: 24
|
|
4177
|
+
minWidth: 0
|
|
3565
4178
|
},
|
|
3566
|
-
|
|
4179
|
+
header: {
|
|
3567
4180
|
flexDirection: "row",
|
|
3568
|
-
|
|
3569
|
-
|
|
4181
|
+
alignItems: "baseline",
|
|
4182
|
+
gap: 8
|
|
4183
|
+
},
|
|
4184
|
+
name: {
|
|
4185
|
+
fontSize: 14,
|
|
4186
|
+
fontWeight: "700",
|
|
4187
|
+
flexShrink: 1
|
|
4188
|
+
},
|
|
4189
|
+
nameCompact: {
|
|
4190
|
+
maxWidth: "35%",
|
|
4191
|
+
flexShrink: 0
|
|
4192
|
+
},
|
|
4193
|
+
time: {
|
|
4194
|
+
fontSize: 11,
|
|
4195
|
+
fontVariant: ["tabular-nums"],
|
|
4196
|
+
lineHeight: 20
|
|
4197
|
+
},
|
|
4198
|
+
timeDim: {
|
|
4199
|
+
fontSize: 10,
|
|
4200
|
+
opacity: 0.7
|
|
4201
|
+
},
|
|
4202
|
+
attachments: {
|
|
4203
|
+
marginVertical: 4,
|
|
4204
|
+
gap: 4
|
|
4205
|
+
},
|
|
4206
|
+
deleted: {
|
|
4207
|
+
fontStyle: "italic"
|
|
4208
|
+
},
|
|
4209
|
+
readMore: {
|
|
4210
|
+
fontSize: 12,
|
|
4211
|
+
fontWeight: "600",
|
|
4212
|
+
marginTop: 2
|
|
4213
|
+
},
|
|
4214
|
+
meta: {
|
|
4215
|
+
flexDirection: "row",
|
|
4216
|
+
alignItems: "center",
|
|
3570
4217
|
gap: 4,
|
|
3571
|
-
|
|
4218
|
+
marginTop: 1
|
|
3572
4219
|
},
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
4220
|
+
edited: {
|
|
4221
|
+
fontSize: 11
|
|
4222
|
+
},
|
|
4223
|
+
reactions: {
|
|
4224
|
+
marginTop: 4,
|
|
4225
|
+
alignSelf: "flex-start"
|
|
4226
|
+
},
|
|
4227
|
+
thread: {
|
|
4228
|
+
flexDirection: "row",
|
|
3577
4229
|
alignItems: "center",
|
|
3578
|
-
|
|
4230
|
+
gap: 4,
|
|
4231
|
+
marginTop: 4,
|
|
4232
|
+
alignSelf: "flex-start"
|
|
3579
4233
|
},
|
|
3580
|
-
|
|
3581
|
-
fontSize:
|
|
3582
|
-
|
|
4234
|
+
threadText: {
|
|
4235
|
+
fontSize: 12.5,
|
|
4236
|
+
fontWeight: "600"
|
|
3583
4237
|
}
|
|
3584
4238
|
});
|
|
3585
4239
|
var SWIPE_REPLY_THRESHOLD = 50;
|
|
@@ -3595,6 +4249,9 @@ function MessageRow(props) {
|
|
|
3595
4249
|
}
|
|
3596
4250
|
) : null;
|
|
3597
4251
|
}
|
|
4252
|
+
if (props.layout === "list" || props.layout === "compact") {
|
|
4253
|
+
return /* @__PURE__ */ jsx(FlatMessageRow, { ...props, layout: props.layout });
|
|
4254
|
+
}
|
|
3598
4255
|
return /* @__PURE__ */ jsx(BubbleMessageRow, { ...props });
|
|
3599
4256
|
}
|
|
3600
4257
|
function BubbleMessageRow({
|
|
@@ -3618,9 +4275,14 @@ function BubbleMessageRow({
|
|
|
3618
4275
|
maxBodyLength = 0,
|
|
3619
4276
|
showSenderName = false,
|
|
3620
4277
|
showAvatar = false,
|
|
3621
|
-
avatarFor
|
|
4278
|
+
avatarFor,
|
|
4279
|
+
onSenderPress,
|
|
4280
|
+
onAvatarPress,
|
|
4281
|
+
density = "comfortable",
|
|
4282
|
+
timeFormat,
|
|
4283
|
+
slots
|
|
3622
4284
|
}) {
|
|
3623
|
-
const theme =
|
|
4285
|
+
const theme = useTheme();
|
|
3624
4286
|
const isSelf = meId !== null && msg.sender_id === meId;
|
|
3625
4287
|
const [actionsOpen, setActionsOpen] = useState(false);
|
|
3626
4288
|
const reactionsApi = useReactions(msg.id, {
|
|
@@ -3701,45 +4363,70 @@ function BubbleMessageRow({
|
|
|
3701
4363
|
});
|
|
3702
4364
|
const showAvatarSlot = showAvatar && !isSelf;
|
|
3703
4365
|
const showAvatarRender = showAvatarSlot && (groupPosition === "last" || groupPosition === "standalone");
|
|
3704
|
-
const
|
|
4366
|
+
const wantsSender = showAvatarSlot || !isSelf && onSenderPress !== void 0;
|
|
4367
|
+
const rowSender = useUser(wantsSender ? msg.sender_external_id : null);
|
|
3705
4368
|
const avatarUrl = msg.sender_external_id ? avatarFor?.(msg.sender_external_id) ?? rowSender.profile?.avatarUrl ?? null : null;
|
|
3706
4369
|
const senderLabel = msg.sender_external_id ? labelFor?.(msg.sender_external_id) ?? rowSender.profile?.displayName ?? msg.sender_external_id : null;
|
|
4370
|
+
const sender = {
|
|
4371
|
+
userId: msg.sender_id,
|
|
4372
|
+
externalId: msg.sender_external_id,
|
|
4373
|
+
displayName: senderLabel ?? "Unknown",
|
|
4374
|
+
avatarUrl
|
|
4375
|
+
};
|
|
4376
|
+
const slotContext = {
|
|
4377
|
+
message: msg,
|
|
4378
|
+
isSelf,
|
|
4379
|
+
sender,
|
|
4380
|
+
layout: "bubbles",
|
|
4381
|
+
isRunStart: groupPosition === "first" || groupPosition === "standalone"
|
|
4382
|
+
};
|
|
4383
|
+
const avatar = /* @__PURE__ */ jsx(
|
|
4384
|
+
Avatar,
|
|
4385
|
+
{
|
|
4386
|
+
src: avatarUrl ?? null,
|
|
4387
|
+
name: senderLabel,
|
|
4388
|
+
seed: msg.sender_external_id ?? null,
|
|
4389
|
+
size: "sm"
|
|
4390
|
+
}
|
|
4391
|
+
);
|
|
3707
4392
|
return /* @__PURE__ */ jsxs(
|
|
3708
4393
|
View,
|
|
3709
4394
|
{
|
|
3710
4395
|
style: [
|
|
3711
|
-
|
|
4396
|
+
styles20.row,
|
|
3712
4397
|
{ alignSelf: isSelf ? "flex-end" : "flex-start" },
|
|
4398
|
+
density === "compact" ? styles20.rowDense : null,
|
|
3713
4399
|
// Lift this row above the dim backdrop the parent renders
|
|
3714
4400
|
// during edit mode. zIndex covers iOS / web; elevation does
|
|
3715
4401
|
// the equivalent on Android.
|
|
3716
|
-
isEditing ?
|
|
4402
|
+
isEditing ? styles20.rowEditing : null
|
|
3717
4403
|
],
|
|
3718
4404
|
children: [
|
|
3719
|
-
showAvatarSlot ? /* @__PURE__ */ jsx(View, { style:
|
|
3720
|
-
|
|
4405
|
+
showAvatarSlot ? /* @__PURE__ */ jsx(View, { style: styles20.avatarSlot, children: !showAvatarRender ? null : onAvatarPress ? /* @__PURE__ */ jsx(
|
|
4406
|
+
Pressable,
|
|
3721
4407
|
{
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
4408
|
+
onPress: () => onAvatarPress(sender),
|
|
4409
|
+
accessibilityRole: "button",
|
|
4410
|
+
accessibilityLabel: sender.displayName,
|
|
4411
|
+
hitSlop: 6,
|
|
4412
|
+
children: avatar
|
|
3726
4413
|
}
|
|
3727
|
-
) :
|
|
3728
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
4414
|
+
) : avatar }) : null,
|
|
4415
|
+
/* @__PURE__ */ jsxs(View, { style: styles20.bubbleCol, children: [
|
|
3729
4416
|
swipeEnabled ? /* @__PURE__ */ jsx(
|
|
3730
4417
|
Animated.View,
|
|
3731
4418
|
{
|
|
3732
4419
|
pointerEvents: "none",
|
|
3733
4420
|
style: [
|
|
3734
|
-
|
|
3735
|
-
isSelf ?
|
|
4421
|
+
styles20.replyHint,
|
|
4422
|
+
isSelf ? styles20.replyHintRight : styles20.replyHintLeft,
|
|
3736
4423
|
{
|
|
3737
4424
|
opacity: replyIconOpacity,
|
|
3738
4425
|
transform: [{ scale: replyIconScale }],
|
|
3739
|
-
backgroundColor: theme.colors.
|
|
4426
|
+
backgroundColor: theme.colors.surfaceAlt
|
|
3740
4427
|
}
|
|
3741
4428
|
],
|
|
3742
|
-
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "reply", size: 16, color: theme.colors.
|
|
4429
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "reply", size: 16, color: theme.colors.accent })
|
|
3743
4430
|
}
|
|
3744
4431
|
) : null,
|
|
3745
4432
|
/* @__PURE__ */ jsx(
|
|
@@ -3767,8 +4454,12 @@ function BubbleMessageRow({
|
|
|
3767
4454
|
groupPosition,
|
|
3768
4455
|
maxBodyLength,
|
|
3769
4456
|
showSenderName,
|
|
4457
|
+
...onSenderPress ? { onSenderPress: () => onSenderPress(sender) } : {},
|
|
3770
4458
|
showAttachments: attachments,
|
|
3771
4459
|
markdown,
|
|
4460
|
+
density,
|
|
4461
|
+
...timeFormat ? { timeFormat } : {},
|
|
4462
|
+
...slots ? { slots, slotContext } : {},
|
|
3772
4463
|
onLongPress: () => {
|
|
3773
4464
|
if (actions) setActionsOpen(true);
|
|
3774
4465
|
}
|
|
@@ -3778,72 +4469,84 @@ function BubbleMessageRow({
|
|
|
3778
4469
|
)
|
|
3779
4470
|
}
|
|
3780
4471
|
),
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
4472
|
+
renderSlot(
|
|
4473
|
+
slots?.thread,
|
|
4474
|
+
slotContext,
|
|
4475
|
+
threads && (msg.reply_count ?? 0) > 0 && onOpenThread ? /* @__PURE__ */ jsx(Pressable, { onPress: onOpenThread, style: styles20.threadPill, children: /* @__PURE__ */ jsxs(Text, { style: [styles20.threadPillText, { color: theme.colors.accent }], children: [
|
|
4476
|
+
"\u{1F4AC} ",
|
|
4477
|
+
msg.reply_count,
|
|
4478
|
+
" ",
|
|
4479
|
+
msg.reply_count === 1 ? "reply" : "replies"
|
|
4480
|
+
] }) }) : null
|
|
4481
|
+
),
|
|
4482
|
+
renderSlot(
|
|
4483
|
+
slots?.reactions,
|
|
4484
|
+
slotContext,
|
|
4485
|
+
reactions ? /* @__PURE__ */ jsx(View, { style: [styles20.reactionsRow, { alignSelf: isSelf ? "flex-end" : "flex-start" }], children: /* @__PURE__ */ jsx(
|
|
4486
|
+
ReactionStrip,
|
|
4487
|
+
{
|
|
4488
|
+
messageId: msg.id,
|
|
4489
|
+
conversationId: msg.conversation_id,
|
|
4490
|
+
meId,
|
|
4491
|
+
...msg.reactions ? { initialReactions: msg.reactions } : {}
|
|
4492
|
+
}
|
|
4493
|
+
) }) : null
|
|
4494
|
+
)
|
|
4495
|
+
] }),
|
|
4496
|
+
renderSlot(
|
|
4497
|
+
slots?.actions,
|
|
4498
|
+
slotContext,
|
|
4499
|
+
actions && actionsOpen ? /* @__PURE__ */ jsx(
|
|
4500
|
+
MessageActions,
|
|
3789
4501
|
{
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
...
|
|
4502
|
+
visible: actionsOpen,
|
|
4503
|
+
onClose: () => setActionsOpen(false),
|
|
4504
|
+
isSelf,
|
|
4505
|
+
...reactions ? {
|
|
4506
|
+
// Inline quick-react row at the top of the sheet —
|
|
4507
|
+
// one tap = react + close, no second modal needed.
|
|
4508
|
+
onPickReaction: (emoji) => {
|
|
4509
|
+
void reactionsApi.addReaction(emoji);
|
|
4510
|
+
}
|
|
4511
|
+
} : {},
|
|
4512
|
+
...msg.body && !msg.deleted_at ? {
|
|
4513
|
+
onCopy: () => {
|
|
4514
|
+
setActionsOpen(false);
|
|
4515
|
+
void Clipboard.setStringAsync(msg.body ?? "");
|
|
4516
|
+
}
|
|
4517
|
+
} : {},
|
|
4518
|
+
...onStartEdit ? {
|
|
4519
|
+
onEdit: () => {
|
|
4520
|
+
setActionsOpen(false);
|
|
4521
|
+
onStartEdit();
|
|
4522
|
+
}
|
|
4523
|
+
} : {},
|
|
4524
|
+
...onDelete ? {
|
|
4525
|
+
onDelete: () => {
|
|
4526
|
+
setActionsOpen(false);
|
|
4527
|
+
onDelete();
|
|
4528
|
+
}
|
|
4529
|
+
} : {},
|
|
4530
|
+
...onOpenThread ? {
|
|
4531
|
+
onReplyInThread: () => {
|
|
4532
|
+
setActionsOpen(false);
|
|
4533
|
+
onOpenThread();
|
|
4534
|
+
}
|
|
4535
|
+
} : {},
|
|
4536
|
+
...quotations && onQuote ? {
|
|
4537
|
+
onQuote: () => {
|
|
4538
|
+
setActionsOpen(false);
|
|
4539
|
+
onQuote();
|
|
4540
|
+
}
|
|
4541
|
+
} : {}
|
|
3794
4542
|
}
|
|
3795
|
-
)
|
|
3796
|
-
|
|
3797
|
-
actions && actionsOpen ? /* @__PURE__ */ jsx(
|
|
3798
|
-
MessageActions,
|
|
3799
|
-
{
|
|
3800
|
-
visible: actionsOpen,
|
|
3801
|
-
onClose: () => setActionsOpen(false),
|
|
3802
|
-
isSelf,
|
|
3803
|
-
...reactions ? {
|
|
3804
|
-
// Inline quick-react row at the top of the sheet —
|
|
3805
|
-
// one tap = react + close, no second modal needed.
|
|
3806
|
-
onPickReaction: (emoji) => {
|
|
3807
|
-
void reactionsApi.addReaction(emoji);
|
|
3808
|
-
}
|
|
3809
|
-
} : {},
|
|
3810
|
-
...msg.body && !msg.deleted_at ? {
|
|
3811
|
-
onCopy: () => {
|
|
3812
|
-
setActionsOpen(false);
|
|
3813
|
-
void Clipboard.setStringAsync(msg.body ?? "");
|
|
3814
|
-
}
|
|
3815
|
-
} : {},
|
|
3816
|
-
...onStartEdit ? {
|
|
3817
|
-
onEdit: () => {
|
|
3818
|
-
setActionsOpen(false);
|
|
3819
|
-
onStartEdit();
|
|
3820
|
-
}
|
|
3821
|
-
} : {},
|
|
3822
|
-
...onDelete ? {
|
|
3823
|
-
onDelete: () => {
|
|
3824
|
-
setActionsOpen(false);
|
|
3825
|
-
onDelete();
|
|
3826
|
-
}
|
|
3827
|
-
} : {},
|
|
3828
|
-
...onOpenThread ? {
|
|
3829
|
-
onReplyInThread: () => {
|
|
3830
|
-
setActionsOpen(false);
|
|
3831
|
-
onOpenThread();
|
|
3832
|
-
}
|
|
3833
|
-
} : {},
|
|
3834
|
-
...quotations && onQuote ? {
|
|
3835
|
-
onQuote: () => {
|
|
3836
|
-
setActionsOpen(false);
|
|
3837
|
-
onQuote();
|
|
3838
|
-
}
|
|
3839
|
-
} : {}
|
|
3840
|
-
}
|
|
3841
|
-
) : null
|
|
4543
|
+
) : null
|
|
4544
|
+
)
|
|
3842
4545
|
]
|
|
3843
4546
|
}
|
|
3844
4547
|
);
|
|
3845
4548
|
}
|
|
3846
|
-
var
|
|
4549
|
+
var styles20 = StyleSheet.create({
|
|
3847
4550
|
row: {
|
|
3848
4551
|
flexDirection: "row",
|
|
3849
4552
|
alignItems: "flex-end",
|
|
@@ -3857,6 +4560,9 @@ var styles19 = StyleSheet.create({
|
|
|
3857
4560
|
paddingHorizontal: 10,
|
|
3858
4561
|
maxWidth: "95%"
|
|
3859
4562
|
},
|
|
4563
|
+
rowDense: {
|
|
4564
|
+
marginVertical: 0
|
|
4565
|
+
},
|
|
3860
4566
|
rowEditing: {
|
|
3861
4567
|
// Above ConversationView's editBackdrop (zIndex 5). Elevation
|
|
3862
4568
|
// does the equivalent stacking on Android.
|
|
@@ -3909,7 +4615,9 @@ function ThreadView({
|
|
|
3909
4615
|
conversationId,
|
|
3910
4616
|
rootMessage,
|
|
3911
4617
|
labelFor,
|
|
3912
|
-
avatarFor
|
|
4618
|
+
avatarFor,
|
|
4619
|
+
layout,
|
|
4620
|
+
timeFormat
|
|
3913
4621
|
}) {
|
|
3914
4622
|
return /* @__PURE__ */ jsx(
|
|
3915
4623
|
Modal,
|
|
@@ -3926,7 +4634,9 @@ function ThreadView({
|
|
|
3926
4634
|
conversationId,
|
|
3927
4635
|
rootMessage,
|
|
3928
4636
|
...labelFor ? { labelFor } : {},
|
|
3929
|
-
...avatarFor ? { avatarFor } : {}
|
|
4637
|
+
...avatarFor ? { avatarFor } : {},
|
|
4638
|
+
...layout ? { layout } : {},
|
|
4639
|
+
...timeFormat ? { timeFormat } : {}
|
|
3930
4640
|
}
|
|
3931
4641
|
) })
|
|
3932
4642
|
}
|
|
@@ -3937,9 +4647,11 @@ function ThreadSheet({
|
|
|
3937
4647
|
conversationId,
|
|
3938
4648
|
rootMessage,
|
|
3939
4649
|
labelFor,
|
|
3940
|
-
avatarFor
|
|
4650
|
+
avatarFor,
|
|
4651
|
+
layout,
|
|
4652
|
+
timeFormat
|
|
3941
4653
|
}) {
|
|
3942
|
-
const theme =
|
|
4654
|
+
const theme = useTheme();
|
|
3943
4655
|
const { me } = useMe();
|
|
3944
4656
|
const meId = me?.id ?? null;
|
|
3945
4657
|
const {
|
|
@@ -3982,11 +4694,13 @@ function ThreadSheet({
|
|
|
3982
4694
|
void deleteReply(msg.id);
|
|
3983
4695
|
},
|
|
3984
4696
|
...labelFor ? { labelFor } : {},
|
|
3985
|
-
...avatarFor ? { avatarFor } : {}
|
|
4697
|
+
...avatarFor ? { avatarFor } : {},
|
|
4698
|
+
...layout ? { layout } : {},
|
|
4699
|
+
...timeFormat ? { timeFormat } : {}
|
|
3986
4700
|
}
|
|
3987
4701
|
);
|
|
3988
4702
|
},
|
|
3989
|
-
[meId, editingId, deleteReply, labelFor, avatarFor]
|
|
4703
|
+
[meId, editingId, deleteReply, labelFor, avatarFor, layout, timeFormat]
|
|
3990
4704
|
);
|
|
3991
4705
|
const editingMessage = useMemo(
|
|
3992
4706
|
() => editingId ? replies.find((m) => m.id === editingId) ?? null : null,
|
|
@@ -4004,26 +4718,28 @@ function ThreadSheet({
|
|
|
4004
4718
|
threads: false,
|
|
4005
4719
|
quotations: false,
|
|
4006
4720
|
...labelFor ? { labelFor } : {},
|
|
4007
|
-
...avatarFor ? { avatarFor } : {}
|
|
4721
|
+
...avatarFor ? { avatarFor } : {},
|
|
4722
|
+
...layout ? { layout } : {},
|
|
4723
|
+
...timeFormat ? { timeFormat } : {}
|
|
4008
4724
|
}
|
|
4009
4725
|
),
|
|
4010
|
-
[rootMessage, meId, labelFor, avatarFor]
|
|
4726
|
+
[rootMessage, meId, labelFor, avatarFor, layout, timeFormat]
|
|
4011
4727
|
);
|
|
4012
4728
|
return /* @__PURE__ */ jsxs(
|
|
4013
4729
|
View,
|
|
4014
4730
|
{
|
|
4015
|
-
style:
|
|
4731
|
+
style: styles21.modalRoot,
|
|
4016
4732
|
onLayout: (e) => setRootHeight(Math.round(e.nativeEvent.layout.height)),
|
|
4017
4733
|
children: [
|
|
4018
|
-
/* @__PURE__ */ jsx(Pressable, { style:
|
|
4734
|
+
/* @__PURE__ */ jsx(Pressable, { style: styles21.backdrop, onPress: onClose, accessibilityLabel: "Close thread" }),
|
|
4019
4735
|
/* @__PURE__ */ jsxs(
|
|
4020
4736
|
Animated.View,
|
|
4021
4737
|
{
|
|
4022
4738
|
style: [
|
|
4023
|
-
|
|
4739
|
+
styles21.sheet,
|
|
4024
4740
|
{
|
|
4025
4741
|
height: sheetHeight,
|
|
4026
|
-
backgroundColor: theme.colors.
|
|
4742
|
+
backgroundColor: theme.colors.background,
|
|
4027
4743
|
borderTopLeftRadius: theme.radii.xl,
|
|
4028
4744
|
borderTopRightRadius: theme.radii.xl,
|
|
4029
4745
|
paddingLeft: insets.left,
|
|
@@ -4034,25 +4750,22 @@ function ThreadSheet({
|
|
|
4034
4750
|
],
|
|
4035
4751
|
children: [
|
|
4036
4752
|
/* @__PURE__ */ jsxs(View, { ...panHandlers, children: [
|
|
4037
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
4038
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
4753
|
+
/* @__PURE__ */ jsx(View, { style: styles21.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles21.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
|
|
4754
|
+
/* @__PURE__ */ jsxs(View, { style: [styles21.header, { borderBottomColor: theme.colors.border }], children: [
|
|
4039
4755
|
/* @__PURE__ */ jsx(
|
|
4040
4756
|
Pressable,
|
|
4041
4757
|
{
|
|
4042
4758
|
onPress: onClose,
|
|
4043
4759
|
hitSlop: 16,
|
|
4044
|
-
style: [
|
|
4760
|
+
style: [styles21.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
|
|
4045
4761
|
accessibilityLabel: "Close thread",
|
|
4046
|
-
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.
|
|
4762
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
|
|
4047
4763
|
}
|
|
4048
4764
|
),
|
|
4049
4765
|
/* @__PURE__ */ jsx(
|
|
4050
4766
|
Text,
|
|
4051
4767
|
{
|
|
4052
|
-
style: [
|
|
4053
|
-
styles20.title,
|
|
4054
|
-
{ color: theme.colors.ink, fontFamily: theme.type.fontDisplay }
|
|
4055
|
-
],
|
|
4768
|
+
style: [styles21.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
|
|
4056
4769
|
children: "Thread"
|
|
4057
4770
|
}
|
|
4058
4771
|
)
|
|
@@ -4061,12 +4774,12 @@ function ThreadSheet({
|
|
|
4061
4774
|
/* @__PURE__ */ jsxs(
|
|
4062
4775
|
KeyboardAvoidingView,
|
|
4063
4776
|
{
|
|
4064
|
-
style:
|
|
4777
|
+
style: styles21.kavBody,
|
|
4065
4778
|
behavior: "padding",
|
|
4066
4779
|
keyboardVerticalOffset: gutter,
|
|
4067
4780
|
children: [
|
|
4068
|
-
/* @__PURE__ */ jsx(View, { style: [
|
|
4069
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
4781
|
+
/* @__PURE__ */ jsx(View, { style: [styles21.rootPreview, { backgroundColor: theme.colors.surfaceAlt }], children: rootRow }),
|
|
4782
|
+
/* @__PURE__ */ jsx(View, { style: styles21.listWrap, children: /* @__PURE__ */ jsx(
|
|
4070
4783
|
MessageList,
|
|
4071
4784
|
{
|
|
4072
4785
|
messages: replies,
|
|
@@ -4104,7 +4817,7 @@ function ThreadSheet({
|
|
|
4104
4817
|
}
|
|
4105
4818
|
);
|
|
4106
4819
|
}
|
|
4107
|
-
var
|
|
4820
|
+
var styles21 = StyleSheet.create({
|
|
4108
4821
|
modalRoot: {
|
|
4109
4822
|
flex: 1,
|
|
4110
4823
|
justifyContent: "flex-end"
|
|
@@ -4159,9 +4872,9 @@ var styles20 = StyleSheet.create({
|
|
|
4159
4872
|
}
|
|
4160
4873
|
});
|
|
4161
4874
|
function UserName({ externalId, fallback, labelFor }) {
|
|
4162
|
-
const theme =
|
|
4875
|
+
const theme = useTheme();
|
|
4163
4876
|
const name = useDisplayName(externalId, labelFor) ?? fallback ?? externalId ?? "";
|
|
4164
|
-
return /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.
|
|
4877
|
+
return /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.text, fontFamily: theme.fonts.body }, children: name });
|
|
4165
4878
|
}
|
|
4166
4879
|
function useDisplayName(externalId, labelFor) {
|
|
4167
4880
|
const resolved = useUser(externalId ?? null);
|
|
@@ -4176,13 +4889,13 @@ function TypingIndicator({ typing, labelFor }) {
|
|
|
4176
4889
|
const ids = Array.from(typing);
|
|
4177
4890
|
const isTyping = ids.length > 0;
|
|
4178
4891
|
if (!isTyping) return /* @__PURE__ */ jsx(View, { style: { height: 0 } });
|
|
4179
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
4892
|
+
return /* @__PURE__ */ jsxs(View, { style: styles22.row, children: [
|
|
4180
4893
|
/* @__PURE__ */ jsx(TypingDots, {}),
|
|
4181
4894
|
/* @__PURE__ */ jsx(TypingLabel, { ids, ...labelFor ? { labelFor } : {} })
|
|
4182
4895
|
] });
|
|
4183
4896
|
}
|
|
4184
4897
|
function TypingDots() {
|
|
4185
|
-
const theme =
|
|
4898
|
+
const theme = useTheme();
|
|
4186
4899
|
const a = useRef(new Animated.Value(0)).current;
|
|
4187
4900
|
const b = useRef(new Animated.Value(0)).current;
|
|
4188
4901
|
const c = useRef(new Animated.Value(0)).current;
|
|
@@ -4212,7 +4925,7 @@ function TypingDots() {
|
|
|
4212
4925
|
width: 6,
|
|
4213
4926
|
height: 6,
|
|
4214
4927
|
borderRadius: 3,
|
|
4215
|
-
backgroundColor: theme.colors.
|
|
4928
|
+
backgroundColor: theme.colors.textSubtle,
|
|
4216
4929
|
marginHorizontal: 2,
|
|
4217
4930
|
transform: [
|
|
4218
4931
|
{
|
|
@@ -4221,7 +4934,7 @@ function TypingDots() {
|
|
|
4221
4934
|
],
|
|
4222
4935
|
opacity: val.interpolate({ inputRange: [0, 1], outputRange: [0.5, 1] })
|
|
4223
4936
|
});
|
|
4224
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
4937
|
+
return /* @__PURE__ */ jsxs(View, { style: styles22.dotsWrap, children: [
|
|
4225
4938
|
/* @__PURE__ */ jsx(Animated.View, { style: dot(a) }),
|
|
4226
4939
|
/* @__PURE__ */ jsx(Animated.View, { style: dot(b) }),
|
|
4227
4940
|
/* @__PURE__ */ jsx(Animated.View, { style: dot(c) })
|
|
@@ -4231,15 +4944,15 @@ function TypingLabel({
|
|
|
4231
4944
|
ids,
|
|
4232
4945
|
labelFor
|
|
4233
4946
|
}) {
|
|
4234
|
-
const theme =
|
|
4947
|
+
const theme = useTheme();
|
|
4235
4948
|
const id1 = ids[0] ?? null;
|
|
4236
4949
|
const id2 = ids[1] ?? null;
|
|
4237
4950
|
const name1 = useDisplayName(id1, labelFor);
|
|
4238
4951
|
const name2 = useDisplayName(id2, labelFor);
|
|
4239
4952
|
const text = ids.length === 1 ? `${name1} is typing` : ids.length === 2 ? `${name1} and ${name2} are typing` : `${ids.length} people are typing`;
|
|
4240
|
-
return /* @__PURE__ */ jsx(Text, { style: [
|
|
4953
|
+
return /* @__PURE__ */ jsx(Text, { style: [styles22.label, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }], children: text });
|
|
4241
4954
|
}
|
|
4242
|
-
var
|
|
4955
|
+
var styles22 = StyleSheet.create({
|
|
4243
4956
|
row: {
|
|
4244
4957
|
flexDirection: "row",
|
|
4245
4958
|
alignItems: "center",
|
|
@@ -4256,7 +4969,7 @@ var styles21 = StyleSheet.create({
|
|
|
4256
4969
|
fontSize: 12
|
|
4257
4970
|
}
|
|
4258
4971
|
});
|
|
4259
|
-
var
|
|
4972
|
+
var GROUP_WINDOW_MINUTES = 5;
|
|
4260
4973
|
function ConversationView({
|
|
4261
4974
|
conversationId,
|
|
4262
4975
|
emptyState,
|
|
@@ -4279,12 +4992,28 @@ function ConversationView({
|
|
|
4279
4992
|
avatars = "auto",
|
|
4280
4993
|
onMarkedRead,
|
|
4281
4994
|
onSent,
|
|
4995
|
+
focusMessageId = null,
|
|
4996
|
+
onFocusMessageNotFound,
|
|
4997
|
+
onSenderPress,
|
|
4998
|
+
onAvatarPress,
|
|
4999
|
+
composer = true,
|
|
5000
|
+
readOnly = false,
|
|
4282
5001
|
keyboardOffset = 0,
|
|
4283
5002
|
onCallBack,
|
|
4284
5003
|
onJoinCall,
|
|
4285
|
-
currentCallId = null
|
|
5004
|
+
currentCallId = null,
|
|
5005
|
+
layout = "bubbles",
|
|
5006
|
+
density = "comfortable",
|
|
5007
|
+
showAvatars: showAvatarsProp,
|
|
5008
|
+
timeFormat,
|
|
5009
|
+
groupWindowMinutes = GROUP_WINDOW_MINUTES,
|
|
5010
|
+
daySeparators = true,
|
|
5011
|
+
slots
|
|
4286
5012
|
}) {
|
|
4287
|
-
const theme =
|
|
5013
|
+
const theme = useTheme();
|
|
5014
|
+
const showComposer = composer && !readOnly;
|
|
5015
|
+
const canQuote = quotations && showComposer;
|
|
5016
|
+
const canAttach = attachments && showComposer;
|
|
4288
5017
|
const { me } = useMe();
|
|
4289
5018
|
const meId = me?.id ?? null;
|
|
4290
5019
|
const receiptsVisible = receiptsOf(me).visible;
|
|
@@ -4294,6 +5023,7 @@ function ConversationView({
|
|
|
4294
5023
|
loading,
|
|
4295
5024
|
hasMore,
|
|
4296
5025
|
loadMore,
|
|
5026
|
+
loadUntil,
|
|
4297
5027
|
send,
|
|
4298
5028
|
edit,
|
|
4299
5029
|
delete: deleteMsg,
|
|
@@ -4329,7 +5059,16 @@ function ConversationView({
|
|
|
4329
5059
|
const { members } = useMembers(wantsMembers ? conversationId : "");
|
|
4330
5060
|
const isGroupChat = members.length > 2;
|
|
4331
5061
|
const showSenderLabels = senderLabels === "always" || senderLabels === "auto" && isGroupChat;
|
|
4332
|
-
const showAvatars = avatars === "always" || avatars === "auto" && isGroupChat;
|
|
5062
|
+
const showAvatars = showAvatarsProp ?? (layout === "list" ? true : layout === "compact" ? false : avatars === "always" || avatars === "auto" && isGroupChat);
|
|
5063
|
+
const layoutProps = useMemo(
|
|
5064
|
+
() => ({
|
|
5065
|
+
layout,
|
|
5066
|
+
density,
|
|
5067
|
+
...timeFormat ? { timeFormat } : {},
|
|
5068
|
+
...slots ? { slots } : {}
|
|
5069
|
+
}),
|
|
5070
|
+
[layout, density, timeFormat, slots]
|
|
5071
|
+
);
|
|
4333
5072
|
const [replyingTo, setReplyingTo] = useState(null);
|
|
4334
5073
|
const [editingId, setEditingId] = useState(null);
|
|
4335
5074
|
const [threadRoot, setThreadRoot] = useState(null);
|
|
@@ -4343,22 +5082,73 @@ function ConversationView({
|
|
|
4343
5082
|
}, [messages]);
|
|
4344
5083
|
const lastMarkedRef = useRef(null);
|
|
4345
5084
|
useEffect(() => {
|
|
4346
|
-
|
|
4347
|
-
if (
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
onMarkedRead?.(conversationId, latest.id);
|
|
4357
|
-
}, [messages, meId, readReceipts, markReadUpTo, onMarkedRead, conversationId]);
|
|
5085
|
+
const latestId = latestMarkableId(messages);
|
|
5086
|
+
if (!latestId || latestId === lastMarkedRef.current) return;
|
|
5087
|
+
lastMarkedRef.current = latestId;
|
|
5088
|
+
markReadUpTo(latestId).then(
|
|
5089
|
+
() => onMarkedRead?.(conversationId, latestId),
|
|
5090
|
+
() => {
|
|
5091
|
+
if (lastMarkedRef.current === latestId) lastMarkedRef.current = null;
|
|
5092
|
+
}
|
|
5093
|
+
);
|
|
5094
|
+
}, [messages, markReadUpTo, onMarkedRead, conversationId]);
|
|
4358
5095
|
const visibleMessages = useMemo(
|
|
4359
5096
|
() => messages.filter((m) => isMessageVisibleTo(m, meId)),
|
|
4360
5097
|
[messages, meId]
|
|
4361
5098
|
);
|
|
5099
|
+
const [jump, setJump] = useState(null);
|
|
5100
|
+
const [pendingFocusId, setPendingFocusId] = useState(null);
|
|
5101
|
+
const [highlightId, setHighlightId] = useState(null);
|
|
5102
|
+
const [focusMissing, setFocusMissing] = useState(false);
|
|
5103
|
+
const onFocusNotFoundRef = useRef(onFocusMessageNotFound);
|
|
5104
|
+
onFocusNotFoundRef.current = onFocusMessageNotFound;
|
|
5105
|
+
const focusMiss = useCallback((id, report) => {
|
|
5106
|
+
setFocusMissing(true);
|
|
5107
|
+
if (report) onFocusNotFoundRef.current?.(id);
|
|
5108
|
+
}, []);
|
|
5109
|
+
const jumpTo = useCallback(
|
|
5110
|
+
(id, report) => {
|
|
5111
|
+
let current = true;
|
|
5112
|
+
loadUntil(id).then((found) => {
|
|
5113
|
+
if (!current) return;
|
|
5114
|
+
if (found) setPendingFocusId(id);
|
|
5115
|
+
else focusMiss(id, report);
|
|
5116
|
+
}).catch(() => {
|
|
5117
|
+
if (current) focusMiss(id, report);
|
|
5118
|
+
});
|
|
5119
|
+
return () => {
|
|
5120
|
+
current = false;
|
|
5121
|
+
};
|
|
5122
|
+
},
|
|
5123
|
+
[loadUntil, focusMiss]
|
|
5124
|
+
);
|
|
5125
|
+
useEffect(() => {
|
|
5126
|
+
setPendingFocusId(null);
|
|
5127
|
+
setFocusMissing(false);
|
|
5128
|
+
if (!focusMessageId || loading) return;
|
|
5129
|
+
return jumpTo(focusMessageId, true);
|
|
5130
|
+
}, [focusMessageId, conversationId, loading, jumpTo]);
|
|
5131
|
+
useEffect(() => {
|
|
5132
|
+
if (!pendingFocusId) return;
|
|
5133
|
+
setPendingFocusId(null);
|
|
5134
|
+
if (!visibleMessages.some((m) => m.id === pendingFocusId)) {
|
|
5135
|
+
focusMiss(pendingFocusId, true);
|
|
5136
|
+
return;
|
|
5137
|
+
}
|
|
5138
|
+
setJump((prev) => ({ id: pendingFocusId, request: (prev?.request ?? 0) + 1 }));
|
|
5139
|
+
setHighlightId(pendingFocusId);
|
|
5140
|
+
}, [pendingFocusId, visibleMessages, focusMiss]);
|
|
5141
|
+
useEffect(() => {
|
|
5142
|
+
if (!highlightId) return;
|
|
5143
|
+
const t = setTimeout(() => setHighlightId(null), 1600);
|
|
5144
|
+
return () => clearTimeout(t);
|
|
5145
|
+
}, [highlightId]);
|
|
5146
|
+
useEffect(() => {
|
|
5147
|
+
if (!focusMissing) return;
|
|
5148
|
+
const t = setTimeout(() => setFocusMissing(false), 4e3);
|
|
5149
|
+
return () => clearTimeout(t);
|
|
5150
|
+
}, [focusMissing]);
|
|
5151
|
+
const onQuotedClick = useCallback((id) => void jumpTo(id, false), [jumpTo]);
|
|
4362
5152
|
const groupPositionById = useMemo(() => {
|
|
4363
5153
|
const map = /* @__PURE__ */ new Map();
|
|
4364
5154
|
for (let i = 0; i < visibleMessages.length; i++) {
|
|
@@ -4366,16 +5156,12 @@ function ConversationView({
|
|
|
4366
5156
|
if (!msg) continue;
|
|
4367
5157
|
const prev = i > 0 ? visibleMessages[i - 1] ?? null : null;
|
|
4368
5158
|
const next = i < visibleMessages.length - 1 ? visibleMessages[i + 1] ?? null : null;
|
|
4369
|
-
map.set(msg.id, computeGroupPosition(msg, prev, next,
|
|
5159
|
+
map.set(msg.id, computeGroupPosition(msg, prev, next, groupWindowMinutes * 60 * 1e3));
|
|
4370
5160
|
}
|
|
4371
5161
|
return map;
|
|
4372
|
-
}, [visibleMessages]);
|
|
4373
|
-
const
|
|
4374
|
-
(msg) => {
|
|
4375
|
-
if (renderMessage) {
|
|
4376
|
-
const custom = renderMessage(msg, meId);
|
|
4377
|
-
if (custom !== null && custom !== void 0) return custom;
|
|
4378
|
-
}
|
|
5162
|
+
}, [visibleMessages, groupWindowMinutes]);
|
|
5163
|
+
const defaultRow = useCallback(
|
|
5164
|
+
(msg, groupPosition) => {
|
|
4379
5165
|
const readState = showReadState && meId !== null && msg.sender_id === meId ? readStateForMessage(msg, members, meId, sequenceByMessageId) : void 0;
|
|
4380
5166
|
const isSelf = meId !== null && msg.sender_id === meId;
|
|
4381
5167
|
const canEdit = canEditOwnMessage({
|
|
@@ -4385,8 +5171,7 @@ function ConversationView({
|
|
|
4385
5171
|
readState,
|
|
4386
5172
|
insertedAt: msg.inserted_at
|
|
4387
5173
|
});
|
|
4388
|
-
const
|
|
4389
|
-
return /* @__PURE__ */ jsx(
|
|
5174
|
+
const row = /* @__PURE__ */ jsx(
|
|
4390
5175
|
MessageRow,
|
|
4391
5176
|
{
|
|
4392
5177
|
msg,
|
|
@@ -4395,29 +5180,40 @@ function ConversationView({
|
|
|
4395
5180
|
attachments,
|
|
4396
5181
|
actions,
|
|
4397
5182
|
threads,
|
|
4398
|
-
quotations,
|
|
5183
|
+
quotations: canQuote,
|
|
4399
5184
|
...readState ? { readState } : {},
|
|
4400
5185
|
isEditing: editingId === msg.id,
|
|
4401
5186
|
...canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {},
|
|
4402
5187
|
onDelete: () => deleteMsg(msg.id),
|
|
4403
5188
|
...threads ? { onOpenThread: () => setThreadRoot(msg) } : {},
|
|
4404
|
-
...
|
|
5189
|
+
...canQuote ? { onQuote: () => setReplyingTo(msg) } : {},
|
|
5190
|
+
onQuotedClick,
|
|
4405
5191
|
...labelFor ? { labelFor } : {},
|
|
4406
5192
|
...avatarFor ? { avatarFor } : {},
|
|
5193
|
+
...onSenderPress ? { onSenderPress } : {},
|
|
5194
|
+
...onAvatarPress ? { onAvatarPress } : {},
|
|
4407
5195
|
showSenderName: showSenderLabels,
|
|
4408
5196
|
showAvatar: showAvatars,
|
|
4409
5197
|
maxBodyLength,
|
|
4410
5198
|
groupPosition,
|
|
4411
5199
|
markdown,
|
|
4412
|
-
...onCallBack ? { onCallBack } : {}
|
|
5200
|
+
...onCallBack ? { onCallBack } : {},
|
|
5201
|
+
...layoutProps,
|
|
5202
|
+
mentionsMe: mentionsViewer(msg, meId)
|
|
4413
5203
|
}
|
|
4414
5204
|
);
|
|
5205
|
+
if (msg.id !== highlightId) return row;
|
|
5206
|
+
return /* @__PURE__ */ jsx(View, { style: { backgroundColor: theme.colors.accentSoft }, children: row });
|
|
4415
5207
|
},
|
|
4416
5208
|
[
|
|
4417
5209
|
onCallBack,
|
|
4418
|
-
|
|
5210
|
+
onQuotedClick,
|
|
5211
|
+
onSenderPress,
|
|
5212
|
+
onAvatarPress,
|
|
5213
|
+
highlightId,
|
|
5214
|
+
theme.colors.accentSoft,
|
|
5215
|
+
canQuote,
|
|
4419
5216
|
meId,
|
|
4420
|
-
readReceipts,
|
|
4421
5217
|
showReadState,
|
|
4422
5218
|
receiptsVisible,
|
|
4423
5219
|
members,
|
|
@@ -4425,7 +5221,6 @@ function ConversationView({
|
|
|
4425
5221
|
attachments,
|
|
4426
5222
|
actions,
|
|
4427
5223
|
threads,
|
|
4428
|
-
quotations,
|
|
4429
5224
|
editingId,
|
|
4430
5225
|
deleteMsg,
|
|
4431
5226
|
labelFor,
|
|
@@ -4434,10 +5229,26 @@ function ConversationView({
|
|
|
4434
5229
|
showAvatars,
|
|
4435
5230
|
maxBodyLength,
|
|
4436
5231
|
sequenceByMessageId,
|
|
4437
|
-
|
|
4438
|
-
|
|
5232
|
+
markdown,
|
|
5233
|
+
layoutProps
|
|
4439
5234
|
]
|
|
4440
5235
|
);
|
|
5236
|
+
const renderItem = useCallback(
|
|
5237
|
+
(msg) => {
|
|
5238
|
+
const groupPosition = groupPositionById.get(msg.id) ?? "standalone";
|
|
5239
|
+
if (renderMessage) {
|
|
5240
|
+
const custom = renderMessage(msg, meId, {
|
|
5241
|
+
layout,
|
|
5242
|
+
groupPosition,
|
|
5243
|
+
isRunStart: layout === "compact" || groupPosition === "first" || groupPosition === "standalone",
|
|
5244
|
+
renderDefault: () => defaultRow(msg, groupPosition)
|
|
5245
|
+
});
|
|
5246
|
+
if (custom !== null && custom !== void 0) return custom;
|
|
5247
|
+
}
|
|
5248
|
+
return defaultRow(msg, groupPosition);
|
|
5249
|
+
},
|
|
5250
|
+
[renderMessage, meId, layout, groupPositionById, defaultRow]
|
|
5251
|
+
);
|
|
4441
5252
|
const editingMessage = useMemo(
|
|
4442
5253
|
() => editingId ? messages.find((m) => m.id === editingId) ?? null : null,
|
|
4443
5254
|
[editingId, messages]
|
|
@@ -4446,19 +5257,19 @@ function ConversationView({
|
|
|
4446
5257
|
const out = [];
|
|
4447
5258
|
let prev = null;
|
|
4448
5259
|
for (const msg of visibleMessages) {
|
|
4449
|
-
if (prev === null || !sameDay(msg.inserted_at, prev.inserted_at)) {
|
|
5260
|
+
if (daySeparators && (prev === null || !sameDay(msg.inserted_at, prev.inserted_at))) {
|
|
4450
5261
|
const label = formatDayLabel(msg.inserted_at);
|
|
4451
5262
|
out.push({
|
|
4452
5263
|
kind: "separator",
|
|
4453
5264
|
id: `sep-${msg.id}`,
|
|
4454
|
-
node: /* @__PURE__ */ jsx(DaySeparator, { label })
|
|
5265
|
+
node: /* @__PURE__ */ jsx(DaySeparator, { label, variant: layout === "bubbles" ? "pill" : "rule" })
|
|
4455
5266
|
});
|
|
4456
5267
|
}
|
|
4457
5268
|
out.push({ kind: "msg", msg });
|
|
4458
5269
|
prev = msg;
|
|
4459
5270
|
}
|
|
4460
5271
|
return out;
|
|
4461
|
-
}, [visibleMessages]);
|
|
5272
|
+
}, [visibleMessages, daySeparators, layout]);
|
|
4462
5273
|
const composerProps = useMemo(
|
|
4463
5274
|
() => ({
|
|
4464
5275
|
onSend: async (body, opts) => {
|
|
@@ -4508,11 +5319,22 @@ function ConversationView({
|
|
|
4508
5319
|
return /* @__PURE__ */ jsx(UploadProvider, { children: /* @__PURE__ */ jsxs(
|
|
4509
5320
|
KeyboardAvoidingView,
|
|
4510
5321
|
{
|
|
4511
|
-
style: [
|
|
5322
|
+
style: [styles23.root, { backgroundColor: theme.colors.background }],
|
|
4512
5323
|
behavior: Platform.OS === "ios" ? "padding" : "height",
|
|
4513
5324
|
keyboardVerticalOffset: keyboardOffset,
|
|
4514
5325
|
children: [
|
|
4515
5326
|
headerNode,
|
|
5327
|
+
focusMissing ? /* @__PURE__ */ jsx(
|
|
5328
|
+
Text,
|
|
5329
|
+
{
|
|
5330
|
+
style: [
|
|
5331
|
+
styles23.notice,
|
|
5332
|
+
{ color: theme.colors.textMuted, backgroundColor: theme.colors.surfaceAlt }
|
|
5333
|
+
],
|
|
5334
|
+
accessibilityRole: "alert",
|
|
5335
|
+
children: "That message isn't available."
|
|
5336
|
+
}
|
|
5337
|
+
) : null,
|
|
4516
5338
|
onJoinCall ? /* @__PURE__ */ jsx(
|
|
4517
5339
|
JoinBanner,
|
|
4518
5340
|
{
|
|
@@ -4522,7 +5344,7 @@ function ConversationView({
|
|
|
4522
5344
|
onJoin: onJoinCall
|
|
4523
5345
|
}
|
|
4524
5346
|
) : null,
|
|
4525
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
5347
|
+
/* @__PURE__ */ jsxs(View, { style: styles23.listWrap, children: [
|
|
4526
5348
|
/* @__PURE__ */ jsx(
|
|
4527
5349
|
MessageList,
|
|
4528
5350
|
{
|
|
@@ -4533,12 +5355,14 @@ function ConversationView({
|
|
|
4533
5355
|
hasMore,
|
|
4534
5356
|
onLoadMore: loadMore,
|
|
4535
5357
|
renderItem,
|
|
5358
|
+
scrollToMessageId: jump?.id ?? null,
|
|
5359
|
+
scrollRequest: jump?.request ?? 0,
|
|
4536
5360
|
ListHeader: /* @__PURE__ */ jsxs(View, { children: [
|
|
4537
5361
|
visibleStreams.map(
|
|
4538
5362
|
(stream) => stream.status === "failed" ? /* @__PURE__ */ jsx(
|
|
4539
5363
|
Text,
|
|
4540
5364
|
{
|
|
4541
|
-
style: [
|
|
5365
|
+
style: [styles23.streamFailed, { color: theme.colors.textSubtle }],
|
|
4542
5366
|
accessibilityRole: "alert",
|
|
4543
5367
|
children: stream.error ? `The agent couldn't reply: ${stream.error}` : "The agent couldn't reply."
|
|
4544
5368
|
},
|
|
@@ -4557,7 +5381,8 @@ function ConversationView({
|
|
|
4557
5381
|
...avatarFor ? { avatarFor } : {},
|
|
4558
5382
|
showSenderName: showSenderLabels,
|
|
4559
5383
|
showAvatar: showAvatars,
|
|
4560
|
-
markdown
|
|
5384
|
+
markdown,
|
|
5385
|
+
...layoutProps
|
|
4561
5386
|
},
|
|
4562
5387
|
stream.id
|
|
4563
5388
|
)
|
|
@@ -4570,14 +5395,14 @@ function ConversationView({
|
|
|
4570
5395
|
editingId ? /* @__PURE__ */ jsx(
|
|
4571
5396
|
Pressable,
|
|
4572
5397
|
{
|
|
4573
|
-
style:
|
|
5398
|
+
style: [styles23.editBackdrop, { backgroundColor: theme.colors.overlay }],
|
|
4574
5399
|
onPress: () => setEditingId(null),
|
|
4575
5400
|
accessibilityLabel: "Cancel editing"
|
|
4576
5401
|
}
|
|
4577
5402
|
) : null
|
|
4578
5403
|
] }),
|
|
4579
|
-
mentions ? /* @__PURE__ */ jsx(MentionInput, { conversationId, ...composerProps }) : /* @__PURE__ */ jsx(MessageComposer, { ...composerProps }),
|
|
4580
|
-
|
|
5404
|
+
!showComposer ? null : mentions ? /* @__PURE__ */ jsx(MentionInput, { conversationId, ...composerProps }) : /* @__PURE__ */ jsx(MessageComposer, { ...composerProps }),
|
|
5405
|
+
canAttach ? /* @__PURE__ */ jsx(AttachmentPicker, { visible: pickerOpen, onClose: () => setPickerOpen(false) }) : null,
|
|
4581
5406
|
threads && threadRoot ? /* @__PURE__ */ jsx(
|
|
4582
5407
|
ThreadView,
|
|
4583
5408
|
{
|
|
@@ -4585,7 +5410,9 @@ function ConversationView({
|
|
|
4585
5410
|
onClose: () => setThreadRoot(null),
|
|
4586
5411
|
conversationId,
|
|
4587
5412
|
rootMessage: threadRoot,
|
|
4588
|
-
...labelFor ? { labelFor } : {}
|
|
5413
|
+
...labelFor ? { labelFor } : {},
|
|
5414
|
+
layout,
|
|
5415
|
+
...timeFormat ? { timeFormat } : {}
|
|
4589
5416
|
}
|
|
4590
5417
|
) : null
|
|
4591
5418
|
]
|
|
@@ -4616,10 +5443,16 @@ function readStateForMessage(msg, members, meId, sequenceByMessageId) {
|
|
|
4616
5443
|
});
|
|
4617
5444
|
return anyRead ? "read" : "sent";
|
|
4618
5445
|
}
|
|
4619
|
-
var
|
|
5446
|
+
var styles23 = StyleSheet.create({
|
|
4620
5447
|
root: {
|
|
4621
5448
|
flex: 1
|
|
4622
5449
|
},
|
|
5450
|
+
notice: {
|
|
5451
|
+
fontSize: 12,
|
|
5452
|
+
fontWeight: "600",
|
|
5453
|
+
paddingHorizontal: 16,
|
|
5454
|
+
paddingVertical: 8
|
|
5455
|
+
},
|
|
4623
5456
|
streamFailed: {
|
|
4624
5457
|
fontSize: 12,
|
|
4625
5458
|
marginHorizontal: 16,
|
|
@@ -4630,7 +5463,6 @@ var styles22 = StyleSheet.create({
|
|
|
4630
5463
|
},
|
|
4631
5464
|
editBackdrop: {
|
|
4632
5465
|
...StyleSheet.absoluteFillObject,
|
|
4633
|
-
backgroundColor: "rgba(0,0,0,0.45)",
|
|
4634
5466
|
// Sit above message rows by default but below any row that
|
|
4635
5467
|
// explicitly elevates itself (MessageRow bumps zIndex/elevation
|
|
4636
5468
|
// when isEditing is true).
|
|
@@ -4669,7 +5501,7 @@ function UserPickerSheet({
|
|
|
4669
5501
|
title,
|
|
4670
5502
|
searchable
|
|
4671
5503
|
}) {
|
|
4672
|
-
const theme =
|
|
5504
|
+
const theme = useTheme();
|
|
4673
5505
|
const [query, setQuery] = useState("");
|
|
4674
5506
|
const [selectedIds, setSelectedIds] = useState([]);
|
|
4675
5507
|
const [groupName, setGroupName] = useState("");
|
|
@@ -4732,17 +5564,17 @@ function UserPickerSheet({
|
|
|
4732
5564
|
children: /* @__PURE__ */ jsxs(
|
|
4733
5565
|
View,
|
|
4734
5566
|
{
|
|
4735
|
-
style:
|
|
5567
|
+
style: styles24.modalRoot,
|
|
4736
5568
|
onLayout: (e) => setRootHeight(Math.round(e.nativeEvent.layout.height)),
|
|
4737
5569
|
children: [
|
|
4738
|
-
/* @__PURE__ */ jsx(Pressable, { style:
|
|
5570
|
+
/* @__PURE__ */ jsx(Pressable, { style: styles24.backdrop, onPress: handleClose }),
|
|
4739
5571
|
/* @__PURE__ */ jsx(
|
|
4740
5572
|
Animated.View,
|
|
4741
5573
|
{
|
|
4742
5574
|
style: [
|
|
4743
|
-
|
|
5575
|
+
styles24.sheet,
|
|
4744
5576
|
{
|
|
4745
|
-
backgroundColor: theme.colors.
|
|
5577
|
+
backgroundColor: theme.colors.background,
|
|
4746
5578
|
borderTopLeftRadius: theme.radii.xl,
|
|
4747
5579
|
borderTopRightRadius: theme.radii.xl,
|
|
4748
5580
|
height: sheetHeight,
|
|
@@ -4758,28 +5590,28 @@ function UserPickerSheet({
|
|
|
4758
5590
|
children: /* @__PURE__ */ jsxs(
|
|
4759
5591
|
KeyboardAvoidingView,
|
|
4760
5592
|
{
|
|
4761
|
-
style:
|
|
5593
|
+
style: styles24.kav,
|
|
4762
5594
|
behavior: "padding",
|
|
4763
5595
|
keyboardVerticalOffset: screenHeight - sheetHeight,
|
|
4764
5596
|
children: [
|
|
4765
|
-
/* @__PURE__ */ jsx(View, { ...panHandlers, style:
|
|
4766
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
5597
|
+
/* @__PURE__ */ jsx(View, { ...panHandlers, style: styles24.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles24.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
|
|
5598
|
+
/* @__PURE__ */ jsxs(View, { style: styles24.header, children: [
|
|
4767
5599
|
/* @__PURE__ */ jsx(
|
|
4768
5600
|
Pressable,
|
|
4769
5601
|
{
|
|
4770
5602
|
onPress: handleClose,
|
|
4771
5603
|
hitSlop: 16,
|
|
4772
|
-
style: [
|
|
5604
|
+
style: [styles24.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
|
|
4773
5605
|
accessibilityLabel: "Close picker",
|
|
4774
|
-
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.
|
|
5606
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
|
|
4775
5607
|
}
|
|
4776
5608
|
),
|
|
4777
5609
|
/* @__PURE__ */ jsx(
|
|
4778
5610
|
Text,
|
|
4779
5611
|
{
|
|
4780
5612
|
style: [
|
|
4781
|
-
|
|
4782
|
-
{ color: theme.colors.
|
|
5613
|
+
styles24.title,
|
|
5614
|
+
{ color: theme.colors.text, fontFamily: theme.fonts.display }
|
|
4783
5615
|
],
|
|
4784
5616
|
numberOfLines: 1,
|
|
4785
5617
|
children: heading
|
|
@@ -4792,9 +5624,9 @@ function UserPickerSheet({
|
|
|
4792
5624
|
disabled: !canCreate,
|
|
4793
5625
|
hitSlop: 6,
|
|
4794
5626
|
style: [
|
|
4795
|
-
|
|
5627
|
+
styles24.createBtn,
|
|
4796
5628
|
{
|
|
4797
|
-
backgroundColor: canCreate ? theme.colors.
|
|
5629
|
+
backgroundColor: canCreate ? theme.colors.accent : theme.colors.surfaceAlt,
|
|
4798
5630
|
opacity: canCreate ? 1 : 0.6
|
|
4799
5631
|
}
|
|
4800
5632
|
],
|
|
@@ -4802,7 +5634,7 @@ function UserPickerSheet({
|
|
|
4802
5634
|
Text,
|
|
4803
5635
|
{
|
|
4804
5636
|
style: {
|
|
4805
|
-
color: canCreate ? theme.colors.
|
|
5637
|
+
color: canCreate ? theme.colors.accentText : theme.colors.textSubtle,
|
|
4806
5638
|
fontWeight: "700",
|
|
4807
5639
|
fontSize: 13
|
|
4808
5640
|
},
|
|
@@ -4819,17 +5651,17 @@ function UserPickerSheet({
|
|
|
4819
5651
|
TextInput,
|
|
4820
5652
|
{
|
|
4821
5653
|
placeholder: "Group name",
|
|
4822
|
-
placeholderTextColor: theme.colors.
|
|
5654
|
+
placeholderTextColor: theme.colors.textSubtle,
|
|
4823
5655
|
value: groupName,
|
|
4824
5656
|
onChangeText: setGroupName,
|
|
4825
5657
|
style: [
|
|
4826
|
-
|
|
5658
|
+
styles24.groupNameInput,
|
|
4827
5659
|
{
|
|
4828
|
-
color: theme.colors.
|
|
4829
|
-
backgroundColor: theme.colors.
|
|
5660
|
+
color: theme.colors.text,
|
|
5661
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
4830
5662
|
borderRadius: theme.radii.md,
|
|
4831
|
-
fontFamily: theme.
|
|
4832
|
-
fontSize: theme.
|
|
5663
|
+
fontFamily: theme.fonts.body,
|
|
5664
|
+
fontSize: theme.fonts.sizeMd
|
|
4833
5665
|
}
|
|
4834
5666
|
]
|
|
4835
5667
|
}
|
|
@@ -4838,16 +5670,16 @@ function UserPickerSheet({
|
|
|
4838
5670
|
TextInput,
|
|
4839
5671
|
{
|
|
4840
5672
|
placeholder: "Search\u2026",
|
|
4841
|
-
placeholderTextColor: theme.colors.
|
|
5673
|
+
placeholderTextColor: theme.colors.textSubtle,
|
|
4842
5674
|
value: query,
|
|
4843
5675
|
onChangeText: setQuery,
|
|
4844
5676
|
style: [
|
|
4845
|
-
|
|
5677
|
+
styles24.searchInput,
|
|
4846
5678
|
{
|
|
4847
|
-
color: theme.colors.
|
|
4848
|
-
backgroundColor: theme.colors.
|
|
5679
|
+
color: theme.colors.text,
|
|
5680
|
+
backgroundColor: theme.colors.surfaceAlt,
|
|
4849
5681
|
borderRadius: theme.radii.md,
|
|
4850
|
-
fontFamily: theme.
|
|
5682
|
+
fontFamily: theme.fonts.body,
|
|
4851
5683
|
fontSize: 14
|
|
4852
5684
|
}
|
|
4853
5685
|
]
|
|
@@ -4859,7 +5691,7 @@ function UserPickerSheet({
|
|
|
4859
5691
|
data: filtered,
|
|
4860
5692
|
keyExtractor: (u) => u.externalId,
|
|
4861
5693
|
keyboardShouldPersistTaps: "handled",
|
|
4862
|
-
ListEmptyComponent: /* @__PURE__ */ jsx(View, { style:
|
|
5694
|
+
ListEmptyComponent: /* @__PURE__ */ jsx(View, { style: styles24.empty, children: /* @__PURE__ */ jsx(Text, { style: [styles24.emptyText, { color: theme.colors.textSubtle }], children: query ? "No matches." : "No users to show." }) }),
|
|
4863
5695
|
renderItem: ({ item }) => /* @__PURE__ */ jsx(
|
|
4864
5696
|
UserRow,
|
|
4865
5697
|
{
|
|
@@ -4895,48 +5727,48 @@ function UserRow({
|
|
|
4895
5727
|
isGroup,
|
|
4896
5728
|
onPress
|
|
4897
5729
|
}) {
|
|
4898
|
-
const theme =
|
|
5730
|
+
const theme = useTheme();
|
|
4899
5731
|
return /* @__PURE__ */ jsxs(
|
|
4900
5732
|
Pressable,
|
|
4901
5733
|
{
|
|
4902
5734
|
onPress,
|
|
4903
5735
|
style: [
|
|
4904
|
-
|
|
5736
|
+
styles24.row,
|
|
4905
5737
|
{
|
|
4906
|
-
backgroundColor: selected ? theme.colors.
|
|
5738
|
+
backgroundColor: selected ? theme.colors.accentSoft : "transparent"
|
|
4907
5739
|
}
|
|
4908
5740
|
],
|
|
4909
5741
|
children: [
|
|
4910
|
-
user.avatarUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: user.avatarUrl }, style:
|
|
4911
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
5742
|
+
user.avatarUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: user.avatarUrl }, style: styles24.avatarImg }) : /* @__PURE__ */ jsx(Avatar, { src: null, name: user.name, seed: user.externalId, size: "md" }),
|
|
5743
|
+
/* @__PURE__ */ jsxs(View, { style: styles24.body, children: [
|
|
4912
5744
|
/* @__PURE__ */ jsx(
|
|
4913
5745
|
Text,
|
|
4914
5746
|
{
|
|
4915
|
-
style: [
|
|
5747
|
+
style: [styles24.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
|
|
4916
5748
|
numberOfLines: 1,
|
|
4917
5749
|
children: user.name
|
|
4918
5750
|
}
|
|
4919
5751
|
),
|
|
4920
|
-
user.subtitle ? /* @__PURE__ */ jsx(Text, { style: [
|
|
5752
|
+
user.subtitle ? /* @__PURE__ */ jsx(Text, { style: [styles24.subtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: user.subtitle }) : null
|
|
4921
5753
|
] }),
|
|
4922
5754
|
isGroup ? /* @__PURE__ */ jsx(
|
|
4923
5755
|
View,
|
|
4924
5756
|
{
|
|
4925
5757
|
style: [
|
|
4926
|
-
|
|
5758
|
+
styles24.checkbox,
|
|
4927
5759
|
{
|
|
4928
|
-
borderColor: selected ? theme.colors.
|
|
4929
|
-
backgroundColor: selected ? theme.colors.
|
|
5760
|
+
borderColor: selected ? theme.colors.accent : theme.colors.border,
|
|
5761
|
+
backgroundColor: selected ? theme.colors.accent : "transparent"
|
|
4930
5762
|
}
|
|
4931
5763
|
],
|
|
4932
|
-
children: selected ? /* @__PURE__ */ jsx(PoolseIcon, { name: "check", size: 14, color: theme.colors.
|
|
5764
|
+
children: selected ? /* @__PURE__ */ jsx(PoolseIcon, { name: "check", size: 14, color: theme.colors.accentText }) : null
|
|
4933
5765
|
}
|
|
4934
5766
|
) : null
|
|
4935
5767
|
]
|
|
4936
5768
|
}
|
|
4937
5769
|
);
|
|
4938
5770
|
}
|
|
4939
|
-
var
|
|
5771
|
+
var styles24 = StyleSheet.create({
|
|
4940
5772
|
modalRoot: {
|
|
4941
5773
|
flex: 1,
|
|
4942
5774
|
justifyContent: "flex-end"
|
|
@@ -5052,7 +5884,7 @@ var PoolseInbox = forwardRef(
|
|
|
5052
5884
|
emptyState,
|
|
5053
5885
|
keyboardOffset = 0
|
|
5054
5886
|
} = props;
|
|
5055
|
-
const theme =
|
|
5887
|
+
const theme = useTheme();
|
|
5056
5888
|
const { width: screenWidth } = useWindowDimensions();
|
|
5057
5889
|
const { me } = useMe();
|
|
5058
5890
|
const {
|
|
@@ -5200,7 +6032,7 @@ var PoolseInbox = forwardRef(
|
|
|
5200
6032
|
},
|
|
5201
6033
|
[renderConversationRow, meExternalId, meId, labelFor, avatarFor, unreadCounts]
|
|
5202
6034
|
);
|
|
5203
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
6035
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles25.root, { backgroundColor: theme.colors.background }], children: [
|
|
5204
6036
|
/* @__PURE__ */ jsxs(
|
|
5205
6037
|
Animated.View,
|
|
5206
6038
|
{
|
|
@@ -5211,7 +6043,7 @@ var PoolseInbox = forwardRef(
|
|
|
5211
6043
|
View,
|
|
5212
6044
|
{
|
|
5213
6045
|
style: [
|
|
5214
|
-
|
|
6046
|
+
styles25.listHeader,
|
|
5215
6047
|
{
|
|
5216
6048
|
backgroundColor: theme.colors.surface,
|
|
5217
6049
|
borderBottomColor: theme.colors.border
|
|
@@ -5222,13 +6054,13 @@ var PoolseInbox = forwardRef(
|
|
|
5222
6054
|
Text,
|
|
5223
6055
|
{
|
|
5224
6056
|
style: [
|
|
5225
|
-
|
|
5226
|
-
{ color: theme.colors.
|
|
6057
|
+
styles25.listTitle,
|
|
6058
|
+
{ color: theme.colors.text, fontFamily: theme.fonts.display }
|
|
5227
6059
|
],
|
|
5228
6060
|
children: title
|
|
5229
6061
|
}
|
|
5230
6062
|
),
|
|
5231
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
6063
|
+
/* @__PURE__ */ jsxs(View, { style: styles25.headerActions, children: [
|
|
5232
6064
|
users ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5233
6065
|
/* @__PURE__ */ jsx(
|
|
5234
6066
|
HeaderIconButton,
|
|
@@ -5333,7 +6165,7 @@ function HeaderIconButton({
|
|
|
5333
6165
|
onPress,
|
|
5334
6166
|
label
|
|
5335
6167
|
}) {
|
|
5336
|
-
const theme =
|
|
6168
|
+
const theme = useTheme();
|
|
5337
6169
|
return /* @__PURE__ */ jsx(
|
|
5338
6170
|
Pressable,
|
|
5339
6171
|
{
|
|
@@ -5341,12 +6173,12 @@ function HeaderIconButton({
|
|
|
5341
6173
|
hitSlop: 10,
|
|
5342
6174
|
accessibilityLabel: label,
|
|
5343
6175
|
style: ({ pressed }) => [
|
|
5344
|
-
|
|
6176
|
+
styles25.iconBtn,
|
|
5345
6177
|
{
|
|
5346
|
-
backgroundColor: pressed ? theme.colors.
|
|
6178
|
+
backgroundColor: pressed ? theme.colors.surfaceAlt : "transparent"
|
|
5347
6179
|
}
|
|
5348
6180
|
],
|
|
5349
|
-
children: /* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: 20, color: theme.colors.
|
|
6181
|
+
children: /* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: 20, color: theme.colors.text })
|
|
5350
6182
|
}
|
|
5351
6183
|
);
|
|
5352
6184
|
}
|
|
@@ -5360,7 +6192,7 @@ function DefaultConversationRow({
|
|
|
5360
6192
|
avatarFor,
|
|
5361
6193
|
onPress
|
|
5362
6194
|
}) {
|
|
5363
|
-
const theme =
|
|
6195
|
+
const theme = useTheme();
|
|
5364
6196
|
const isDirect = conv.type === "direct";
|
|
5365
6197
|
const otherExtId = isDirect && meExternalId ? (conv.member_external_ids ?? []).find((x) => x !== meExternalId) : null;
|
|
5366
6198
|
const resolvedOther = useUser(isDirect ? otherExtId ?? null : null);
|
|
@@ -5372,31 +6204,31 @@ function DefaultConversationRow({
|
|
|
5372
6204
|
{
|
|
5373
6205
|
onPress,
|
|
5374
6206
|
style: [
|
|
5375
|
-
|
|
6207
|
+
styles25.row,
|
|
5376
6208
|
{
|
|
5377
|
-
backgroundColor: selected ? theme.colors.
|
|
6209
|
+
backgroundColor: selected ? theme.colors.surfaceAlt : "transparent",
|
|
5378
6210
|
borderBottomColor: theme.colors.border
|
|
5379
6211
|
}
|
|
5380
6212
|
],
|
|
5381
6213
|
children: [
|
|
5382
|
-
avatarUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: avatarUrl }, style:
|
|
5383
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
6214
|
+
avatarUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: avatarUrl }, style: styles25.rowAvatar }) : /* @__PURE__ */ jsx(Avatar, { src: null, name: title, seed: avatarSeed, size: "md" }),
|
|
6215
|
+
/* @__PURE__ */ jsxs(View, { style: styles25.rowBody, children: [
|
|
5384
6216
|
/* @__PURE__ */ jsx(
|
|
5385
6217
|
Text,
|
|
5386
6218
|
{
|
|
5387
|
-
style: [
|
|
6219
|
+
style: [styles25.rowTitle, { color: theme.colors.text, fontFamily: theme.fonts.body }],
|
|
5388
6220
|
numberOfLines: 1,
|
|
5389
6221
|
children: title
|
|
5390
6222
|
}
|
|
5391
6223
|
),
|
|
5392
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
6224
|
+
/* @__PURE__ */ jsx(Text, { style: [styles25.rowSubtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (isDirect ? otherExtId ?? "" : `${(conv.member_external_ids ?? []).length} members`) })
|
|
5393
6225
|
] }),
|
|
5394
|
-
unread > 0 ? /* @__PURE__ */ jsx(View, { style: [
|
|
6226
|
+
unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles25.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles25.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
|
|
5395
6227
|
]
|
|
5396
6228
|
}
|
|
5397
6229
|
);
|
|
5398
6230
|
}
|
|
5399
|
-
var
|
|
6231
|
+
var styles25 = StyleSheet.create({
|
|
5400
6232
|
root: {
|
|
5401
6233
|
flex: 1,
|
|
5402
6234
|
overflow: "hidden"
|
|
@@ -5477,16 +6309,16 @@ var VARIANT_VB = {
|
|
|
5477
6309
|
mono: { vb: [0, 0, 454, 100], aspect: 4.54 }
|
|
5478
6310
|
};
|
|
5479
6311
|
function PoolseLogo({ variant = "lockup", size = 28, color, label }) {
|
|
5480
|
-
const theme =
|
|
6312
|
+
const theme = useTheme();
|
|
5481
6313
|
const mono = variant === "mono";
|
|
5482
|
-
const monoColor = color ?? theme.colors.
|
|
5483
|
-
const tileFill = mono ? "none" : theme.colors.
|
|
6314
|
+
const monoColor = color ?? theme.colors.text;
|
|
6315
|
+
const tileFill = mono ? "none" : theme.colors.accent;
|
|
5484
6316
|
const tileStroke = mono ? monoColor : "transparent";
|
|
5485
6317
|
const tileStrokeWidth = mono ? 5 : 0;
|
|
5486
|
-
const pulseStroke = mono ? monoColor : theme.colors.
|
|
5487
|
-
const pulseDotFill = mono ? monoColor : theme.colors.
|
|
5488
|
-
const inkFill = mono ? monoColor : theme.colors.
|
|
5489
|
-
const oFill = mono ? monoColor : theme.colors.
|
|
6318
|
+
const pulseStroke = mono ? monoColor : theme.colors.accentText;
|
|
6319
|
+
const pulseDotFill = mono ? monoColor : theme.colors.accentText;
|
|
6320
|
+
const inkFill = mono ? monoColor : theme.colors.text;
|
|
6321
|
+
const oFill = mono ? monoColor : theme.colors.accent;
|
|
5490
6322
|
const { vb, aspect } = VARIANT_VB[variant];
|
|
5491
6323
|
const width = size * aspect;
|
|
5492
6324
|
const showMark = variant === "lockup" || variant === "mark" || variant === "mono";
|
|
@@ -5581,7 +6413,7 @@ function CallControlButton({
|
|
|
5581
6413
|
const size = large ? CONTROL_SIZE_LARGE : CONTROL_SIZE;
|
|
5582
6414
|
const background = tone === "danger" ? callColors.danger : tone === "accept" ? callColors.accept : active ? callColors.controlActive : callColors.control;
|
|
5583
6415
|
const iconColor = tone === "neutral" && active ? callColors.controlActiveIcon : callColors.onAction;
|
|
5584
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
6416
|
+
return /* @__PURE__ */ jsxs(View, { style: styles26.slot, children: [
|
|
5585
6417
|
/* @__PURE__ */ jsx(
|
|
5586
6418
|
Pressable,
|
|
5587
6419
|
{
|
|
@@ -5592,7 +6424,7 @@ function CallControlButton({
|
|
|
5592
6424
|
accessibilityLabel: accessibilityLabel ?? label ?? icon,
|
|
5593
6425
|
hitSlop: 8,
|
|
5594
6426
|
style: ({ pressed }) => [
|
|
5595
|
-
|
|
6427
|
+
styles26.button,
|
|
5596
6428
|
{
|
|
5597
6429
|
width: size,
|
|
5598
6430
|
height: size,
|
|
@@ -5606,10 +6438,10 @@ function CallControlButton({
|
|
|
5606
6438
|
children: /* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: large ? 30 : 25, color: iconColor, label: null })
|
|
5607
6439
|
}
|
|
5608
6440
|
),
|
|
5609
|
-
label ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style:
|
|
6441
|
+
label ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles26.label, children: label }) : null
|
|
5610
6442
|
] });
|
|
5611
6443
|
}
|
|
5612
|
-
var
|
|
6444
|
+
var styles26 = StyleSheet.create({
|
|
5613
6445
|
// Fixed width so captions of different lengths cannot shift the row.
|
|
5614
6446
|
slot: { width: 76, alignItems: "center", gap: 7 },
|
|
5615
6447
|
button: { alignItems: "center", justifyContent: "center" },
|
|
@@ -5622,7 +6454,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
|
|
|
5622
6454
|
View,
|
|
5623
6455
|
{
|
|
5624
6456
|
style: [
|
|
5625
|
-
|
|
6457
|
+
styles27.ring,
|
|
5626
6458
|
{
|
|
5627
6459
|
width: outer,
|
|
5628
6460
|
height: outer,
|
|
@@ -5635,7 +6467,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
|
|
|
5635
6467
|
View,
|
|
5636
6468
|
{
|
|
5637
6469
|
style: [
|
|
5638
|
-
|
|
6470
|
+
styles27.circle,
|
|
5639
6471
|
{
|
|
5640
6472
|
width: size,
|
|
5641
6473
|
height: size,
|
|
@@ -5646,7 +6478,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
|
|
|
5646
6478
|
children: /* @__PURE__ */ jsx(
|
|
5647
6479
|
Text,
|
|
5648
6480
|
{
|
|
5649
|
-
style: [
|
|
6481
|
+
style: [styles27.initials, { fontSize: Math.round(size * 0.38) }],
|
|
5650
6482
|
numberOfLines: 1,
|
|
5651
6483
|
allowFontScaling: false,
|
|
5652
6484
|
children: initialsOf(name)
|
|
@@ -5663,7 +6495,7 @@ function initialsOf(name) {
|
|
|
5663
6495
|
if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
|
|
5664
6496
|
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
5665
6497
|
}
|
|
5666
|
-
var
|
|
6498
|
+
var styles27 = StyleSheet.create({
|
|
5667
6499
|
ring: { alignItems: "center", justifyContent: "center" },
|
|
5668
6500
|
circle: { alignItems: "center", justifyContent: "center" },
|
|
5669
6501
|
initials: { color: "#ffffff", fontWeight: "600" }
|
|
@@ -5691,15 +6523,15 @@ function AudioRouteSheet({
|
|
|
5691
6523
|
animationType: "fade",
|
|
5692
6524
|
onRequestClose: onClose,
|
|
5693
6525
|
...EDGE_TO_EDGE_MODAL,
|
|
5694
|
-
children: /* @__PURE__ */ jsx(Pressable, { style:
|
|
6526
|
+
children: /* @__PURE__ */ jsx(Pressable, { style: styles28.backdrop, onPress: onClose, accessibilityRole: "button", children: /* @__PURE__ */ jsxs(
|
|
5695
6527
|
Pressable,
|
|
5696
6528
|
{
|
|
5697
|
-
style: [
|
|
6529
|
+
style: [styles28.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }],
|
|
5698
6530
|
onPress: () => {
|
|
5699
6531
|
},
|
|
5700
6532
|
children: [
|
|
5701
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
5702
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
6533
|
+
/* @__PURE__ */ jsx(View, { style: styles28.grabber }),
|
|
6534
|
+
/* @__PURE__ */ jsx(Text, { style: styles28.title, children: "Audio output" }),
|
|
5703
6535
|
routes.map((route) => {
|
|
5704
6536
|
const selected = route.id === selectedRouteId;
|
|
5705
6537
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5711,7 +6543,7 @@ function AudioRouteSheet({
|
|
|
5711
6543
|
},
|
|
5712
6544
|
accessibilityRole: "button",
|
|
5713
6545
|
accessibilityState: { selected },
|
|
5714
|
-
style: ({ pressed }) => [
|
|
6546
|
+
style: ({ pressed }) => [styles28.row, pressed && styles28.rowPressed],
|
|
5715
6547
|
children: [
|
|
5716
6548
|
/* @__PURE__ */ jsx(
|
|
5717
6549
|
PoolseIcon,
|
|
@@ -5722,7 +6554,7 @@ function AudioRouteSheet({
|
|
|
5722
6554
|
label: null
|
|
5723
6555
|
}
|
|
5724
6556
|
),
|
|
5725
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
6557
|
+
/* @__PURE__ */ jsx(Text, { style: [styles28.label, selected && styles28.labelSelected], children: route.label }),
|
|
5726
6558
|
selected && /* @__PURE__ */ jsx(PoolseIcon, { name: "check", size: 19, color: callColors.accept, label: "selected" })
|
|
5727
6559
|
]
|
|
5728
6560
|
},
|
|
@@ -5735,7 +6567,7 @@ function AudioRouteSheet({
|
|
|
5735
6567
|
}
|
|
5736
6568
|
);
|
|
5737
6569
|
}
|
|
5738
|
-
var
|
|
6570
|
+
var styles28 = StyleSheet.create({
|
|
5739
6571
|
backdrop: { flex: 1, backgroundColor: "rgba(0,0,0,0.55)", justifyContent: "flex-end" },
|
|
5740
6572
|
sheet: {
|
|
5741
6573
|
backgroundColor: callColors.tile,
|
|
@@ -5795,6 +6627,6 @@ function format(total) {
|
|
|
5795
6627
|
return `${hours > 0 ? `${hours}:` : ""}${mm}:${String(seconds).padStart(2, "0")}`;
|
|
5796
6628
|
}
|
|
5797
6629
|
|
|
5798
|
-
export { AttachmentPicker, AttachmentPreview, AudioRouteSheet, Avatar, CallAvatar, CallControlButton, CallLogRow, ChatHeader, ConversationList, ConversationView, DaySeparator, GroupDetailsSheet, ImageMosaic, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, MessageList, MessageRow, PoolseIcon, PoolseInbox, PoolseLogo, PoolseTheme, primitives as Primitives, ReactionPicker, ReactionStrip, ThreadView, TypingIndicator, UploadQueueStrip, UserName, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName,
|
|
6630
|
+
export { AttachmentPicker, AttachmentPreview, AudioRouteSheet, Avatar, CallAvatar, CallControlButton, CallLogRow, ChatHeader, ConversationList, ConversationView, DaySeparator, GroupDetailsSheet, ImageMosaic, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, MessageList, MessageRow, PoolseIcon, PoolseInbox, PoolseLogo, PoolseTheme, primitives as Primitives, ReactionPicker, ReactionStrip, ThreadView, TypingIndicator, UploadQueueStrip, UserName, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName, useTheme };
|
|
5799
6631
|
//# sourceMappingURL=index.js.map
|
|
5800
6632
|
//# sourceMappingURL=index.js.map
|