@appsupportkit/support-sdk 0.3.0 → 0.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/lib/commonjs/api.js +49 -15
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/components/BottomSheet.js +1 -1
- package/lib/commonjs/components/BottomSheet.js.map +1 -1
- package/lib/commonjs/components/LauncherButton.js +4 -4
- package/lib/commonjs/components/LauncherButton.js.map +1 -1
- package/lib/commonjs/components/SupportButton.js +123 -97
- package/lib/commonjs/components/SupportButton.js.map +1 -1
- package/lib/commonjs/components/icons.js +81 -110
- package/lib/commonjs/components/icons.js.map +1 -1
- package/lib/commonjs/components/primitives.js +0 -153
- package/lib/commonjs/components/primitives.js.map +1 -1
- package/lib/commonjs/components/screens/ChatScreen.js +487 -0
- package/lib/commonjs/components/screens/ChatScreen.js.map +1 -0
- package/lib/commonjs/i18n/strings/de.js +3 -0
- package/lib/commonjs/i18n/strings/de.js.map +1 -1
- package/lib/commonjs/i18n/strings/en.js +3 -0
- package/lib/commonjs/i18n/strings/en.js.map +1 -1
- package/lib/commonjs/i18n/strings/es.js +3 -0
- package/lib/commonjs/i18n/strings/es.js.map +1 -1
- package/lib/commonjs/i18n/strings/fr.js +3 -0
- package/lib/commonjs/i18n/strings/fr.js.map +1 -1
- package/lib/commonjs/i18n/strings/hi.js +3 -0
- package/lib/commonjs/i18n/strings/hi.js.map +1 -1
- package/lib/commonjs/i18n/strings/it.js +3 -0
- package/lib/commonjs/i18n/strings/it.js.map +1 -1
- package/lib/commonjs/i18n/strings/ja.js +3 -0
- package/lib/commonjs/i18n/strings/ja.js.map +1 -1
- package/lib/commonjs/i18n/strings/ko.js +3 -0
- package/lib/commonjs/i18n/strings/ko.js.map +1 -1
- package/lib/commonjs/i18n/strings/nl.js +3 -0
- package/lib/commonjs/i18n/strings/nl.js.map +1 -1
- package/lib/commonjs/i18n/strings/pl.js +3 -0
- package/lib/commonjs/i18n/strings/pl.js.map +1 -1
- package/lib/commonjs/i18n/strings/pt.js +3 -0
- package/lib/commonjs/i18n/strings/pt.js.map +1 -1
- package/lib/commonjs/i18n/strings/ru.js +3 -0
- package/lib/commonjs/i18n/strings/ru.js.map +1 -1
- package/lib/commonjs/i18n/strings/tr.js +3 -0
- package/lib/commonjs/i18n/strings/tr.js.map +1 -1
- package/lib/commonjs/i18n/strings/zh.js +3 -0
- package/lib/commonjs/i18n/strings/zh.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/push.js +78 -3
- package/lib/commonjs/push.js.map +1 -1
- package/lib/commonjs/review.js +54 -0
- package/lib/commonjs/review.js.map +1 -0
- package/lib/commonjs/theme.js +142 -23
- package/lib/commonjs/theme.js.map +1 -1
- package/lib/commonjs/types.js +21 -3
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useSupportThreads.js +22 -15
- package/lib/commonjs/useSupportThreads.js.map +1 -1
- package/lib/commonjs/utils.js +13 -33
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/version.js +13 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/api.js +46 -13
- package/lib/module/api.js.map +1 -1
- package/lib/module/components/BottomSheet.js +1 -1
- package/lib/module/components/BottomSheet.js.map +1 -1
- package/lib/module/components/LauncherButton.js +5 -5
- package/lib/module/components/LauncherButton.js.map +1 -1
- package/lib/module/components/SupportButton.js +128 -102
- package/lib/module/components/SupportButton.js.map +1 -1
- package/lib/module/components/icons.js +80 -107
- package/lib/module/components/icons.js.map +1 -1
- package/lib/module/components/primitives.js +2 -146
- package/lib/module/components/primitives.js.map +1 -1
- package/lib/module/components/screens/ChatScreen.js +485 -0
- package/lib/module/components/screens/ChatScreen.js.map +1 -0
- package/lib/module/i18n/strings/de.js +3 -0
- package/lib/module/i18n/strings/de.js.map +1 -1
- package/lib/module/i18n/strings/en.js +3 -0
- package/lib/module/i18n/strings/en.js.map +1 -1
- package/lib/module/i18n/strings/es.js +3 -0
- package/lib/module/i18n/strings/es.js.map +1 -1
- package/lib/module/i18n/strings/fr.js +3 -0
- package/lib/module/i18n/strings/fr.js.map +1 -1
- package/lib/module/i18n/strings/hi.js +3 -0
- package/lib/module/i18n/strings/hi.js.map +1 -1
- package/lib/module/i18n/strings/it.js +3 -0
- package/lib/module/i18n/strings/it.js.map +1 -1
- package/lib/module/i18n/strings/ja.js +3 -0
- package/lib/module/i18n/strings/ja.js.map +1 -1
- package/lib/module/i18n/strings/ko.js +3 -0
- package/lib/module/i18n/strings/ko.js.map +1 -1
- package/lib/module/i18n/strings/nl.js +3 -0
- package/lib/module/i18n/strings/nl.js.map +1 -1
- package/lib/module/i18n/strings/pl.js +3 -0
- package/lib/module/i18n/strings/pl.js.map +1 -1
- package/lib/module/i18n/strings/pt.js +3 -0
- package/lib/module/i18n/strings/pt.js.map +1 -1
- package/lib/module/i18n/strings/ru.js +3 -0
- package/lib/module/i18n/strings/ru.js.map +1 -1
- package/lib/module/i18n/strings/tr.js +3 -0
- package/lib/module/i18n/strings/tr.js.map +1 -1
- package/lib/module/i18n/strings/zh.js +3 -0
- package/lib/module/i18n/strings/zh.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/push.js +77 -3
- package/lib/module/push.js.map +1 -1
- package/lib/module/review.js +48 -0
- package/lib/module/review.js.map +1 -0
- package/lib/module/theme.js +141 -23
- package/lib/module/theme.js.map +1 -1
- package/lib/module/types.js +21 -3
- package/lib/module/types.js.map +1 -1
- package/lib/module/useSupportThreads.js +22 -15
- package/lib/module/useSupportThreads.js.map +1 -1
- package/lib/module/utils.js +12 -32
- package/lib/module/utils.js.map +1 -1
- package/lib/module/version.js +9 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/api.d.ts +33 -12
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/components/SupportButton.d.ts +2 -2
- package/lib/typescript/components/SupportButton.d.ts.map +1 -1
- package/lib/typescript/components/icons.d.ts +5 -14
- package/lib/typescript/components/icons.d.ts.map +1 -1
- package/lib/typescript/components/primitives.d.ts +0 -31
- package/lib/typescript/components/primitives.d.ts.map +1 -1
- package/lib/typescript/components/screens/ChatScreen.d.ts +21 -0
- package/lib/typescript/components/screens/ChatScreen.d.ts.map +1 -0
- package/lib/typescript/i18n/strings/de.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/en.d.ts +3 -0
- package/lib/typescript/i18n/strings/en.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/es.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/fr.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/hi.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/it.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/ja.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/ko.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/nl.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/pl.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/pt.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/ru.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/tr.d.ts.map +1 -1
- package/lib/typescript/i18n/strings/zh.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/push.d.ts +14 -2
- package/lib/typescript/push.d.ts.map +1 -1
- package/lib/typescript/review.d.ts +15 -0
- package/lib/typescript/review.d.ts.map +1 -0
- package/lib/typescript/theme.d.ts +23 -5
- package/lib/typescript/theme.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +54 -11
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/useSupportThreads.d.ts +9 -3
- package/lib/typescript/useSupportThreads.d.ts.map +1 -1
- package/lib/typescript/utils.d.ts +3 -2
- package/lib/typescript/utils.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +7 -0
- package/lib/typescript/version.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/api.ts +59 -30
- package/src/components/BottomSheet.tsx +1 -1
- package/src/components/LauncherButton.tsx +4 -4
- package/src/components/SupportButton.tsx +140 -111
- package/src/components/icons.tsx +60 -101
- package/src/components/primitives.tsx +1 -163
- package/src/components/screens/ChatScreen.tsx +541 -0
- package/src/i18n/strings/de.ts +3 -0
- package/src/i18n/strings/en.ts +3 -0
- package/src/i18n/strings/es.ts +3 -0
- package/src/i18n/strings/fr.ts +3 -0
- package/src/i18n/strings/hi.ts +3 -0
- package/src/i18n/strings/it.ts +3 -0
- package/src/i18n/strings/ja.ts +3 -0
- package/src/i18n/strings/ko.ts +3 -0
- package/src/i18n/strings/nl.ts +3 -0
- package/src/i18n/strings/pl.ts +3 -0
- package/src/i18n/strings/pt.ts +3 -0
- package/src/i18n/strings/ru.ts +3 -0
- package/src/i18n/strings/tr.ts +3 -0
- package/src/i18n/strings/zh.ts +3 -0
- package/src/index.tsx +5 -0
- package/src/push.ts +100 -2
- package/src/review.ts +54 -0
- package/src/theme.ts +182 -28
- package/src/types.ts +53 -11
- package/src/useSupportThreads.ts +31 -18
- package/src/utils.ts +14 -21
- package/src/version.ts +6 -0
- package/lib/commonjs/components/screens/ComposeScreen.js +0 -219
- package/lib/commonjs/components/screens/ComposeScreen.js.map +0 -1
- package/lib/commonjs/components/screens/HomeScreen.js +0 -334
- package/lib/commonjs/components/screens/HomeScreen.js.map +0 -1
- package/lib/commonjs/components/screens/ThreadScreen.js +0 -339
- package/lib/commonjs/components/screens/ThreadScreen.js.map +0 -1
- package/lib/module/components/screens/ComposeScreen.js +0 -217
- package/lib/module/components/screens/ComposeScreen.js.map +0 -1
- package/lib/module/components/screens/HomeScreen.js +0 -330
- package/lib/module/components/screens/HomeScreen.js.map +0 -1
- package/lib/module/components/screens/ThreadScreen.js +0 -337
- package/lib/module/components/screens/ThreadScreen.js.map +0 -1
- package/lib/typescript/components/screens/ComposeScreen.d.ts +0 -12
- package/lib/typescript/components/screens/ComposeScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/HomeScreen.d.ts +0 -19
- package/lib/typescript/components/screens/HomeScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/ThreadScreen.d.ts +0 -12
- package/lib/typescript/components/screens/ThreadScreen.d.ts.map +0 -1
- package/src/components/screens/ComposeScreen.tsx +0 -229
- package/src/components/screens/HomeScreen.tsx +0 -346
- package/src/components/screens/ThreadScreen.tsx +0 -424
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { RefreshControl, ScrollView, Text, View } from 'react-native';
|
|
4
|
-
import { LANGUAGE_LABELS } from '../../i18n/languages';
|
|
5
|
-
import { relativeTime } from '../../utils';
|
|
6
|
-
import { Chevron, CloseIcon, GlobeIcon } from '../icons';
|
|
7
|
-
import { EmptyState, ErrorState, IconButton, PressableRow, SectionLabel, SkeletonBlock, textStyles, TypeGlyph, UnreadPill } from '../primitives';
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
-
const COMPOSE_TYPES = ['feedback', 'feature_request', 'bug_report'];
|
|
10
|
-
function ThreadRow({
|
|
11
|
-
thread,
|
|
12
|
-
theme,
|
|
13
|
-
strings,
|
|
14
|
-
onPress,
|
|
15
|
-
last
|
|
16
|
-
}) {
|
|
17
|
-
const unread = thread.unread_count > 0;
|
|
18
|
-
const type = strings.t(`type.${thread.type}`);
|
|
19
|
-
const preview = thread.last_message?.body ?? strings.t('home.noMessages');
|
|
20
|
-
const at = thread.last_message?.created_at ?? thread.created_at;
|
|
21
|
-
return /*#__PURE__*/_jsxs(PressableRow, {
|
|
22
|
-
onPress: onPress,
|
|
23
|
-
theme: theme,
|
|
24
|
-
accessibilityLabel: unread ? strings.t('home.threadUnreadA11y', {
|
|
25
|
-
type,
|
|
26
|
-
count: thread.unread_count
|
|
27
|
-
}) : strings.t('home.threadA11y', {
|
|
28
|
-
type
|
|
29
|
-
}),
|
|
30
|
-
style: {
|
|
31
|
-
flexDirection: 'row',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
gap: 12,
|
|
34
|
-
paddingHorizontal: 16,
|
|
35
|
-
paddingVertical: 13,
|
|
36
|
-
borderBottomWidth: last ? 0 : 1,
|
|
37
|
-
borderBottomColor: theme.colors.border,
|
|
38
|
-
opacity: thread.status === 'resolved' ? 0.75 : 1
|
|
39
|
-
},
|
|
40
|
-
children: [/*#__PURE__*/_jsx(TypeGlyph, {
|
|
41
|
-
type: thread.type,
|
|
42
|
-
theme: theme,
|
|
43
|
-
size: 38
|
|
44
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
45
|
-
style: {
|
|
46
|
-
flex: 1,
|
|
47
|
-
gap: 3
|
|
48
|
-
},
|
|
49
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
50
|
-
style: {
|
|
51
|
-
flexDirection: 'row',
|
|
52
|
-
alignItems: 'center',
|
|
53
|
-
gap: 8
|
|
54
|
-
},
|
|
55
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
56
|
-
numberOfLines: 1,
|
|
57
|
-
style: {
|
|
58
|
-
flex: 1,
|
|
59
|
-
fontSize: 14,
|
|
60
|
-
fontWeight: unread ? '700' : '600',
|
|
61
|
-
letterSpacing: -0.1,
|
|
62
|
-
color: theme.colors.textPrimary
|
|
63
|
-
},
|
|
64
|
-
children: type
|
|
65
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
66
|
-
style: textStyles.meta(theme),
|
|
67
|
-
children: relativeTime(at, strings)
|
|
68
|
-
})]
|
|
69
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
70
|
-
style: {
|
|
71
|
-
flexDirection: 'row',
|
|
72
|
-
alignItems: 'center',
|
|
73
|
-
gap: 8
|
|
74
|
-
},
|
|
75
|
-
children: [/*#__PURE__*/_jsxs(Text, {
|
|
76
|
-
numberOfLines: 1,
|
|
77
|
-
style: {
|
|
78
|
-
flex: 1,
|
|
79
|
-
fontSize: 13,
|
|
80
|
-
lineHeight: 18,
|
|
81
|
-
color: unread ? theme.colors.textPrimary : theme.colors.textSecondary
|
|
82
|
-
},
|
|
83
|
-
children: [thread.last_message?.sender === 'user' ? `${strings.t('home.you')}: ` : '', preview]
|
|
84
|
-
}), unread ? /*#__PURE__*/_jsx(UnreadPill, {
|
|
85
|
-
count: thread.unread_count,
|
|
86
|
-
theme: theme
|
|
87
|
-
}) : /*#__PURE__*/_jsx(Chevron, {
|
|
88
|
-
color: theme.colors.textTertiary
|
|
89
|
-
})]
|
|
90
|
-
})]
|
|
91
|
-
})]
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
function ThreadGroup({
|
|
95
|
-
label,
|
|
96
|
-
threads,
|
|
97
|
-
theme,
|
|
98
|
-
strings,
|
|
99
|
-
onOpenThread
|
|
100
|
-
}) {
|
|
101
|
-
if (threads.length === 0) return null;
|
|
102
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
103
|
-
style: {
|
|
104
|
-
marginTop: 24
|
|
105
|
-
},
|
|
106
|
-
children: [/*#__PURE__*/_jsx(SectionLabel, {
|
|
107
|
-
theme: theme,
|
|
108
|
-
style: {
|
|
109
|
-
paddingHorizontal: 16,
|
|
110
|
-
paddingBottom: 8
|
|
111
|
-
},
|
|
112
|
-
children: label
|
|
113
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
114
|
-
style: {
|
|
115
|
-
marginHorizontal: 16,
|
|
116
|
-
borderWidth: 1,
|
|
117
|
-
borderColor: theme.colors.border,
|
|
118
|
-
borderRadius: theme.radii.card,
|
|
119
|
-
backgroundColor: theme.colors.surface,
|
|
120
|
-
overflow: 'hidden'
|
|
121
|
-
},
|
|
122
|
-
children: threads.map((thread, i) => /*#__PURE__*/_jsx(ThreadRow, {
|
|
123
|
-
thread: thread,
|
|
124
|
-
theme: theme,
|
|
125
|
-
strings: strings,
|
|
126
|
-
onPress: () => onOpenThread(thread),
|
|
127
|
-
last: i === threads.length - 1
|
|
128
|
-
}, thread.id))
|
|
129
|
-
})]
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
export function HomeScreen({
|
|
133
|
-
theme,
|
|
134
|
-
strings,
|
|
135
|
-
language,
|
|
136
|
-
threads,
|
|
137
|
-
loading,
|
|
138
|
-
refreshing,
|
|
139
|
-
error,
|
|
140
|
-
onRefresh,
|
|
141
|
-
onCompose,
|
|
142
|
-
onOpenThread,
|
|
143
|
-
onChangeLanguage,
|
|
144
|
-
onClose
|
|
145
|
-
}) {
|
|
146
|
-
const open = (threads ?? []).filter(t => t.status === 'open');
|
|
147
|
-
const resolved = (threads ?? []).filter(t => t.status === 'resolved');
|
|
148
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
149
|
-
style: {
|
|
150
|
-
flex: 1
|
|
151
|
-
},
|
|
152
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
153
|
-
style: {
|
|
154
|
-
flexDirection: 'row',
|
|
155
|
-
alignItems: 'flex-start',
|
|
156
|
-
paddingHorizontal: 16,
|
|
157
|
-
paddingTop: 4,
|
|
158
|
-
paddingBottom: 16
|
|
159
|
-
},
|
|
160
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
161
|
-
style: {
|
|
162
|
-
flex: 1,
|
|
163
|
-
gap: 2
|
|
164
|
-
},
|
|
165
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
166
|
-
style: textStyles.title(theme),
|
|
167
|
-
children: strings.t('home.title')
|
|
168
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
169
|
-
style: textStyles.secondary(theme),
|
|
170
|
-
children: strings.t('home.subtitle')
|
|
171
|
-
})]
|
|
172
|
-
}), /*#__PURE__*/_jsx(IconButton, {
|
|
173
|
-
onPress: onClose,
|
|
174
|
-
theme: theme,
|
|
175
|
-
accessibilityLabel: strings.t('home.close'),
|
|
176
|
-
size: 32,
|
|
177
|
-
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
178
|
-
color: theme.colors.textSecondary,
|
|
179
|
-
size: 12
|
|
180
|
-
})
|
|
181
|
-
})]
|
|
182
|
-
}), /*#__PURE__*/_jsxs(ScrollView, {
|
|
183
|
-
style: {
|
|
184
|
-
flex: 1
|
|
185
|
-
},
|
|
186
|
-
contentContainerStyle: {
|
|
187
|
-
paddingBottom: 24
|
|
188
|
-
},
|
|
189
|
-
keyboardShouldPersistTaps: "handled",
|
|
190
|
-
refreshControl: /*#__PURE__*/_jsx(RefreshControl, {
|
|
191
|
-
refreshing: refreshing,
|
|
192
|
-
onRefresh: onRefresh,
|
|
193
|
-
tintColor: theme.colors.textTertiary,
|
|
194
|
-
colors: [theme.colors.accent],
|
|
195
|
-
progressBackgroundColor: theme.colors.surface
|
|
196
|
-
}),
|
|
197
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
198
|
-
style: {
|
|
199
|
-
marginHorizontal: 16,
|
|
200
|
-
borderWidth: 1,
|
|
201
|
-
borderColor: theme.colors.border,
|
|
202
|
-
borderRadius: theme.radii.card,
|
|
203
|
-
backgroundColor: theme.colors.surface,
|
|
204
|
-
overflow: 'hidden'
|
|
205
|
-
},
|
|
206
|
-
children: COMPOSE_TYPES.map((type, i) => /*#__PURE__*/_jsxs(PressableRow, {
|
|
207
|
-
onPress: () => onCompose(type),
|
|
208
|
-
theme: theme,
|
|
209
|
-
accessibilityLabel: strings.t('home.newA11y', {
|
|
210
|
-
type: strings.t(`type.${type}`)
|
|
211
|
-
}),
|
|
212
|
-
style: {
|
|
213
|
-
flexDirection: 'row',
|
|
214
|
-
alignItems: 'center',
|
|
215
|
-
gap: 12,
|
|
216
|
-
paddingHorizontal: 14,
|
|
217
|
-
paddingVertical: 12,
|
|
218
|
-
borderTopWidth: i === 0 ? 0 : 1,
|
|
219
|
-
borderTopColor: theme.colors.border
|
|
220
|
-
},
|
|
221
|
-
children: [/*#__PURE__*/_jsx(TypeGlyph, {
|
|
222
|
-
type: type,
|
|
223
|
-
theme: theme,
|
|
224
|
-
size: 34
|
|
225
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
226
|
-
style: {
|
|
227
|
-
flex: 1,
|
|
228
|
-
gap: 1
|
|
229
|
-
},
|
|
230
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
231
|
-
style: textStyles.heading(theme),
|
|
232
|
-
children: strings.t(`type.${type}`)
|
|
233
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
234
|
-
style: textStyles.meta(theme),
|
|
235
|
-
children: strings.t(`hint.${type}`)
|
|
236
|
-
})]
|
|
237
|
-
}), /*#__PURE__*/_jsx(Chevron, {
|
|
238
|
-
color: theme.colors.textTertiary
|
|
239
|
-
})]
|
|
240
|
-
}, type))
|
|
241
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
242
|
-
style: {
|
|
243
|
-
marginTop: 12,
|
|
244
|
-
marginHorizontal: 16,
|
|
245
|
-
borderWidth: 1,
|
|
246
|
-
borderColor: theme.colors.border,
|
|
247
|
-
borderRadius: theme.radii.card,
|
|
248
|
-
backgroundColor: theme.colors.surface,
|
|
249
|
-
overflow: 'hidden'
|
|
250
|
-
},
|
|
251
|
-
children: /*#__PURE__*/_jsxs(PressableRow, {
|
|
252
|
-
onPress: onChangeLanguage,
|
|
253
|
-
theme: theme,
|
|
254
|
-
accessibilityLabel: strings.t('lang.change'),
|
|
255
|
-
style: {
|
|
256
|
-
flexDirection: 'row',
|
|
257
|
-
alignItems: 'center',
|
|
258
|
-
gap: 12,
|
|
259
|
-
paddingHorizontal: 14,
|
|
260
|
-
paddingVertical: 11
|
|
261
|
-
},
|
|
262
|
-
children: [/*#__PURE__*/_jsx(GlobeIcon, {
|
|
263
|
-
color: theme.colors.textTertiary,
|
|
264
|
-
size: 16
|
|
265
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
266
|
-
style: [textStyles.secondary(theme), {
|
|
267
|
-
flex: 1
|
|
268
|
-
}],
|
|
269
|
-
children: strings.t('home.language')
|
|
270
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
271
|
-
style: textStyles.meta(theme),
|
|
272
|
-
children: LANGUAGE_LABELS[language]
|
|
273
|
-
}), /*#__PURE__*/_jsx(Chevron, {
|
|
274
|
-
color: theme.colors.textTertiary
|
|
275
|
-
})]
|
|
276
|
-
})
|
|
277
|
-
}), error !== null && threads === null ?
|
|
278
|
-
/*#__PURE__*/
|
|
279
|
-
// Only take over the screen when there's nothing cached to show —
|
|
280
|
-
// a failed background poll shouldn't hide an already-loaded list.
|
|
281
|
-
_jsx(ErrorState, {
|
|
282
|
-
message: error,
|
|
283
|
-
onRetry: onRefresh,
|
|
284
|
-
theme: theme,
|
|
285
|
-
strings: strings
|
|
286
|
-
}) : loading && threads === null ? /*#__PURE__*/_jsxs(View, {
|
|
287
|
-
style: {
|
|
288
|
-
paddingHorizontal: 16,
|
|
289
|
-
paddingTop: 28,
|
|
290
|
-
gap: 12
|
|
291
|
-
},
|
|
292
|
-
children: [/*#__PURE__*/_jsx(SkeletonBlock, {
|
|
293
|
-
width: 110,
|
|
294
|
-
height: 11,
|
|
295
|
-
theme: theme,
|
|
296
|
-
radius: 4
|
|
297
|
-
}), /*#__PURE__*/_jsx(SkeletonBlock, {
|
|
298
|
-
width: "100%",
|
|
299
|
-
height: 64,
|
|
300
|
-
theme: theme,
|
|
301
|
-
radius: theme.radii.card
|
|
302
|
-
}), /*#__PURE__*/_jsx(SkeletonBlock, {
|
|
303
|
-
width: "100%",
|
|
304
|
-
height: 64,
|
|
305
|
-
theme: theme,
|
|
306
|
-
radius: theme.radii.card
|
|
307
|
-
})]
|
|
308
|
-
}) : (threads ?? []).length === 0 ? /*#__PURE__*/_jsx(EmptyState, {
|
|
309
|
-
message: strings.t('home.empty'),
|
|
310
|
-
hint: strings.t('home.emptyHint'),
|
|
311
|
-
theme: theme
|
|
312
|
-
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
313
|
-
children: [/*#__PURE__*/_jsx(ThreadGroup, {
|
|
314
|
-
label: `${strings.t('home.open')} · ${open.length}`,
|
|
315
|
-
threads: open,
|
|
316
|
-
theme: theme,
|
|
317
|
-
strings: strings,
|
|
318
|
-
onOpenThread: onOpenThread
|
|
319
|
-
}), /*#__PURE__*/_jsx(ThreadGroup, {
|
|
320
|
-
label: strings.t('home.resolved'),
|
|
321
|
-
threads: resolved,
|
|
322
|
-
theme: theme,
|
|
323
|
-
strings: strings,
|
|
324
|
-
onOpenThread: onOpenThread
|
|
325
|
-
})]
|
|
326
|
-
})]
|
|
327
|
-
})]
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
//# sourceMappingURL=HomeScreen.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["RefreshControl","ScrollView","Text","View","LANGUAGE_LABELS","relativeTime","Chevron","CloseIcon","GlobeIcon","EmptyState","ErrorState","IconButton","PressableRow","SectionLabel","SkeletonBlock","textStyles","TypeGlyph","UnreadPill","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","COMPOSE_TYPES","ThreadRow","thread","theme","strings","onPress","last","unread","unread_count","type","t","preview","last_message","body","at","created_at","accessibilityLabel","count","style","flexDirection","alignItems","gap","paddingHorizontal","paddingVertical","borderBottomWidth","borderBottomColor","colors","border","opacity","status","children","size","flex","numberOfLines","fontSize","fontWeight","letterSpacing","color","textPrimary","meta","lineHeight","textSecondary","sender","textTertiary","ThreadGroup","label","threads","onOpenThread","length","marginTop","paddingBottom","marginHorizontal","borderWidth","borderColor","borderRadius","radii","card","backgroundColor","surface","overflow","map","i","id","HomeScreen","language","loading","refreshing","error","onRefresh","onCompose","onChangeLanguage","onClose","open","filter","resolved","paddingTop","title","secondary","contentContainerStyle","keyboardShouldPersistTaps","refreshControl","tintColor","accent","progressBackgroundColor","borderTopWidth","borderTopColor","heading","message","onRetry","width","height","radius","hint"],"sourceRoot":"../../../../src","sources":["components/screens/HomeScreen.tsx"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AA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AE,CAAC,eAClF7D,IAAA,CAACL,aAAa;UAACmG,KAAK,EAAC,MAAM;UAACC,MAAM,EAAE,EAAG;UAACvF,KAAK,EAAEA,KAAM;UAACwF,MAAM,EAAExF,KAAK,CAACoD,KAAK,CAACC;QAAK,CAAE,CAAC;MAAA,CAC9E,CAAC,GACL,CAACV,OAAO,IAAI,EAAE,EAAEE,MAAM,KAAK,CAAC,gBAC9BrD,IAAA,CAACV,UAAU;QACTsG,OAAO,EAAEnF,OAAO,CAACM,CAAC,CAAC,YAAY,CAAE;QACjCkF,IAAI,EAAExF,OAAO,CAACM,CAAC,CAAC,gBAAgB,CAAE;QAClCP,KAAK,EAAEA;MAAM,CACd,CAAC,gBAEFN,KAAA,CAAAE,SAAA;QAAA+B,QAAA,gBACEnC,IAAA,CAACiD,WAAW;UACVC,KAAK,EAAE,GAAGzC,OAAO,CAACM,CAAC,CAAC,WAAW,CAAC,MAAM8D,IAAI,CAACxB,MAAM,EAAG;UACpDF,OAAO,EAAE0B,IAAK;UACdrE,KAAK,EAAEA,KAAM;UACbC,OAAO,EAAEA,OAAQ;UACjB2C,YAAY,EAAEA;QAAa,CAC5B,CAAC,eACFpD,IAAA,CAACiD,WAAW;UACVC,KAAK,EAAEzC,OAAO,CAACM,CAAC,CAAC,eAAe,CAAE;UAClCoC,OAAO,EAAE4B,QAAS;UAClBvE,KAAK,EAAEA,KAAM;UACbC,OAAO,EAAEA,OAAQ;UACjB2C,YAAY,EAAEA;QAAa,CAC5B,CAAC;MAAA,CACF,CACH;IAAA,CACS,CAAC;EAAA,CACT,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { KeyboardAvoidingView, Platform, ScrollView, Text, TextInput, View } from 'react-native';
|
|
5
|
-
import { USER_MESSAGE_MAX, USER_MESSAGE_MIN } from '../../types';
|
|
6
|
-
import { dayLabel, formatDate, formatTime, isSameDay, relativeTime } from '../../utils';
|
|
7
|
-
import { ArrowUpIcon, Chevron } from '../icons';
|
|
8
|
-
import { IconButton, StatusIndicator, textStyles, TypeChipView } from '../primitives';
|
|
9
|
-
|
|
10
|
-
/** Consecutive messages from one sender inside this window form a group. */
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
-
const GROUP_WINDOW_MS = 5 * 60 * 1000;
|
|
13
|
-
/** The counter only appears once the limit is actually in play. */
|
|
14
|
-
const COUNTER_VISIBLE_FROM = USER_MESSAGE_MAX - 60;
|
|
15
|
-
function buildRows(messages, unreadCount, strings) {
|
|
16
|
-
// Unread messages are always the newest admin ones, so the divider goes
|
|
17
|
-
// above the Nth-from-last admin message.
|
|
18
|
-
let remaining = unreadCount;
|
|
19
|
-
let firstUnreadId = null;
|
|
20
|
-
for (let i = messages.length - 1; i >= 0 && remaining > 0; i -= 1) {
|
|
21
|
-
const candidate = messages[i];
|
|
22
|
-
if (candidate === undefined || candidate.sender !== 'admin') continue;
|
|
23
|
-
remaining -= 1;
|
|
24
|
-
firstUnreadId = candidate.id;
|
|
25
|
-
}
|
|
26
|
-
return messages.map((message, i) => {
|
|
27
|
-
const previous = i > 0 ? messages[i - 1] ?? null : null;
|
|
28
|
-
const next = i < messages.length - 1 ? messages[i + 1] ?? null : null;
|
|
29
|
-
// Grouped by sender alone. Two replies from two different admins are two
|
|
30
|
-
// messages from "Support" as far as this side is concerned, so breaking
|
|
31
|
-
// the group between them would be a visible seam with no visible cause.
|
|
32
|
-
const withinGroup = (a, b) => a !== null && a.sender === b.sender && Math.abs(Date.parse(b.created_at) - Date.parse(a.created_at)) < GROUP_WINDOW_MS;
|
|
33
|
-
const day = previous === null || !isSameDay(previous.created_at, message.created_at) ? dayLabel(message.created_at, strings) : null;
|
|
34
|
-
const startsUnread = message.id === firstUnreadId;
|
|
35
|
-
return {
|
|
36
|
-
message,
|
|
37
|
-
// A separator always breaks a group.
|
|
38
|
-
firstInGroup: day !== null || startsUnread || !withinGroup(previous, message),
|
|
39
|
-
lastInGroup: next === null || next.id === firstUnreadId || !isSameDay(next.created_at, message.created_at) || !withinGroup(next, message),
|
|
40
|
-
day,
|
|
41
|
-
startsUnread
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function Separator({
|
|
46
|
-
label,
|
|
47
|
-
theme,
|
|
48
|
-
tone = 'muted'
|
|
49
|
-
}) {
|
|
50
|
-
const color = tone === 'accent' ? theme.colors.accent : theme.colors.textTertiary;
|
|
51
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
52
|
-
style: {
|
|
53
|
-
flexDirection: 'row',
|
|
54
|
-
alignItems: 'center',
|
|
55
|
-
gap: 10,
|
|
56
|
-
paddingVertical: 6
|
|
57
|
-
},
|
|
58
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
59
|
-
style: {
|
|
60
|
-
flex: 1,
|
|
61
|
-
height: 1,
|
|
62
|
-
backgroundColor: tone === 'accent' ? theme.colors.accentMuted : theme.colors.border
|
|
63
|
-
}
|
|
64
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
65
|
-
style: {
|
|
66
|
-
fontSize: 11,
|
|
67
|
-
fontWeight: '600',
|
|
68
|
-
letterSpacing: 0.3,
|
|
69
|
-
color
|
|
70
|
-
},
|
|
71
|
-
children: label
|
|
72
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
73
|
-
style: {
|
|
74
|
-
flex: 1,
|
|
75
|
-
height: 1,
|
|
76
|
-
backgroundColor: tone === 'accent' ? theme.colors.accentMuted : theme.colors.border
|
|
77
|
-
}
|
|
78
|
-
})]
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function MessageBubble({
|
|
82
|
-
row,
|
|
83
|
-
theme,
|
|
84
|
-
strings
|
|
85
|
-
}) {
|
|
86
|
-
const {
|
|
87
|
-
message,
|
|
88
|
-
firstInGroup,
|
|
89
|
-
lastInGroup
|
|
90
|
-
} = row;
|
|
91
|
-
const own = message.sender === 'user';
|
|
92
|
-
const round = theme.radii.bubble;
|
|
93
|
-
const tight = theme.radii.bubbleTail;
|
|
94
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
95
|
-
style: {
|
|
96
|
-
maxWidth: '86%',
|
|
97
|
-
alignSelf: own ? 'flex-end' : 'flex-start',
|
|
98
|
-
alignItems: own ? 'flex-end' : 'flex-start',
|
|
99
|
-
marginTop: firstInGroup ? 10 : 2,
|
|
100
|
-
gap: 4
|
|
101
|
-
},
|
|
102
|
-
children: [!own && firstInGroup && /*#__PURE__*/_jsx(Text, {
|
|
103
|
-
style: [textStyles.meta(theme), {
|
|
104
|
-
paddingHorizontal: 4
|
|
105
|
-
}],
|
|
106
|
-
children: strings.t('thread.support')
|
|
107
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
108
|
-
style: {
|
|
109
|
-
paddingHorizontal: 14,
|
|
110
|
-
paddingVertical: 10,
|
|
111
|
-
backgroundColor: own ? theme.colors.accent : theme.colors.surface,
|
|
112
|
-
borderWidth: own ? 0 : 1,
|
|
113
|
-
borderColor: theme.colors.border,
|
|
114
|
-
borderTopLeftRadius: own || firstInGroup ? round : tight,
|
|
115
|
-
borderBottomLeftRadius: own || lastInGroup ? round : tight,
|
|
116
|
-
borderTopRightRadius: !own || firstInGroup ? round : tight,
|
|
117
|
-
borderBottomRightRadius: !own || lastInGroup ? round : tight
|
|
118
|
-
},
|
|
119
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
120
|
-
style: [textStyles.body(theme), own && {
|
|
121
|
-
color: theme.colors.accentForeground
|
|
122
|
-
}],
|
|
123
|
-
children: message.body
|
|
124
|
-
})
|
|
125
|
-
}), lastInGroup && /*#__PURE__*/_jsx(Text, {
|
|
126
|
-
style: [textStyles.meta(theme), {
|
|
127
|
-
paddingHorizontal: 4
|
|
128
|
-
}],
|
|
129
|
-
children: message.translation_pending ? strings.t('thread.translating') : formatTime(message.created_at, strings)
|
|
130
|
-
})]
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
export function ThreadScreen({
|
|
134
|
-
theme,
|
|
135
|
-
strings,
|
|
136
|
-
thread,
|
|
137
|
-
onBack,
|
|
138
|
-
onSend
|
|
139
|
-
}) {
|
|
140
|
-
const [draft, setDraft] = useState('');
|
|
141
|
-
const [sending, setSending] = useState(false);
|
|
142
|
-
const [failedMessage, setFailedMessage] = useState(null);
|
|
143
|
-
const scrollRef = useRef(null);
|
|
144
|
-
// Captured once: opening the thread marks it read within a tick, but the
|
|
145
|
-
// "New" divider should stay put while the user is reading.
|
|
146
|
-
const [unreadOnOpen] = useState(thread.unread_count);
|
|
147
|
-
const resolved = thread.status === 'resolved';
|
|
148
|
-
const trimmed = draft.trim();
|
|
149
|
-
const valid = trimmed.length >= USER_MESSAGE_MIN && trimmed.length <= USER_MESSAGE_MAX;
|
|
150
|
-
const tooShort = trimmed.length > 0 && trimmed.length < USER_MESSAGE_MIN;
|
|
151
|
-
const rows = useMemo(() => buildRows(thread.messages, unreadOnOpen, strings), [thread.messages, unreadOnOpen, strings]);
|
|
152
|
-
useEffect(() => {
|
|
153
|
-
scrollRef.current?.scrollToEnd({
|
|
154
|
-
animated: false
|
|
155
|
-
});
|
|
156
|
-
}, [thread.messages.length]);
|
|
157
|
-
async function handleSend() {
|
|
158
|
-
if (!valid || sending || resolved) return;
|
|
159
|
-
setSending(true);
|
|
160
|
-
setFailedMessage(null);
|
|
161
|
-
const errorMessage = await onSend(trimmed);
|
|
162
|
-
setSending(false);
|
|
163
|
-
if (errorMessage === null) setDraft('');else setFailedMessage(errorMessage);
|
|
164
|
-
}
|
|
165
|
-
return /*#__PURE__*/_jsxs(KeyboardAvoidingView, {
|
|
166
|
-
style: {
|
|
167
|
-
flex: 1
|
|
168
|
-
},
|
|
169
|
-
behavior: Platform.OS === 'ios' ? 'padding' : undefined,
|
|
170
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
171
|
-
style: {
|
|
172
|
-
flexDirection: 'row',
|
|
173
|
-
alignItems: 'center',
|
|
174
|
-
gap: 10,
|
|
175
|
-
paddingHorizontal: 12,
|
|
176
|
-
paddingBottom: 12,
|
|
177
|
-
borderBottomWidth: 1,
|
|
178
|
-
borderBottomColor: theme.colors.border
|
|
179
|
-
},
|
|
180
|
-
children: [/*#__PURE__*/_jsx(IconButton, {
|
|
181
|
-
onPress: onBack,
|
|
182
|
-
theme: theme,
|
|
183
|
-
accessibilityLabel: strings.t('compose.back'),
|
|
184
|
-
size: 32,
|
|
185
|
-
children: /*#__PURE__*/_jsx(Chevron, {
|
|
186
|
-
color: theme.colors.textSecondary,
|
|
187
|
-
direction: "left",
|
|
188
|
-
size: 12
|
|
189
|
-
})
|
|
190
|
-
}), /*#__PURE__*/_jsx(TypeChipView, {
|
|
191
|
-
type: thread.type,
|
|
192
|
-
theme: theme,
|
|
193
|
-
strings: strings
|
|
194
|
-
}), /*#__PURE__*/_jsx(StatusIndicator, {
|
|
195
|
-
status: thread.status,
|
|
196
|
-
theme: theme,
|
|
197
|
-
strings: strings
|
|
198
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
199
|
-
style: [textStyles.meta(theme), {
|
|
200
|
-
marginLeft: 'auto'
|
|
201
|
-
}],
|
|
202
|
-
children: relativeTime(thread.created_at, strings)
|
|
203
|
-
})]
|
|
204
|
-
}), /*#__PURE__*/_jsxs(ScrollView, {
|
|
205
|
-
ref: scrollRef,
|
|
206
|
-
style: {
|
|
207
|
-
flex: 1
|
|
208
|
-
},
|
|
209
|
-
contentContainerStyle: {
|
|
210
|
-
paddingHorizontal: 16,
|
|
211
|
-
paddingVertical: 12
|
|
212
|
-
},
|
|
213
|
-
keyboardShouldPersistTaps: "handled",
|
|
214
|
-
onContentSizeChange: () => scrollRef.current?.scrollToEnd({
|
|
215
|
-
animated: false
|
|
216
|
-
}),
|
|
217
|
-
children: [rows.map(row => /*#__PURE__*/_jsxs(View, {
|
|
218
|
-
children: [row.day !== null && /*#__PURE__*/_jsx(Separator, {
|
|
219
|
-
label: row.day,
|
|
220
|
-
theme: theme
|
|
221
|
-
}), row.startsUnread && /*#__PURE__*/_jsx(Separator, {
|
|
222
|
-
label: strings.t('thread.new'),
|
|
223
|
-
theme: theme,
|
|
224
|
-
tone: "accent"
|
|
225
|
-
}), /*#__PURE__*/_jsx(MessageBubble, {
|
|
226
|
-
row: row,
|
|
227
|
-
theme: theme,
|
|
228
|
-
strings: strings
|
|
229
|
-
})]
|
|
230
|
-
}, row.message.id)), resolved && thread.resolved_at !== null && /*#__PURE__*/_jsx(View, {
|
|
231
|
-
style: {
|
|
232
|
-
marginTop: 16
|
|
233
|
-
},
|
|
234
|
-
children: /*#__PURE__*/_jsx(Separator, {
|
|
235
|
-
label: strings.t('thread.resolvedAt', {
|
|
236
|
-
date: formatDate(thread.resolved_at, strings)
|
|
237
|
-
}),
|
|
238
|
-
theme: theme
|
|
239
|
-
})
|
|
240
|
-
})]
|
|
241
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
242
|
-
style: {
|
|
243
|
-
borderTopWidth: 1,
|
|
244
|
-
borderTopColor: theme.colors.border,
|
|
245
|
-
paddingHorizontal: 16,
|
|
246
|
-
paddingTop: 10,
|
|
247
|
-
paddingBottom: 4
|
|
248
|
-
},
|
|
249
|
-
children: resolved ? /*#__PURE__*/_jsx(View, {
|
|
250
|
-
style: {
|
|
251
|
-
alignItems: 'center',
|
|
252
|
-
paddingVertical: 10,
|
|
253
|
-
borderRadius: theme.radii.control,
|
|
254
|
-
backgroundColor: theme.colors.surface
|
|
255
|
-
},
|
|
256
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
257
|
-
style: textStyles.secondary(theme),
|
|
258
|
-
children: strings.t('thread.readOnly')
|
|
259
|
-
})
|
|
260
|
-
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
261
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
262
|
-
style: {
|
|
263
|
-
flexDirection: 'row',
|
|
264
|
-
alignItems: 'flex-end',
|
|
265
|
-
gap: 10
|
|
266
|
-
},
|
|
267
|
-
children: [/*#__PURE__*/_jsx(TextInput, {
|
|
268
|
-
value: draft,
|
|
269
|
-
onChangeText: v => {
|
|
270
|
-
setDraft(v);
|
|
271
|
-
setFailedMessage(null);
|
|
272
|
-
},
|
|
273
|
-
multiline: true,
|
|
274
|
-
editable: !sending,
|
|
275
|
-
placeholder: strings.t('thread.placeholder'),
|
|
276
|
-
placeholderTextColor: theme.colors.textTertiary,
|
|
277
|
-
style: {
|
|
278
|
-
flex: 1,
|
|
279
|
-
minHeight: 44,
|
|
280
|
-
maxHeight: 120,
|
|
281
|
-
borderWidth: 1,
|
|
282
|
-
borderColor: theme.colors.border,
|
|
283
|
-
borderRadius: theme.radii.cardLg,
|
|
284
|
-
backgroundColor: theme.colors.surface,
|
|
285
|
-
color: theme.colors.textPrimary,
|
|
286
|
-
fontSize: 15,
|
|
287
|
-
lineHeight: 20,
|
|
288
|
-
paddingHorizontal: 14,
|
|
289
|
-
paddingTop: 12,
|
|
290
|
-
paddingBottom: 12,
|
|
291
|
-
textAlignVertical: 'top'
|
|
292
|
-
}
|
|
293
|
-
}), /*#__PURE__*/_jsx(IconButton, {
|
|
294
|
-
onPress: handleSend,
|
|
295
|
-
theme: theme,
|
|
296
|
-
tone: "accent",
|
|
297
|
-
size: 44,
|
|
298
|
-
disabled: !valid || sending,
|
|
299
|
-
accessibilityLabel: strings.t(sending ? 'thread.sendingA11y' : 'thread.sendA11y'),
|
|
300
|
-
children: /*#__PURE__*/_jsx(ArrowUpIcon, {
|
|
301
|
-
color: theme.colors.accentForeground,
|
|
302
|
-
size: 19
|
|
303
|
-
})
|
|
304
|
-
})]
|
|
305
|
-
}), (tooShort || draft.length >= COUNTER_VISIBLE_FROM || failedMessage !== null) && /*#__PURE__*/_jsxs(View, {
|
|
306
|
-
style: {
|
|
307
|
-
flexDirection: 'row',
|
|
308
|
-
alignItems: 'center',
|
|
309
|
-
gap: 10,
|
|
310
|
-
paddingTop: 8,
|
|
311
|
-
paddingHorizontal: 4
|
|
312
|
-
},
|
|
313
|
-
children: [failedMessage !== null ? /*#__PURE__*/_jsx(Text, {
|
|
314
|
-
style: {
|
|
315
|
-
fontSize: 12,
|
|
316
|
-
color: theme.colors.statusDanger
|
|
317
|
-
},
|
|
318
|
-
children: failedMessage
|
|
319
|
-
}) : tooShort ? /*#__PURE__*/_jsx(Text, {
|
|
320
|
-
style: textStyles.meta(theme),
|
|
321
|
-
children: strings.t('compose.minChars', {
|
|
322
|
-
count: USER_MESSAGE_MIN
|
|
323
|
-
})
|
|
324
|
-
}) : null, draft.length >= COUNTER_VISIBLE_FROM && /*#__PURE__*/_jsxs(Text, {
|
|
325
|
-
style: [textStyles.meta(theme), {
|
|
326
|
-
marginLeft: 'auto'
|
|
327
|
-
}, draft.length > USER_MESSAGE_MAX && {
|
|
328
|
-
color: theme.colors.statusDanger
|
|
329
|
-
}],
|
|
330
|
-
children: [draft.length, "/", USER_MESSAGE_MAX]
|
|
331
|
-
})]
|
|
332
|
-
})]
|
|
333
|
-
})
|
|
334
|
-
})]
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
//# sourceMappingURL=ThreadScreen.js.map
|