tf-checkout-react-native 2.0.0-beta.8 → 2.0.0-beta.9
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/dist/index.d.mts +62 -3
- package/dist/index.d.ts +62 -3
- package/dist/index.js +583 -313
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +583 -313
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/sections/EventDiscussionView.tsx +55 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tf-checkout-react-native",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.9",
|
|
4
4
|
"description": "TheTicketFairy ReactNative Checkout library",
|
|
5
5
|
"homepage": "https://github.com/theticketfairy/tf-shared-libraries#readme",
|
|
6
6
|
"author": "The Ticket Fairy",
|
|
@@ -144,11 +144,13 @@ const EventDiscussionBody = ({
|
|
|
144
144
|
<View style={s.authorRow}>
|
|
145
145
|
<Text style={[muted, s.author]}>
|
|
146
146
|
{comment.author.name}
|
|
147
|
-
{own ? ' (you)' : ''}
|
|
147
|
+
{own ? t(' (you)') : ''}
|
|
148
148
|
</Text>
|
|
149
149
|
<Pressable
|
|
150
150
|
accessibilityRole="button"
|
|
151
|
-
accessibilityLabel={
|
|
151
|
+
accessibilityLabel={t('Actions for comment by {{name}}', {
|
|
152
|
+
name: comment.author.name,
|
|
153
|
+
})}
|
|
152
154
|
hitSlop={10}
|
|
153
155
|
onPress={() => setActions(comment)}
|
|
154
156
|
>
|
|
@@ -177,27 +179,27 @@ const EventDiscussionBody = ({
|
|
|
177
179
|
renderCloseIcon={renderImageCloseIcon}
|
|
178
180
|
/>
|
|
179
181
|
<Text selectable style={[text, s.body]}>
|
|
180
|
-
{comment.status === 'deleted' ? 'Comment removed' : comment.body}
|
|
182
|
+
{comment.status === 'deleted' ? t('Comment removed') : comment.body}
|
|
181
183
|
</Text>
|
|
182
184
|
{comment.status === 'pending' && (
|
|
183
185
|
<Text accessibilityLiveRegion="polite" style={[muted, s.pending]}>
|
|
184
|
-
Awaiting review
|
|
186
|
+
{t('Awaiting review')}
|
|
185
187
|
</Text>
|
|
186
188
|
)}
|
|
187
189
|
{comment.status === 'hidden' && (
|
|
188
|
-
<Text style={[muted, s.pending]}>Hidden</Text>
|
|
190
|
+
<Text style={[muted, s.pending]}>{t('Hidden')}</Text>
|
|
189
191
|
)}
|
|
190
192
|
<View style={s.meta}>
|
|
191
193
|
<Text style={[muted, s.date]}>
|
|
192
194
|
{new Date(comment.createdAt).toLocaleString()}
|
|
193
|
-
{comment.editedAt ? ' ·
|
|
195
|
+
{comment.editedAt ? t(' · edited') : ''}
|
|
194
196
|
</Text>
|
|
195
197
|
{(['up', 'down'] as const).map((reaction) => (
|
|
196
198
|
<Pressable
|
|
197
199
|
key={reaction}
|
|
198
200
|
accessibilityRole="button"
|
|
199
201
|
accessibilityLabel={
|
|
200
|
-
reaction === 'up' ? 'Like comment' : 'Dislike comment'
|
|
202
|
+
reaction === 'up' ? t('Like comment') : t('Dislike comment')
|
|
201
203
|
}
|
|
202
204
|
accessibilityState={{
|
|
203
205
|
selected: comment.reactions.mine === reaction,
|
|
@@ -243,8 +245,12 @@ const EventDiscussionBody = ({
|
|
|
243
245
|
onPress={() => d.replyTo(comment)}
|
|
244
246
|
>
|
|
245
247
|
<Text style={[muted, s.pending]}>
|
|
246
|
-
{
|
|
247
|
-
|
|
248
|
+
{t(
|
|
249
|
+
comment.replyCount === 1
|
|
250
|
+
? '{{count}} reply · Reply'
|
|
251
|
+
: '{{count}} replies · Reply',
|
|
252
|
+
{ count: comment.replyCount }
|
|
253
|
+
)}
|
|
248
254
|
</Text>
|
|
249
255
|
</Pressable>
|
|
250
256
|
)}
|
|
@@ -253,16 +259,20 @@ const EventDiscussionBody = ({
|
|
|
253
259
|
</SwipeReply>
|
|
254
260
|
)
|
|
255
261
|
}
|
|
256
|
-
const actionButton = (
|
|
262
|
+
const actionButton = (
|
|
263
|
+
label: string,
|
|
264
|
+
onPress: () => void,
|
|
265
|
+
vars?: Record<string, string | number>
|
|
266
|
+
) => (
|
|
257
267
|
<Pressable key={label} accessibilityRole="button" onPress={onPress} style={s.action}>
|
|
258
|
-
<Text style={text}>{t(label)}</Text>
|
|
268
|
+
<Text style={text}>{t(label, vars)}</Text>
|
|
259
269
|
</Pressable>
|
|
260
270
|
)
|
|
261
271
|
const sheet = (visible: boolean, close: () => void, children: React.ReactNode) => (
|
|
262
272
|
<Modal transparent animationType="slide" visible={visible} onRequestClose={close}>
|
|
263
273
|
<View style={s.overlay}>
|
|
264
274
|
<Pressable
|
|
265
|
-
accessibilityLabel=
|
|
275
|
+
accessibilityLabel={t('Close menu')}
|
|
266
276
|
style={StyleSheet.absoluteFill}
|
|
267
277
|
onPress={close}
|
|
268
278
|
/>
|
|
@@ -293,7 +303,7 @@ const EventDiscussionBody = ({
|
|
|
293
303
|
onPress={() => setBlocksVisible(true)}
|
|
294
304
|
style={s.blocked}
|
|
295
305
|
>
|
|
296
|
-
<Text style={muted}>Blocked people</Text>
|
|
306
|
+
<Text style={muted}>{t('Blocked people')}</Text>
|
|
297
307
|
</Pressable>
|
|
298
308
|
)}
|
|
299
309
|
{d.isLoading ? (
|
|
@@ -317,7 +327,7 @@ const EventDiscussionBody = ({
|
|
|
317
327
|
d.hasMore ? actionButton('Earlier comments', d.loadMore) : null
|
|
318
328
|
}
|
|
319
329
|
ListEmptyComponent={
|
|
320
|
-
<Text style={[muted, s.empty]}>Be the first to leave a comment
|
|
330
|
+
<Text style={[muted, s.empty]}>{t('Be the first to leave a comment.')}</Text>
|
|
321
331
|
}
|
|
322
332
|
refreshing={d.isLoading}
|
|
323
333
|
onRefresh={() => void d.refresh()}
|
|
@@ -329,7 +339,7 @@ const EventDiscussionBody = ({
|
|
|
329
339
|
{t(d.error || pickerError)}
|
|
330
340
|
</Text>
|
|
331
341
|
<Pressable accessibilityRole="button" onPress={() => void d.refresh()}>
|
|
332
|
-
<Text style={muted}>Try again</Text>
|
|
342
|
+
<Text style={muted}>{t('Try again')}</Text>
|
|
333
343
|
</Pressable>
|
|
334
344
|
</View>
|
|
335
345
|
)}
|
|
@@ -342,11 +352,11 @@ const EventDiscussionBody = ({
|
|
|
342
352
|
<View style={[s.draftContext, { borderColor: theme.border }]}>
|
|
343
353
|
<Text style={muted} numberOfLines={1}>
|
|
344
354
|
{d.editing
|
|
345
|
-
? 'Edit your comment'
|
|
355
|
+
? t('Edit your comment')
|
|
346
356
|
: t('Reply to {{name}}', { name: d.replyingTo?.author.name ?? '' })}
|
|
347
357
|
</Text>
|
|
348
358
|
<Pressable accessibilityRole="button" onPress={d.cancelDraft}>
|
|
349
|
-
<Text style={muted}>Cancel</Text>
|
|
359
|
+
<Text style={muted}>{t('Cancel')}</Text>
|
|
350
360
|
</Pressable>
|
|
351
361
|
</View>
|
|
352
362
|
)}
|
|
@@ -379,8 +389,8 @@ const EventDiscussionBody = ({
|
|
|
379
389
|
</Pressable>
|
|
380
390
|
)}
|
|
381
391
|
<TextInput
|
|
382
|
-
accessibilityLabel=
|
|
383
|
-
placeholder=
|
|
392
|
+
accessibilityLabel={t('Your comment')}
|
|
393
|
+
placeholder={t('Enter your comment…')}
|
|
384
394
|
placeholderTextColor={theme.muted}
|
|
385
395
|
multiline
|
|
386
396
|
maxLength={4000}
|
|
@@ -391,7 +401,7 @@ const EventDiscussionBody = ({
|
|
|
391
401
|
/>
|
|
392
402
|
<Pressable
|
|
393
403
|
accessibilityRole="button"
|
|
394
|
-
accessibilityLabel={d.editing ? 'Save comment' : 'Post comment'}
|
|
404
|
+
accessibilityLabel={d.editing ? t('Save comment') : t('Post comment')}
|
|
395
405
|
disabled={
|
|
396
406
|
d.isSubmitting ||
|
|
397
407
|
pickerBusy ||
|
|
@@ -403,7 +413,9 @@ const EventDiscussionBody = ({
|
|
|
403
413
|
{d.isSubmitting ? (
|
|
404
414
|
<ActivityIndicator color={theme.accent} />
|
|
405
415
|
) : (
|
|
406
|
-
<Text style={{ color: theme.accent }}>
|
|
416
|
+
<Text style={{ color: theme.accent }}>
|
|
417
|
+
{d.editing ? t('Save') : t('Send')}
|
|
418
|
+
</Text>
|
|
407
419
|
)}
|
|
408
420
|
</Pressable>
|
|
409
421
|
</View>
|
|
@@ -416,7 +428,7 @@ const EventDiscussionBody = ({
|
|
|
416
428
|
{ borderColor: theme.border, backgroundColor: theme.surface },
|
|
417
429
|
]}
|
|
418
430
|
>
|
|
419
|
-
<Text style={text}>Sign in to leave a comment</Text>
|
|
431
|
+
<Text style={text}>{t('Sign in to leave a comment')}</Text>
|
|
420
432
|
</Pressable>
|
|
421
433
|
)}
|
|
422
434
|
<Pressable
|
|
@@ -427,7 +439,7 @@ const EventDiscussionBody = ({
|
|
|
427
439
|
void Linking.openURL(d.supportUrl).catch(() => undefined)
|
|
428
440
|
}}
|
|
429
441
|
>
|
|
430
|
-
<Text style={[muted, s.date]}>Need help? Contact support</Text>
|
|
442
|
+
<Text style={[muted, s.date]}>{t('Need help? Contact support')}</Text>
|
|
431
443
|
</Pressable>
|
|
432
444
|
{sheet(
|
|
433
445
|
Boolean(actions),
|
|
@@ -442,12 +454,12 @@ const EventDiscussionBody = ({
|
|
|
442
454
|
actionButton('Delete', () =>
|
|
443
455
|
closeActions((comment) =>
|
|
444
456
|
Alert.alert(
|
|
445
|
-
'Delete comment?',
|
|
446
|
-
'Your comment will be removed from this conversation.',
|
|
457
|
+
t('Delete your comment?'),
|
|
458
|
+
t('Your comment will be removed from this conversation.'),
|
|
447
459
|
[
|
|
448
|
-
{ text: 'Cancel', style: 'cancel' },
|
|
460
|
+
{ text: t('Cancel'), style: 'cancel' },
|
|
449
461
|
{
|
|
450
|
-
text: 'Delete',
|
|
462
|
+
text: t('Delete'),
|
|
451
463
|
style: 'destructive',
|
|
452
464
|
onPress: () => void d.remove(comment),
|
|
453
465
|
},
|
|
@@ -462,12 +474,14 @@ const EventDiscussionBody = ({
|
|
|
462
474
|
actionButton('Block this person', () =>
|
|
463
475
|
closeActions((comment) =>
|
|
464
476
|
Alert.alert(
|
|
465
|
-
|
|
466
|
-
|
|
477
|
+
t('Block {{name}}?', { name: comment.author.name }),
|
|
478
|
+
t(
|
|
479
|
+
'You won’t see their comments. You can unblock them from Blocked people.'
|
|
480
|
+
),
|
|
467
481
|
[
|
|
468
|
-
{ text: 'Cancel', style: 'cancel' },
|
|
482
|
+
{ text: t('Cancel'), style: 'cancel' },
|
|
469
483
|
{
|
|
470
|
-
text: 'Block',
|
|
484
|
+
text: t('Block'),
|
|
471
485
|
onPress: () => void d.block(comment.author.id, true),
|
|
472
486
|
},
|
|
473
487
|
]
|
|
@@ -493,7 +507,7 @@ const EventDiscussionBody = ({
|
|
|
493
507
|
Boolean(reporting),
|
|
494
508
|
() => setReporting(null),
|
|
495
509
|
<>
|
|
496
|
-
<Text style={text}>Report comment</Text>
|
|
510
|
+
<Text style={text}>{t('Report comment')}</Text>
|
|
497
511
|
{(
|
|
498
512
|
[
|
|
499
513
|
['spam', 'Spam'],
|
|
@@ -514,11 +528,13 @@ const EventDiscussionBody = ({
|
|
|
514
528
|
() => setModerating(null),
|
|
515
529
|
<>
|
|
516
530
|
<Text style={text}>
|
|
517
|
-
{moderating?.status === 'published'
|
|
531
|
+
{moderating?.status === 'published'
|
|
532
|
+
? t('Approve comment')
|
|
533
|
+
: t('Hide comment')}
|
|
518
534
|
</Text>
|
|
519
535
|
<TextInput
|
|
520
|
-
accessibilityLabel=
|
|
521
|
-
placeholder=
|
|
536
|
+
accessibilityLabel={t('Moderation reason')}
|
|
537
|
+
placeholder={t('Reason')}
|
|
522
538
|
placeholderTextColor={theme.muted}
|
|
523
539
|
value={reason}
|
|
524
540
|
onChangeText={setReason}
|
|
@@ -536,12 +552,14 @@ const EventDiscussionBody = ({
|
|
|
536
552
|
blocksVisible,
|
|
537
553
|
() => setBlocksVisible(false),
|
|
538
554
|
<>
|
|
539
|
-
<Text style={text}>Blocked people</Text>
|
|
555
|
+
<Text style={text}>{t('Blocked people')}</Text>
|
|
540
556
|
<FlatList
|
|
541
557
|
data={d.blockedAuthors}
|
|
542
558
|
keyExtractor={(person) => person.id}
|
|
543
559
|
renderItem={({ item: person }) =>
|
|
544
|
-
actionButton(
|
|
560
|
+
actionButton('Unblock {{name}}', () => void d.block(person.id, false), {
|
|
561
|
+
name: person.name,
|
|
562
|
+
})
|
|
545
563
|
}
|
|
546
564
|
/>
|
|
547
565
|
</>
|