@appsupportkit/support-sdk 0.1.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 +93 -0
- package/lib/commonjs/api.js.map +1 -0
- package/lib/commonjs/components/BottomSheet.js +158 -0
- package/lib/commonjs/components/BottomSheet.js.map +1 -0
- package/lib/commonjs/components/SupportButton.js +244 -0
- package/lib/commonjs/components/SupportButton.js.map +1 -0
- package/lib/commonjs/components/icons.js +236 -0
- package/lib/commonjs/components/icons.js.map +1 -0
- package/lib/commonjs/components/primitives.js +284 -0
- package/lib/commonjs/components/primitives.js.map +1 -0
- package/lib/commonjs/components/screens/ComposeScreen.js +171 -0
- package/lib/commonjs/components/screens/ComposeScreen.js.map +1 -0
- package/lib/commonjs/components/screens/HomeScreen.js +227 -0
- package/lib/commonjs/components/screens/HomeScreen.js.map +1 -0
- package/lib/commonjs/components/screens/ThreadScreen.js +213 -0
- package/lib/commonjs/components/screens/ThreadScreen.js.map +1 -0
- package/lib/commonjs/index.js +58 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/theme.js +29 -0
- package/lib/commonjs/theme.js.map +1 -0
- package/lib/commonjs/types.js +14 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +63 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/api.js +84 -0
- package/lib/module/api.js.map +1 -0
- package/lib/module/components/BottomSheet.js +153 -0
- package/lib/module/components/BottomSheet.js.map +1 -0
- package/lib/module/components/SupportButton.js +240 -0
- package/lib/module/components/SupportButton.js.map +1 -0
- package/lib/module/components/icons.js +225 -0
- package/lib/module/components/icons.js.map +1 -0
- package/lib/module/components/primitives.js +270 -0
- package/lib/module/components/primitives.js.map +1 -0
- package/lib/module/components/screens/ComposeScreen.js +167 -0
- package/lib/module/components/screens/ComposeScreen.js.map +1 -0
- package/lib/module/components/screens/HomeScreen.js +223 -0
- package/lib/module/components/screens/HomeScreen.js.map +1 -0
- package/lib/module/components/screens/ThreadScreen.js +209 -0
- package/lib/module/components/screens/ThreadScreen.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/theme.js +23 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +10 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +57 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/api.d.ts +37 -0
- package/lib/typescript/api.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet.d.ts +9 -0
- package/lib/typescript/components/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/SupportButton.d.ts +8 -0
- package/lib/typescript/components/SupportButton.d.ts.map +1 -0
- package/lib/typescript/components/icons.d.ts +32 -0
- package/lib/typescript/components/icons.d.ts.map +1 -0
- package/lib/typescript/components/primitives.d.ts +60 -0
- package/lib/typescript/components/primitives.d.ts.map +1 -0
- package/lib/typescript/components/screens/ComposeScreen.d.ts +10 -0
- package/lib/typescript/components/screens/ComposeScreen.d.ts.map +1 -0
- package/lib/typescript/components/screens/HomeScreen.d.ts +13 -0
- package/lib/typescript/components/screens/HomeScreen.d.ts.map +1 -0
- package/lib/typescript/components/screens/ThreadScreen.d.ts +10 -0
- package/lib/typescript/components/screens/ThreadScreen.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/theme.d.ts +13 -0
- package/lib/typescript/theme.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +61 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils.d.ts +11 -0
- package/lib/typescript/utils.d.ts.map +1 -0
- package/package.json +51 -0
- package/src/api.ts +125 -0
- package/src/components/BottomSheet.tsx +173 -0
- package/src/components/SupportButton.tsx +265 -0
- package/src/components/icons.tsx +189 -0
- package/src/components/primitives.tsx +298 -0
- package/src/components/screens/ComposeScreen.tsx +163 -0
- package/src/components/screens/HomeScreen.tsx +234 -0
- package/src/components/screens/ThreadScreen.tsx +227 -0
- package/src/index.tsx +24 -0
- package/src/theme.ts +39 -0
- package/src/types.ts +71 -0
- package/src/utils.ts +63 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { Animated, Pressable, Text, View } from 'react-native';
|
|
5
|
+
import { QUERY_TYPE_LABEL } from '../types';
|
|
6
|
+
import { AlertCircleIcon, ChatIcon, PlusCircleIcon } from './icons';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export function typeIcon(type, color, size = 15) {
|
|
9
|
+
if (type === 'bug_report') return /*#__PURE__*/_jsx(AlertCircleIcon, {
|
|
10
|
+
color: color,
|
|
11
|
+
size: size
|
|
12
|
+
});
|
|
13
|
+
if (type === 'feature_request') return /*#__PURE__*/_jsx(PlusCircleIcon, {
|
|
14
|
+
color: color,
|
|
15
|
+
size: size
|
|
16
|
+
});
|
|
17
|
+
return /*#__PURE__*/_jsx(ChatIcon, {
|
|
18
|
+
color: color,
|
|
19
|
+
size: size
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function typeColor(type, theme) {
|
|
23
|
+
if (type === 'bug_report') return theme.colors.statusDanger;
|
|
24
|
+
if (type === 'feature_request') return theme.colors.statusProgress;
|
|
25
|
+
return theme.colors.statusOpen;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Status dot + label — same visual language as the dashboard. */
|
|
29
|
+
export function StatusIndicator({
|
|
30
|
+
status,
|
|
31
|
+
theme
|
|
32
|
+
}) {
|
|
33
|
+
const color = status === 'open' ? theme.colors.statusOpen : theme.colors.statusResolved;
|
|
34
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
35
|
+
style: {
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
gap: 6
|
|
39
|
+
},
|
|
40
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
41
|
+
style: {
|
|
42
|
+
width: 6,
|
|
43
|
+
height: 6,
|
|
44
|
+
borderRadius: 3,
|
|
45
|
+
backgroundColor: color
|
|
46
|
+
}
|
|
47
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
48
|
+
style: {
|
|
49
|
+
fontSize: 12,
|
|
50
|
+
color
|
|
51
|
+
},
|
|
52
|
+
children: status === 'open' ? 'Open' : 'Resolved'
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Pressable row with the standard hover/press wash. */
|
|
58
|
+
export function PressableRow({
|
|
59
|
+
onPress,
|
|
60
|
+
children,
|
|
61
|
+
theme,
|
|
62
|
+
style,
|
|
63
|
+
accessibilityLabel
|
|
64
|
+
}) {
|
|
65
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
66
|
+
onPress: onPress,
|
|
67
|
+
accessibilityRole: "button",
|
|
68
|
+
accessibilityLabel: accessibilityLabel,
|
|
69
|
+
style: ({
|
|
70
|
+
pressed
|
|
71
|
+
}) => [{
|
|
72
|
+
backgroundColor: pressed ? theme.colors.surfaceHover : 'transparent'
|
|
73
|
+
}, style],
|
|
74
|
+
children: children
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export function PrimaryButton({
|
|
78
|
+
label,
|
|
79
|
+
onPress,
|
|
80
|
+
disabled,
|
|
81
|
+
theme
|
|
82
|
+
}) {
|
|
83
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
84
|
+
onPress: onPress,
|
|
85
|
+
disabled: disabled,
|
|
86
|
+
accessibilityRole: "button",
|
|
87
|
+
style: ({
|
|
88
|
+
pressed
|
|
89
|
+
}) => ({
|
|
90
|
+
height: 36,
|
|
91
|
+
paddingHorizontal: 14,
|
|
92
|
+
borderRadius: theme.radii.control,
|
|
93
|
+
backgroundColor: pressed ? theme.colors.accentHover : theme.colors.accent,
|
|
94
|
+
opacity: disabled ? 0.5 : 1,
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
justifyContent: 'center'
|
|
97
|
+
}),
|
|
98
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
99
|
+
style: {
|
|
100
|
+
color: theme.colors.accentForeground,
|
|
101
|
+
fontSize: 13,
|
|
102
|
+
fontWeight: '500'
|
|
103
|
+
},
|
|
104
|
+
children: label
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export function SecondaryButton({
|
|
109
|
+
label,
|
|
110
|
+
onPress,
|
|
111
|
+
theme
|
|
112
|
+
}) {
|
|
113
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
114
|
+
onPress: onPress,
|
|
115
|
+
accessibilityRole: "button",
|
|
116
|
+
style: ({
|
|
117
|
+
pressed
|
|
118
|
+
}) => ({
|
|
119
|
+
height: 32,
|
|
120
|
+
paddingHorizontal: 12,
|
|
121
|
+
borderRadius: theme.radii.control,
|
|
122
|
+
borderWidth: 1,
|
|
123
|
+
borderColor: theme.colors.border,
|
|
124
|
+
backgroundColor: pressed ? theme.colors.surfaceHover : theme.colors.surface,
|
|
125
|
+
alignItems: 'center',
|
|
126
|
+
justifyContent: 'center'
|
|
127
|
+
}),
|
|
128
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
129
|
+
style: {
|
|
130
|
+
color: theme.colors.textPrimary,
|
|
131
|
+
fontSize: 12,
|
|
132
|
+
fontWeight: '500'
|
|
133
|
+
},
|
|
134
|
+
children: label
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Small muted icon + one line — no illustrations. */
|
|
140
|
+
export function EmptyState({
|
|
141
|
+
message,
|
|
142
|
+
theme,
|
|
143
|
+
icon
|
|
144
|
+
}) {
|
|
145
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
146
|
+
style: {
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
paddingVertical: 40,
|
|
149
|
+
gap: 8
|
|
150
|
+
},
|
|
151
|
+
children: [icon ?? /*#__PURE__*/_jsx(ChatIcon, {
|
|
152
|
+
color: theme.colors.textTertiary,
|
|
153
|
+
size: 16
|
|
154
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
155
|
+
style: {
|
|
156
|
+
fontSize: 13,
|
|
157
|
+
color: theme.colors.textSecondary
|
|
158
|
+
},
|
|
159
|
+
children: message
|
|
160
|
+
})]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Inline failure state with retry — errors are designed, not toasted. */
|
|
165
|
+
export function ErrorState({
|
|
166
|
+
message,
|
|
167
|
+
onRetry,
|
|
168
|
+
theme
|
|
169
|
+
}) {
|
|
170
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
171
|
+
style: {
|
|
172
|
+
alignItems: 'center',
|
|
173
|
+
paddingVertical: 32,
|
|
174
|
+
gap: 10
|
|
175
|
+
},
|
|
176
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
177
|
+
style: {
|
|
178
|
+
fontSize: 13,
|
|
179
|
+
color: theme.colors.textSecondary
|
|
180
|
+
},
|
|
181
|
+
children: message
|
|
182
|
+
}), /*#__PURE__*/_jsx(SecondaryButton, {
|
|
183
|
+
label: "Retry",
|
|
184
|
+
onPress: onRetry,
|
|
185
|
+
theme: theme
|
|
186
|
+
})]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Pulsing block matching final layout dimensions. */
|
|
191
|
+
export function SkeletonBlock({
|
|
192
|
+
width,
|
|
193
|
+
height,
|
|
194
|
+
theme,
|
|
195
|
+
style
|
|
196
|
+
}) {
|
|
197
|
+
const opacity = useRef(new Animated.Value(0.5)).current;
|
|
198
|
+
useEffect(() => {
|
|
199
|
+
const loop = Animated.loop(Animated.sequence([Animated.timing(opacity, {
|
|
200
|
+
toValue: 1,
|
|
201
|
+
duration: 600,
|
|
202
|
+
useNativeDriver: true
|
|
203
|
+
}), Animated.timing(opacity, {
|
|
204
|
+
toValue: 0.5,
|
|
205
|
+
duration: 600,
|
|
206
|
+
useNativeDriver: true
|
|
207
|
+
})]));
|
|
208
|
+
loop.start();
|
|
209
|
+
return () => loop.stop();
|
|
210
|
+
}, [opacity]);
|
|
211
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
212
|
+
style: [{
|
|
213
|
+
width,
|
|
214
|
+
height,
|
|
215
|
+
borderRadius: theme.radii.control,
|
|
216
|
+
backgroundColor: theme.colors.surfaceActive,
|
|
217
|
+
opacity
|
|
218
|
+
}, style]
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
export const textStyles = {
|
|
222
|
+
title: theme => ({
|
|
223
|
+
fontSize: 16,
|
|
224
|
+
fontWeight: '600',
|
|
225
|
+
letterSpacing: -0.2,
|
|
226
|
+
color: theme.colors.textPrimary
|
|
227
|
+
}),
|
|
228
|
+
body: theme => ({
|
|
229
|
+
fontSize: 14,
|
|
230
|
+
color: theme.colors.textPrimary,
|
|
231
|
+
lineHeight: 20
|
|
232
|
+
}),
|
|
233
|
+
secondary: theme => ({
|
|
234
|
+
fontSize: 13,
|
|
235
|
+
color: theme.colors.textSecondary
|
|
236
|
+
}),
|
|
237
|
+
meta: theme => ({
|
|
238
|
+
fontSize: 11,
|
|
239
|
+
color: theme.colors.textTertiary,
|
|
240
|
+
fontVariant: ['tabular-nums']
|
|
241
|
+
})
|
|
242
|
+
};
|
|
243
|
+
export function TypeChipView({
|
|
244
|
+
type,
|
|
245
|
+
theme
|
|
246
|
+
}) {
|
|
247
|
+
const color = typeColor(type, theme);
|
|
248
|
+
const bg = type === 'bug_report' ? theme.colors.statusDangerBg : type === 'feature_request' ? theme.colors.statusProgressBg : theme.colors.statusOpenBg;
|
|
249
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
250
|
+
style: {
|
|
251
|
+
flexDirection: 'row',
|
|
252
|
+
alignItems: 'center',
|
|
253
|
+
gap: 5,
|
|
254
|
+
paddingHorizontal: 6,
|
|
255
|
+
paddingVertical: 2,
|
|
256
|
+
borderRadius: theme.radii.control,
|
|
257
|
+
backgroundColor: bg,
|
|
258
|
+
alignSelf: 'flex-start'
|
|
259
|
+
},
|
|
260
|
+
children: [typeIcon(type, color, 11), /*#__PURE__*/_jsx(Text, {
|
|
261
|
+
style: {
|
|
262
|
+
fontSize: 11,
|
|
263
|
+
fontWeight: '500',
|
|
264
|
+
color
|
|
265
|
+
},
|
|
266
|
+
children: QUERY_TYPE_LABEL[type]
|
|
267
|
+
})]
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=primitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","Animated","Pressable","Text","View","QUERY_TYPE_LABEL","AlertCircleIcon","ChatIcon","PlusCircleIcon","jsx","_jsx","jsxs","_jsxs","typeIcon","type","color","size","typeColor","theme","colors","statusDanger","statusProgress","statusOpen","StatusIndicator","status","statusResolved","style","flexDirection","alignItems","gap","children","width","height","borderRadius","backgroundColor","fontSize","PressableRow","onPress","accessibilityLabel","accessibilityRole","pressed","surfaceHover","PrimaryButton","label","disabled","paddingHorizontal","radii","control","accentHover","accent","opacity","justifyContent","accentForeground","fontWeight","SecondaryButton","borderWidth","borderColor","border","surface","textPrimary","EmptyState","message","icon","paddingVertical","textTertiary","textSecondary","ErrorState","onRetry","SkeletonBlock","Value","current","loop","sequence","timing","toValue","duration","useNativeDriver","start","stop","surfaceActive","textStyles","title","letterSpacing","body","lineHeight","secondary","meta","fontVariant","TypeChipView","bg","statusDangerBg","statusProgressBg","statusOpenBg","alignSelf"],"sourceRoot":"../../../src","sources":["components/primitives.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAwB,OAAO;AACzD,SACEC,QAAQ,EACRC,SAAS,EACTC,IAAI,EACJC,IAAI,QAIC,cAAc;AAGrB,SA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State } from 'react';
|
|
4
|
+
import { KeyboardAvoidingView, Platform, Text, TextInput, View } from 'react-native';
|
|
5
|
+
import { QUERY_TYPE_LABEL, USER_MESSAGE_MAX, USER_MESSAGE_MIN } from '../../types';
|
|
6
|
+
import { CheckIcon, Chevron } from '../icons';
|
|
7
|
+
import { PressableRow, PrimaryButton, textStyles } from '../primitives';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export function ComposeScreen({
|
|
10
|
+
theme,
|
|
11
|
+
type,
|
|
12
|
+
onBack,
|
|
13
|
+
onSubmit
|
|
14
|
+
}) {
|
|
15
|
+
const [message, setMessage] = useState('');
|
|
16
|
+
const [submitting, setSubmitting] = useState(false);
|
|
17
|
+
const [failed, setFailed] = useState(false);
|
|
18
|
+
const [sent, setSent] = useState(false);
|
|
19
|
+
const trimmed = message.trim();
|
|
20
|
+
const valid = trimmed.length >= USER_MESSAGE_MIN && trimmed.length <= USER_MESSAGE_MAX;
|
|
21
|
+
const overLimit = message.length > USER_MESSAGE_MAX;
|
|
22
|
+
async function handleSubmit() {
|
|
23
|
+
if (!valid || submitting) return;
|
|
24
|
+
setSubmitting(true);
|
|
25
|
+
setFailed(false);
|
|
26
|
+
const ok = await onSubmit(trimmed);
|
|
27
|
+
setSubmitting(false);
|
|
28
|
+
if (ok) setSent(true);else setFailed(true);
|
|
29
|
+
}
|
|
30
|
+
if (sent) {
|
|
31
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
32
|
+
style: {
|
|
33
|
+
flex: 1,
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
gap: 12,
|
|
37
|
+
padding: 24
|
|
38
|
+
},
|
|
39
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
40
|
+
style: {
|
|
41
|
+
width: 40,
|
|
42
|
+
height: 40,
|
|
43
|
+
borderRadius: 20,
|
|
44
|
+
borderWidth: 1,
|
|
45
|
+
borderColor: theme.colors.statusResolved,
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
justifyContent: 'center'
|
|
48
|
+
},
|
|
49
|
+
children: /*#__PURE__*/_jsx(CheckIcon, {
|
|
50
|
+
color: theme.colors.statusResolved,
|
|
51
|
+
size: 14
|
|
52
|
+
})
|
|
53
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
54
|
+
style: textStyles.body(theme),
|
|
55
|
+
children: "Sent"
|
|
56
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
57
|
+
style: [textStyles.secondary(theme), {
|
|
58
|
+
textAlign: 'center'
|
|
59
|
+
}],
|
|
60
|
+
children: "We'll reply here. You'll see the thread under Open."
|
|
61
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
62
|
+
style: {
|
|
63
|
+
marginTop: 8
|
|
64
|
+
},
|
|
65
|
+
children: /*#__PURE__*/_jsx(PrimaryButton, {
|
|
66
|
+
label: "Done",
|
|
67
|
+
onPress: onBack,
|
|
68
|
+
theme: theme
|
|
69
|
+
})
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return /*#__PURE__*/_jsxs(KeyboardAvoidingView, {
|
|
74
|
+
style: {
|
|
75
|
+
flex: 1
|
|
76
|
+
},
|
|
77
|
+
behavior: Platform.OS === 'ios' ? 'padding' : undefined,
|
|
78
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
79
|
+
style: {
|
|
80
|
+
flexDirection: 'row',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
gap: 8,
|
|
83
|
+
paddingHorizontal: 12,
|
|
84
|
+
paddingBottom: 12
|
|
85
|
+
},
|
|
86
|
+
children: [/*#__PURE__*/_jsx(PressableRow, {
|
|
87
|
+
onPress: onBack,
|
|
88
|
+
theme: theme,
|
|
89
|
+
accessibilityLabel: "Back",
|
|
90
|
+
style: {
|
|
91
|
+
padding: 6,
|
|
92
|
+
borderRadius: theme.radii.control
|
|
93
|
+
},
|
|
94
|
+
children: /*#__PURE__*/_jsx(Chevron, {
|
|
95
|
+
color: theme.colors.textSecondary,
|
|
96
|
+
direction: "left",
|
|
97
|
+
size: 12
|
|
98
|
+
})
|
|
99
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
100
|
+
style: textStyles.title(theme),
|
|
101
|
+
children: QUERY_TYPE_LABEL[type]
|
|
102
|
+
})]
|
|
103
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
104
|
+
style: {
|
|
105
|
+
flex: 1,
|
|
106
|
+
paddingHorizontal: 16
|
|
107
|
+
},
|
|
108
|
+
children: [/*#__PURE__*/_jsx(TextInput, {
|
|
109
|
+
value: message,
|
|
110
|
+
onChangeText: v => {
|
|
111
|
+
setMessage(v);
|
|
112
|
+
setFailed(false);
|
|
113
|
+
},
|
|
114
|
+
multiline: true,
|
|
115
|
+
autoFocus: true,
|
|
116
|
+
placeholder: type === 'bug_report' ? 'What happened, and what did you expect?' : type === 'feature_request' ? 'What would you like to see?' : 'What should we know?',
|
|
117
|
+
placeholderTextColor: theme.colors.textTertiary,
|
|
118
|
+
style: {
|
|
119
|
+
minHeight: 120,
|
|
120
|
+
maxHeight: 220,
|
|
121
|
+
borderWidth: 1,
|
|
122
|
+
borderColor: theme.colors.border,
|
|
123
|
+
borderRadius: theme.radii.control,
|
|
124
|
+
backgroundColor: theme.colors.surface,
|
|
125
|
+
color: theme.colors.textPrimary,
|
|
126
|
+
fontSize: 14,
|
|
127
|
+
lineHeight: 20,
|
|
128
|
+
padding: 12,
|
|
129
|
+
textAlignVertical: 'top'
|
|
130
|
+
}
|
|
131
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
132
|
+
style: {
|
|
133
|
+
flexDirection: 'row',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
marginTop: 8,
|
|
136
|
+
gap: 12
|
|
137
|
+
},
|
|
138
|
+
children: [/*#__PURE__*/_jsxs(Text, {
|
|
139
|
+
style: [textStyles.meta(theme), overLimit && {
|
|
140
|
+
color: theme.colors.statusDanger
|
|
141
|
+
}],
|
|
142
|
+
children: [message.length, "/", USER_MESSAGE_MAX]
|
|
143
|
+
}), trimmed.length > 0 && trimmed.length < USER_MESSAGE_MIN && /*#__PURE__*/_jsxs(Text, {
|
|
144
|
+
style: textStyles.meta(theme),
|
|
145
|
+
children: ["At least ", USER_MESSAGE_MIN, " characters"]
|
|
146
|
+
}), failed && /*#__PURE__*/_jsx(Text, {
|
|
147
|
+
style: {
|
|
148
|
+
fontSize: 11,
|
|
149
|
+
color: theme.colors.statusDanger
|
|
150
|
+
},
|
|
151
|
+
children: "Couldn't send \u2014 try again"
|
|
152
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
153
|
+
style: {
|
|
154
|
+
marginLeft: 'auto'
|
|
155
|
+
},
|
|
156
|
+
children: /*#__PURE__*/_jsx(PrimaryButton, {
|
|
157
|
+
label: submitting ? 'Sending…' : 'Send',
|
|
158
|
+
onPress: handleSubmit,
|
|
159
|
+
disabled: !valid || submitting,
|
|
160
|
+
theme: theme
|
|
161
|
+
})
|
|
162
|
+
})]
|
|
163
|
+
})]
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=ComposeScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useState","KeyboardAvoidingView","Platform","Text","TextInput","View","QUERY_TYPE_LABEL","USER_MESSAGE_MAX","USER_MESSAGE_MIN","CheckIcon","Chevron","PressableRow","PrimaryButton","textStyles","jsx","_jsx","jsxs","_jsxs","ComposeScreen","theme","type","onBack","onSubmit","message","setMessage","submitting","setSubmitting","failed","setFailed","sent","setSent","trimmed","trim","valid","length","overLimit","handleSubmit","ok","style","flex","alignItems","justifyContent","gap","padding","children","width","height","borderRadius","borderWidth","borderColor","colors","statusResolved","color","size","body","secondary","textAlign","marginTop","label","onPress","behavior","OS","undefined","flexDirection","paddingHorizontal","paddingBottom","accessibilityLabel","radii","control","textSecondary","direction","title","value","onChangeText","v","multiline","autoFocus","placeholder","placeholderTextColor","textTertiary","minHeight","maxHeight","border","backgroundColor","surface","textPrimary","fontSize","lineHeight","textAlignVertical","meta","statusDanger","marginLeft","disabled"],"sourceRoot":"../../../../src","sources":["components/screens/ComposeScreen.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SAASC,oBAAoB,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAGpF,SAASC,gBAAgB,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,aAAa;AAClF,SAASC,SAAS,EAAEC,OAAO,QAAQ,UAAU;AAC7C,SAASC,YAAY,EAAEC,aAAa,EAAEC,UAAU,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExE,OAAO,SAASC,aAAaA,CAAC;EAC5BC,KAAK;EACLC,IAAI;EACJC,MAAM;EACNC;AAOF,CAAC,EAAE;EACD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGxB,QAAQ,CAAC,EAAE,CAAC;EAC1C,MAAM,CAACyB,UAAU,EAAEC,aAAa,CAAC,GAAG1B,QAAQ,CAAC,KAAK,CAAC;EACnD,MAAM,CAAC2B,MAAM,EAAEC,SAAS,CAAC,GAAG5B,QAAQ,CAAC,KAAK,CAAC;EAC3C,MAAM,CAAC6B,IAAI,EAAEC,OAAO,CAAC,GAAG9B,QAAQ,CAAC,KAAK,CAAC;EAEvC,MAAM+B,OAAO,GAAGR,OAAO,CAACS,IAAI,CAAC,CAAC;EAC9B,MAAMC,KAAK,GACTF,OAAO,CAACG,MAAM,IAAI1B,gBAAgB,IAAIuB,OAAO,CAACG,MAAM,IAAI3B,gBAAgB;EAC1E,MAAM4B,SAAS,GAAGZ,OAAO,CAACW,MAAM,GAAG3B,gBAAgB;EAEnD,eAAe6B,YAAYA,CAAA,EAAG;IAC5B,IAAI,CAACH,KAAK,IAAIR,UAAU,EAAE;IAC1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,CAAC,EACNwB,OAAO,CAACG,MAAM,GAAG,CAAC,IAAIH,OAAO,CAACG,MAAM,GAAG1B,gBAAgB,iBACtDS,KAAA,CAACd,IAAI;UAACmC,KAAK,EAAEzB,UAAU,CAAC4E,IAAI,CAACtE,KAAK,CAAE;UAAAyB,QAAA,GAAC,WAC1B,EAACpC,gBAAgB,EAAC,aAC7B;QAAA,CAAM,CACP,EACAmB,MAAM,iBACLZ,IAAA,CAACZ,IAAI;UAACmC,KAAK,EAAE;YAAEgD,QAAQ,EAAE,EAAE;YAAElC,KAAK,EAAEjC,KAAK,CAAC+B,MAAM,CAACwC;UAAa,CAAE;UAAA9C,QAAA,EAAC;QAEjE,CAAM,CACP,eACD7B,IAAA,CAACV,IAAI;UAACiC,KAAK,EAAE;YAAEqD,UAAU,EAAE;UAAO,CAAE;UAAA/C,QAAA,eAClC7B,IAAA,CAACH,aAAa;YACZ8C,KAAK,EAAEjC,UAAU,GAAG,UAAU,GAAG,MAAO;YACxCkC,OAAO,EAAEvB,YAAa;YACtBwD,QAAQ,EAAE,CAAC3D,KAAK,IAAIR,UAAW;YAC/BN,KAAK,EAAEA;UAAM,CACd;QAAC,CACE,CAAC;MAAA,CACH,CAAC;IAAA,CACH,CAAC;EAAA,CACa,CAAC;AAE3B","ignoreList":[]}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { ScrollView, Text, View } from 'react-native';
|
|
4
|
+
import { QUERY_TYPE_LABEL } from '../../types';
|
|
5
|
+
import { relativeTime } from '../../utils';
|
|
6
|
+
import { Chevron, CloseIcon } from '../icons';
|
|
7
|
+
import { EmptyState, ErrorState, PressableRow, SkeletonBlock, textStyles, typeColor, typeIcon } 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
|
+
onPress
|
|
14
|
+
}) {
|
|
15
|
+
const preview = thread.last_message?.body ?? '';
|
|
16
|
+
return /*#__PURE__*/_jsxs(PressableRow, {
|
|
17
|
+
onPress: onPress,
|
|
18
|
+
theme: theme,
|
|
19
|
+
accessibilityLabel: `${QUERY_TYPE_LABEL[thread.type]} thread`,
|
|
20
|
+
style: {
|
|
21
|
+
paddingHorizontal: 16,
|
|
22
|
+
paddingVertical: 10,
|
|
23
|
+
borderBottomWidth: 1,
|
|
24
|
+
borderBottomColor: theme.colors.border
|
|
25
|
+
},
|
|
26
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
27
|
+
style: {
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
gap: 8
|
|
31
|
+
},
|
|
32
|
+
children: [thread.unread_count > 0 && /*#__PURE__*/_jsx(View, {
|
|
33
|
+
style: {
|
|
34
|
+
width: 6,
|
|
35
|
+
height: 6,
|
|
36
|
+
borderRadius: 3,
|
|
37
|
+
backgroundColor: theme.colors.accent
|
|
38
|
+
}
|
|
39
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
40
|
+
style: {
|
|
41
|
+
fontSize: 11,
|
|
42
|
+
fontWeight: '500',
|
|
43
|
+
color: typeColor(thread.type, theme)
|
|
44
|
+
},
|
|
45
|
+
children: QUERY_TYPE_LABEL[thread.type]
|
|
46
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
47
|
+
style: [textStyles.meta(theme), {
|
|
48
|
+
marginLeft: 'auto'
|
|
49
|
+
}],
|
|
50
|
+
children: thread.last_message ? relativeTime(thread.last_message.created_at) : relativeTime(thread.created_at)
|
|
51
|
+
})]
|
|
52
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
53
|
+
style: {
|
|
54
|
+
flexDirection: 'row',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
gap: 8,
|
|
57
|
+
marginTop: 3
|
|
58
|
+
},
|
|
59
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
60
|
+
numberOfLines: 1,
|
|
61
|
+
style: {
|
|
62
|
+
flex: 1,
|
|
63
|
+
fontSize: 13,
|
|
64
|
+
color: thread.unread_count > 0 ? theme.colors.textPrimary : theme.colors.textSecondary,
|
|
65
|
+
fontWeight: thread.unread_count > 0 ? '500' : '400'
|
|
66
|
+
},
|
|
67
|
+
children: preview
|
|
68
|
+
}), /*#__PURE__*/_jsx(Chevron, {
|
|
69
|
+
color: theme.colors.textTertiary
|
|
70
|
+
})]
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export function HomeScreen({
|
|
75
|
+
theme,
|
|
76
|
+
threads,
|
|
77
|
+
loading,
|
|
78
|
+
error,
|
|
79
|
+
onRetry,
|
|
80
|
+
onCompose,
|
|
81
|
+
onOpenThread,
|
|
82
|
+
onClose
|
|
83
|
+
}) {
|
|
84
|
+
const open = (threads ?? []).filter(t => t.status === 'open');
|
|
85
|
+
const resolved = (threads ?? []).filter(t => t.status === 'resolved');
|
|
86
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
87
|
+
style: {
|
|
88
|
+
flex: 1
|
|
89
|
+
},
|
|
90
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
91
|
+
style: {
|
|
92
|
+
flexDirection: 'row',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
paddingHorizontal: 16,
|
|
95
|
+
paddingBottom: 12
|
|
96
|
+
},
|
|
97
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
98
|
+
style: textStyles.title(theme),
|
|
99
|
+
children: "Support"
|
|
100
|
+
}), /*#__PURE__*/_jsx(PressableRow, {
|
|
101
|
+
onPress: onClose,
|
|
102
|
+
theme: theme,
|
|
103
|
+
accessibilityLabel: "Close",
|
|
104
|
+
style: {
|
|
105
|
+
marginLeft: 'auto',
|
|
106
|
+
padding: 6,
|
|
107
|
+
borderRadius: theme.radii.control
|
|
108
|
+
},
|
|
109
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
110
|
+
color: theme.colors.textSecondary,
|
|
111
|
+
size: 13
|
|
112
|
+
})
|
|
113
|
+
})]
|
|
114
|
+
}), /*#__PURE__*/_jsxs(ScrollView, {
|
|
115
|
+
style: {
|
|
116
|
+
flex: 1
|
|
117
|
+
},
|
|
118
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
119
|
+
style: {
|
|
120
|
+
marginHorizontal: 16,
|
|
121
|
+
borderWidth: 1,
|
|
122
|
+
borderColor: theme.colors.border,
|
|
123
|
+
borderRadius: theme.radii.card,
|
|
124
|
+
backgroundColor: theme.colors.surface,
|
|
125
|
+
overflow: 'hidden'
|
|
126
|
+
},
|
|
127
|
+
children: COMPOSE_TYPES.map((type, i) => /*#__PURE__*/_jsxs(PressableRow, {
|
|
128
|
+
onPress: () => onCompose(type),
|
|
129
|
+
theme: theme,
|
|
130
|
+
accessibilityLabel: `New ${QUERY_TYPE_LABEL[type].toLowerCase()}`,
|
|
131
|
+
style: {
|
|
132
|
+
flexDirection: 'row',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
gap: 10,
|
|
135
|
+
paddingHorizontal: 14,
|
|
136
|
+
paddingVertical: 12,
|
|
137
|
+
borderTopWidth: i === 0 ? 0 : 1,
|
|
138
|
+
borderTopColor: theme.colors.border
|
|
139
|
+
},
|
|
140
|
+
children: [typeIcon(type, typeColor(type, theme)), /*#__PURE__*/_jsx(Text, {
|
|
141
|
+
style: {
|
|
142
|
+
fontSize: 14,
|
|
143
|
+
color: theme.colors.textPrimary,
|
|
144
|
+
flex: 1
|
|
145
|
+
},
|
|
146
|
+
children: QUERY_TYPE_LABEL[type]
|
|
147
|
+
}), /*#__PURE__*/_jsx(Chevron, {
|
|
148
|
+
color: theme.colors.textTertiary
|
|
149
|
+
})]
|
|
150
|
+
}, type))
|
|
151
|
+
}), error ? /*#__PURE__*/_jsx(ErrorState, {
|
|
152
|
+
message: error,
|
|
153
|
+
onRetry: onRetry,
|
|
154
|
+
theme: theme
|
|
155
|
+
}) : loading && threads === null ? /*#__PURE__*/_jsxs(View, {
|
|
156
|
+
style: {
|
|
157
|
+
paddingHorizontal: 16,
|
|
158
|
+
paddingTop: 24,
|
|
159
|
+
gap: 14
|
|
160
|
+
},
|
|
161
|
+
children: [/*#__PURE__*/_jsx(SkeletonBlock, {
|
|
162
|
+
width: 80,
|
|
163
|
+
height: 12,
|
|
164
|
+
theme: theme
|
|
165
|
+
}), /*#__PURE__*/_jsx(SkeletonBlock, {
|
|
166
|
+
width: "100%",
|
|
167
|
+
height: 40,
|
|
168
|
+
theme: theme
|
|
169
|
+
}), /*#__PURE__*/_jsx(SkeletonBlock, {
|
|
170
|
+
width: "100%",
|
|
171
|
+
height: 40,
|
|
172
|
+
theme: theme
|
|
173
|
+
})]
|
|
174
|
+
}) : (threads ?? []).length === 0 ? /*#__PURE__*/_jsx(EmptyState, {
|
|
175
|
+
message: "No queries yet",
|
|
176
|
+
theme: theme
|
|
177
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
178
|
+
children: [open.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
179
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
180
|
+
style: {
|
|
181
|
+
fontSize: 11,
|
|
182
|
+
fontWeight: '500',
|
|
183
|
+
textTransform: 'uppercase',
|
|
184
|
+
letterSpacing: 0.4,
|
|
185
|
+
color: theme.colors.textTertiary,
|
|
186
|
+
paddingHorizontal: 16,
|
|
187
|
+
paddingTop: 20,
|
|
188
|
+
paddingBottom: 6
|
|
189
|
+
},
|
|
190
|
+
children: "Open"
|
|
191
|
+
}), open.map(t => /*#__PURE__*/_jsx(ThreadRow, {
|
|
192
|
+
thread: t,
|
|
193
|
+
theme: theme,
|
|
194
|
+
onPress: () => onOpenThread(t)
|
|
195
|
+
}, t.id))]
|
|
196
|
+
}), resolved.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
197
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
198
|
+
style: {
|
|
199
|
+
fontSize: 11,
|
|
200
|
+
fontWeight: '500',
|
|
201
|
+
textTransform: 'uppercase',
|
|
202
|
+
letterSpacing: 0.4,
|
|
203
|
+
color: theme.colors.textTertiary,
|
|
204
|
+
paddingHorizontal: 16,
|
|
205
|
+
paddingTop: 20,
|
|
206
|
+
paddingBottom: 6
|
|
207
|
+
},
|
|
208
|
+
children: "Resolved"
|
|
209
|
+
}), resolved.map(t => /*#__PURE__*/_jsx(ThreadRow, {
|
|
210
|
+
thread: t,
|
|
211
|
+
theme: theme,
|
|
212
|
+
onPress: () => onOpenThread(t)
|
|
213
|
+
}, t.id))]
|
|
214
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
215
|
+
style: {
|
|
216
|
+
height: 16
|
|
217
|
+
}
|
|
218
|
+
})]
|
|
219
|
+
})]
|
|
220
|
+
})]
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=HomeScreen.js.map
|