@pi-spi/app 2.0.0 → 2.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/module/core/api.js +14 -5
- package/lib/module/core/api.js.map +1 -1
- package/lib/module/l10n/app_localizations.js.map +1 -1
- package/lib/module/l10n/app_localizations_en.js +8 -0
- package/lib/module/l10n/app_localizations_en.js.map +1 -1
- package/lib/module/l10n/app_localizations_fr.js +8 -0
- package/lib/module/l10n/app_localizations_fr.js.map +1 -1
- package/lib/module/l10n/app_localizations_pt.js +8 -0
- package/lib/module/l10n/app_localizations_pt.js.map +1 -1
- package/lib/module/modules/categorie/presentation/pages/categorie_edit_icon_btn.js +25 -35
- package/lib/module/modules/categorie/presentation/pages/categorie_edit_icon_btn.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/profile_page_avatar.js +6 -28
- package/lib/module/modules/profile/presentation/pages/profile_page_avatar.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/profile_page_contacts.js +0 -1
- package/lib/module/modules/profile/presentation/pages/profile_page_contacts.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/profile_page_contacts_actions.js +122 -162
- package/lib/module/modules/profile/presentation/pages/profile_page_contacts_actions.js.map +1 -1
- package/lib/module/modules/qrcode/presentation/pages/qrcode_alias_page.js +0 -1
- package/lib/module/modules/qrcode/presentation/pages/qrcode_alias_page.js.map +1 -1
- package/lib/module/modules/qrcode/presentation/pages/qrcode_alias_page_share.js +26 -38
- package/lib/module/modules/qrcode/presentation/pages/qrcode_alias_page_share.js.map +1 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_details/subscription_details_page.js +0 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_details/subscription_details_page.js.map +1 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_details/subscription_details_page_actions.js +0 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_details/subscription_details_page_actions.js.map +1 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_details/subscription_details_page_note_sheet.js +38 -93
- package/lib/module/modules/subscription/presentation/pages/subscription_details/subscription_details_page_note_sheet.js.map +1 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_list/subscription_list_empty_widget.js +0 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_list/subscription_list_empty_widget.js.map +1 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_list/subscription_list_widget.js +0 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_list/subscription_list_widget.js.map +1 -1
- package/lib/module/modules/subscription/presentation/pages/subscription_menu_widget.js +23 -42
- package/lib/module/modules/subscription/presentation/pages/subscription_menu_widget.js.map +1 -1
- package/lib/module/modules/transactions/infra/transaction_output_remote.js +2 -1
- package/lib/module/modules/transactions/infra/transaction_output_remote.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions.js +0 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions_cancel.js +34 -61
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions_cancel.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions_return.js +49 -62
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions_return.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_ticket.js +68 -88
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_ticket.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_form/transaction_form_input_pays.js +77 -0
- package/lib/module/modules/transactions/presentation/pages/transaction_form/transaction_form_input_pays.js.map +1 -0
- package/lib/module/modules/transactions/presentation/pages/transaction_form/transaction_form_input_psp.js +49 -155
- package/lib/module/modules/transactions/presentation/pages/transaction_form/transaction_form_input_psp.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_form/transaction_form_page_othr.js +8 -28
- package/lib/module/modules/transactions/presentation/pages/transaction_form/transaction_form_page_othr.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_form/transaction_form_page_verification.js +0 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_form/transaction_form_page_verification.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_recents/transaction_recents_nombre_widget.js +50 -42
- package/lib/module/modules/transactions/presentation/pages/transaction_recents/transaction_recents_nombre_widget.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_recents/transaction_recents_widget.js +0 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_recents/transaction_recents_widget.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions.js +0 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions_reject.js +37 -67
- package/lib/module/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions_reject.js.map +1 -1
- package/lib/module/shared/widgets/confirm_action_sheet_widget.js +34 -67
- package/lib/module/shared/widgets/confirm_action_sheet_widget.js.map +1 -1
- package/lib/module/shared/widgets/image_select_widget.js +43 -107
- package/lib/module/shared/widgets/image_select_widget.js.map +1 -1
- package/lib/module/shared/widgets/notification_dialog.js +25 -35
- package/lib/module/shared/widgets/notification_dialog.js.map +1 -1
- package/lib/module/shared/widgets/selection.js +381 -5
- package/lib/module/shared/widgets/selection.js.map +1 -1
- package/lib/typescript/src/core/api.d.ts +6 -0
- package/lib/typescript/src/core/api.d.ts.map +1 -1
- package/lib/typescript/src/l10n/app_localizations.d.ts +16 -0
- package/lib/typescript/src/l10n/app_localizations.d.ts.map +1 -1
- package/lib/typescript/src/l10n/app_localizations_en.d.ts.map +1 -1
- package/lib/typescript/src/l10n/app_localizations_fr.d.ts.map +1 -1
- package/lib/typescript/src/l10n/app_localizations_pt.d.ts.map +1 -1
- package/lib/typescript/src/modules/categorie/presentation/pages/categorie_edit_icon_btn.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_page_avatar.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_page_contacts.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_page_contacts_actions.d.ts.map +1 -1
- package/lib/typescript/src/modules/qrcode/presentation/pages/qrcode_alias_page.d.ts.map +1 -1
- package/lib/typescript/src/modules/qrcode/presentation/pages/qrcode_alias_page_share.d.ts.map +1 -1
- package/lib/typescript/src/modules/subscription/presentation/pages/subscription_details/subscription_details_page.d.ts.map +1 -1
- package/lib/typescript/src/modules/subscription/presentation/pages/subscription_details/subscription_details_page_actions.d.ts.map +1 -1
- package/lib/typescript/src/modules/subscription/presentation/pages/subscription_details/subscription_details_page_note_sheet.d.ts +2 -2
- package/lib/typescript/src/modules/subscription/presentation/pages/subscription_details/subscription_details_page_note_sheet.d.ts.map +1 -1
- package/lib/typescript/src/modules/subscription/presentation/pages/subscription_menu_widget.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/infra/transaction_output_remote.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions_cancel.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions_return.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_form/transaction_form_input_pays.d.ts +17 -0
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_form/transaction_form_input_pays.d.ts.map +1 -0
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_form/transaction_form_input_psp.d.ts +6 -2
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_form/transaction_form_input_psp.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_form/transaction_form_page_othr.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_form/transaction_form_page_verification.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_recents/transaction_recents_nombre_widget.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions_reject.d.ts.map +1 -1
- package/lib/typescript/src/shared/widgets/confirm_action_sheet_widget.d.ts +4 -1
- package/lib/typescript/src/shared/widgets/confirm_action_sheet_widget.d.ts.map +1 -1
- package/lib/typescript/src/shared/widgets/image_select_widget.d.ts +6 -4
- package/lib/typescript/src/shared/widgets/image_select_widget.d.ts.map +1 -1
- package/lib/typescript/src/shared/widgets/notification_dialog.d.ts +2 -2
- package/lib/typescript/src/shared/widgets/notification_dialog.d.ts.map +1 -1
- package/lib/typescript/src/shared/widgets/selection.d.ts +69 -2
- package/lib/typescript/src/shared/widgets/selection.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/api.ts +11 -2
- package/src/l10n/app_localizations.ts +16 -0
- package/src/l10n/app_localizations_en.ts +8 -0
- package/src/l10n/app_localizations_fr.ts +8 -0
- package/src/l10n/app_localizations_pt.ts +8 -0
- package/src/modules/categorie/presentation/pages/categorie_edit_icon_btn.tsx +25 -27
- package/src/modules/profile/presentation/pages/profile_page_avatar.tsx +6 -12
- package/src/modules/profile/presentation/pages/profile_page_contacts.tsx +0 -1
- package/src/modules/profile/presentation/pages/profile_page_contacts_actions.tsx +111 -117
- package/src/modules/qrcode/presentation/pages/qrcode_alias_page.tsx +0 -1
- package/src/modules/qrcode/presentation/pages/qrcode_alias_page_share.tsx +32 -40
- package/src/modules/subscription/presentation/pages/subscription_details/subscription_details_page.tsx +0 -1
- package/src/modules/subscription/presentation/pages/subscription_details/subscription_details_page_actions.tsx +0 -1
- package/src/modules/subscription/presentation/pages/subscription_details/subscription_details_page_note_sheet.tsx +20 -59
- package/src/modules/subscription/presentation/pages/subscription_list/subscription_list_empty_widget.tsx +1 -1
- package/src/modules/subscription/presentation/pages/subscription_list/subscription_list_widget.tsx +1 -1
- package/src/modules/subscription/presentation/pages/subscription_menu_widget.tsx +25 -39
- package/src/modules/transactions/infra/transaction_output_remote.ts +6 -1
- package/src/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions.tsx +0 -1
- package/src/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions_cancel.tsx +39 -41
- package/src/modules/transactions/presentation/pages/transaction_details/transaction_details_page_actions_return.tsx +41 -46
- package/src/modules/transactions/presentation/pages/transaction_details/transaction_details_page_ticket.tsx +46 -40
- package/src/modules/transactions/presentation/pages/transaction_form/transaction_form_input_pays.tsx +92 -0
- package/src/modules/transactions/presentation/pages/transaction_form/transaction_form_input_psp.tsx +48 -94
- package/src/modules/transactions/presentation/pages/transaction_form/transaction_form_page_othr.tsx +4 -17
- package/src/modules/transactions/presentation/pages/transaction_form/transaction_form_page_verification.tsx +0 -1
- package/src/modules/transactions/presentation/pages/transaction_recents/transaction_recents_nombre_widget.tsx +49 -42
- package/src/modules/transactions/presentation/pages/transaction_recents/transaction_recents_widget.tsx +1 -1
- package/src/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions.tsx +0 -1
- package/src/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions_reject.tsx +47 -48
- package/src/shared/widgets/confirm_action_sheet_widget.tsx +30 -34
- package/src/shared/widgets/image_select_widget.tsx +46 -61
- package/src/shared/widgets/notification_dialog.tsx +66 -70
- package/src/shared/widgets/selection.tsx +292 -4
- package/lib/module/modules/transactions/presentation/pages/transaction_details/sheet_box.js +0 -47
- package/lib/module/modules/transactions/presentation/pages/transaction_details/sheet_box.js.map +0 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_details/sheet_box.d.ts +0 -10
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_details/sheet_box.d.ts.map +0 -1
- package/src/modules/transactions/presentation/pages/transaction_details/sheet_box.tsx +0 -30
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { MaterialIcons } from '@expo/vector-icons';
|
|
2
1
|
import { useState } from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import { ScrollView, StyleSheet, Text } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import { useBloc } from '../../../../../core/bloc_react';
|
|
6
5
|
import { AppRouter, useAppRouter } from '../../../../../core/router';
|
|
7
|
-
import { useTheme } from '../../../../../core/theme';
|
|
6
|
+
import { Themer, useTheme } from '../../../../../core/theme';
|
|
8
7
|
import type { AppLocalizations } from '../../../../../l10n/app_localizations';
|
|
9
8
|
import { useAppLocalizations } from '../../../../../l10n/localizations';
|
|
10
9
|
import { ElevatedButton } from '../../../../../shared/material/buttons';
|
|
11
10
|
import { formatMontant } from '../../../../../shared/widgets/amount_widget';
|
|
11
|
+
import { SelectionBoutons, SelectionChoix, SelectionSheet } from '../../../../../shared/widgets/selection';
|
|
12
12
|
import type { Transaction } from '../../../domain/models/transaction';
|
|
13
13
|
import { TransactionRejectReason } from '../../../domain/models/transaction_reject_reason';
|
|
14
14
|
import { TransactionRtpBloc } from '../../bloc/transaction_rtp/transaction_rtp_bloc';
|
|
15
15
|
import { TransactionRtpRejectEvent } from '../../bloc/transaction_rtp/transaction_rtp_event';
|
|
16
|
-
import { SheetBox } from '../transaction_details/sheet_box';
|
|
17
16
|
|
|
18
17
|
/** Textes des raisons de rejet */
|
|
19
18
|
function raison(motif: TransactionRejectReason, traductions: AppLocalizations): string {
|
|
@@ -43,52 +42,52 @@ export function TransactionRtpPageActionsReject() {
|
|
|
43
42
|
const tx = (bloc.state as unknown as { transaction: Transaction }).transaction;
|
|
44
43
|
|
|
45
44
|
return (
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
45
|
+
<SelectionSheet
|
|
46
|
+
titre={traductions.transactionRtpRejectTitle(tx.clientNom)}
|
|
47
|
+
entete={
|
|
48
|
+
<Text style={[theme.textTheme.displaySmall, { color: Themer.neural03Color }]}>
|
|
49
|
+
{traductions.transactionRtpRejectSubtitle(formatMontant(tx.montant, traductions.localeName), tx.clientNom)}
|
|
50
|
+
</Text>
|
|
51
|
+
}
|
|
52
|
+
contenu={
|
|
53
|
+
<>
|
|
54
|
+
{/* Raisons du rejet */}
|
|
55
|
+
<ScrollView bounces={false} style={styles.defile} contentContainerStyle={styles.content}>
|
|
56
|
+
{TransactionRejectReason.values()
|
|
57
|
+
.filter((motif) => motif !== TransactionRejectReason.autre)
|
|
58
|
+
.map((motif) => (
|
|
59
|
+
<SelectionChoix
|
|
60
|
+
key={motif}
|
|
61
|
+
texte={raison(motif, traductions)}
|
|
62
|
+
choisi={reason === motif}
|
|
63
|
+
onPress={() => setReason(motif)}
|
|
64
|
+
/>
|
|
65
|
+
))}
|
|
66
|
+
</ScrollView>
|
|
67
|
+
<SelectionBoutons
|
|
68
|
+
boutons={[
|
|
69
|
+
<ElevatedButton
|
|
70
|
+
key="rejeter"
|
|
71
|
+
onPress={
|
|
72
|
+
reason != null
|
|
73
|
+
? () => {
|
|
74
|
+
AppRouter.pop(router);
|
|
75
|
+
bloc.add(new TransactionRtpRejectEvent(tx, reason));
|
|
76
|
+
}
|
|
77
|
+
: undefined
|
|
78
|
+
}
|
|
79
|
+
>
|
|
80
|
+
{traductions.btnTextReject}
|
|
81
|
+
</ElevatedButton>,
|
|
82
|
+
]}
|
|
83
|
+
/>
|
|
84
|
+
</>
|
|
85
|
+
}
|
|
86
|
+
/>
|
|
83
87
|
);
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
const styles = StyleSheet.create({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
gap20: { height: 20 },
|
|
90
|
-
chipRow: { paddingVertical: 5, alignItems: 'flex-start' },
|
|
91
|
-
chip: { flexDirection: 'row', alignItems: 'center', borderRadius: 8, paddingHorizontal: 12, minHeight: 32 },
|
|
92
|
-
check: { marginRight: 8 },
|
|
93
|
-
button: { height: 56 },
|
|
91
|
+
defile: { flexShrink: 1 },
|
|
92
|
+
content: { paddingHorizontal: 20, paddingTop: 4, paddingBottom: 16 },
|
|
94
93
|
});
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { ScrollView, StyleSheet, Text,
|
|
2
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
1
|
+
import { ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
3
2
|
|
|
4
3
|
import { AppRouter, useAppRouter } from '../../core/router';
|
|
5
4
|
import { useTheme } from '../../core/theme';
|
|
6
5
|
import { useAppLocalizations } from '../../l10n/localizations';
|
|
7
6
|
import { ElevatedButton, FilledTonalButton } from '../material/buttons';
|
|
7
|
+
import { SelectionBoutons, SelectionSheet } from './selection';
|
|
8
8
|
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Feuille de confirmation : [title] et [subtitle] centrés, puis Annuler et
|
|
11
|
+
* Confirmer fixés en bas (retournent `false` / `true` par défaut).
|
|
12
|
+
*/
|
|
10
13
|
export function ConfirmActionSheetWidget({
|
|
11
14
|
title,
|
|
12
15
|
subtitle,
|
|
@@ -25,44 +28,37 @@ export function ConfirmActionSheetWidget({
|
|
|
25
28
|
const traductions = useAppLocalizations();
|
|
26
29
|
const theme = useTheme();
|
|
27
30
|
const router = useAppRouter();
|
|
28
|
-
const insets = useSafeAreaInsets();
|
|
29
|
-
const { height } = useWindowDimensions();
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
33
|
+
<SelectionSheet
|
|
34
|
+
contenu={
|
|
35
|
+
<>
|
|
36
|
+
<ScrollView bounces={false} style={styles.defile} contentContainerStyle={styles.content}>
|
|
37
|
+
{/* Titre */}
|
|
38
|
+
<Text style={[theme.textTheme.titleSmall, styles.center]}>{title}</Text>
|
|
39
|
+
<View style={styles.gap12} />
|
|
40
|
+
{/* Sous-titre */}
|
|
41
|
+
<Text style={[theme.textTheme.displayMedium, styles.center]}>{subtitle}</Text>
|
|
42
|
+
</ScrollView>
|
|
43
|
+
<SelectionBoutons
|
|
44
|
+
boutons={[
|
|
45
|
+
<FilledTonalButton key="non" onPress={cancelAction ?? (() => AppRouter.pop(router, { value: false }))}>
|
|
42
46
|
{cancelTitle ?? traductions.btnTextCancel}
|
|
43
|
-
</FilledTonalButton
|
|
44
|
-
|
|
45
|
-
<View style={styles.gap16} />
|
|
46
|
-
<View style={styles.flex}>
|
|
47
|
-
<ElevatedButton style={styles.button} onPress={confirmAction ?? (() => AppRouter.pop(router, { value: true }))}>
|
|
47
|
+
</FilledTonalButton>,
|
|
48
|
+
<ElevatedButton key="oui" onPress={confirmAction ?? (() => AppRouter.pop(router, { value: true }))}>
|
|
48
49
|
{confirmTitle ?? traductions.btnTextAccept}
|
|
49
|
-
</ElevatedButton
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
</ElevatedButton>,
|
|
51
|
+
]}
|
|
52
|
+
/>
|
|
53
|
+
</>
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
55
56
|
);
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
const styles = StyleSheet.create({
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
defile: { flexShrink: 1 },
|
|
61
|
+
content: { paddingHorizontal: 24, paddingTop: 4, paddingBottom: 20 },
|
|
61
62
|
center: { textAlign: 'center' },
|
|
62
|
-
|
|
63
|
-
buttons: { flexDirection: 'row', height: 56 },
|
|
64
|
-
button: { height: 56 },
|
|
65
|
-
gap16: { width: 16 },
|
|
66
|
-
gap20: { height: 20 },
|
|
67
|
-
gap30: { height: 30 },
|
|
63
|
+
gap12: { height: 12 },
|
|
68
64
|
});
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
import { MaterialIcons } from '@expo/vector-icons';
|
|
2
|
-
import { Image } from 'expo-image';
|
|
3
1
|
import * as ImagePicker from 'expo-image-picker';
|
|
4
2
|
import type { ReactNode } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import { ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
7
4
|
|
|
8
|
-
import {
|
|
9
|
-
import { useTheme } from '../../core/theme';
|
|
5
|
+
import { Themer, useTheme } from '../../core/theme';
|
|
10
6
|
import { useAppLocalizations } from '../../l10n/localizations';
|
|
11
|
-
import {
|
|
7
|
+
import { SbSelectionOption, SelectionSheet } from './selection';
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
|
-
* Feuille de choix d'une image :
|
|
15
|
-
*
|
|
16
|
-
* l'utilisateur
|
|
10
|
+
* Feuille de choix d'une image : prendre une photo, la choisir dans la
|
|
11
|
+
* galerie, puis les [otherActions] (ex. SbSelectionOption « Supprimer »).
|
|
12
|
+
* [onSelect] reçoit l'URI locale de l'image (ou `null` si l'utilisateur
|
|
13
|
+
* annule).
|
|
17
14
|
*/
|
|
18
15
|
export function ImageSelectWidget({
|
|
19
16
|
title,
|
|
17
|
+
subtitle,
|
|
20
18
|
onSelect,
|
|
21
19
|
otherActions = [],
|
|
22
20
|
}: {
|
|
23
21
|
title?: string;
|
|
22
|
+
subtitle?: string;
|
|
24
23
|
onSelect: (uri: string | null) => void;
|
|
25
24
|
otherActions?: ReactNode[];
|
|
26
25
|
}) {
|
|
27
26
|
const theme = useTheme();
|
|
28
27
|
const traductions = useAppLocalizations();
|
|
29
|
-
const insets = useSafeAreaInsets();
|
|
30
|
-
const { height } = useWindowDimensions();
|
|
31
28
|
|
|
32
29
|
const pickImage = async (source: 'camera' | 'gallery') => {
|
|
33
30
|
try {
|
|
@@ -46,58 +43,46 @@ export function ImageSelectWidget({
|
|
|
46
43
|
}
|
|
47
44
|
};
|
|
48
45
|
|
|
46
|
+
const actions: ReactNode[] = [
|
|
47
|
+
// Prendre une photo avec l'appareil photo
|
|
48
|
+
<SbSelectionOption
|
|
49
|
+
key="camera"
|
|
50
|
+
icone="photo-camera"
|
|
51
|
+
titre={traductions.imageSelectCamera}
|
|
52
|
+
onPress={() => void pickImage('camera')}
|
|
53
|
+
/>,
|
|
54
|
+
// Sélectionner une photo depuis la galerie
|
|
55
|
+
<SbSelectionOption
|
|
56
|
+
key="galerie"
|
|
57
|
+
icone="photo-library"
|
|
58
|
+
titre={traductions.imageSelectGalerie}
|
|
59
|
+
onPress={() => void pickImage('gallery')}
|
|
60
|
+
/>,
|
|
61
|
+
...otherActions,
|
|
62
|
+
];
|
|
63
|
+
|
|
49
64
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{/* Actions */}
|
|
68
|
-
<Card>
|
|
69
|
-
{/* Sélectionner une photo depuis la galerie */}
|
|
70
|
-
<Pressable
|
|
71
|
-
accessibilityRole="button"
|
|
72
|
-
onPress={() => void pickImage('gallery')}
|
|
73
|
-
style={({ pressed }) => [styles.tile, pressed ? { backgroundColor: theme.colorScheme.secondary } : null]}
|
|
74
|
-
>
|
|
75
|
-
<MaterialIcons name="image" size={24} color={theme.colorScheme.onSurface} />
|
|
76
|
-
<Text style={[theme.textTheme.bodyLarge, styles.tileText]}>{traductions.transactionDetailsTicketSaveGallery}</Text>
|
|
77
|
-
<MaterialIcons name="arrow-forward-ios" size={16} color={theme.colorScheme.onSurface} />
|
|
78
|
-
</Pressable>
|
|
79
|
-
{otherActions}
|
|
80
|
-
</Card>
|
|
81
|
-
</ScrollView>
|
|
82
|
-
</View>
|
|
65
|
+
<SelectionSheet
|
|
66
|
+
titre={title}
|
|
67
|
+
entete={
|
|
68
|
+
subtitle != null ? (
|
|
69
|
+
<Text style={[theme.textTheme.displaySmall, { color: Themer.neural03Color }]}>{subtitle}</Text>
|
|
70
|
+
) : undefined
|
|
71
|
+
}
|
|
72
|
+
contenu={
|
|
73
|
+
<ScrollView bounces={false} contentContainerStyle={styles.content}>
|
|
74
|
+
{actions.map((action, i) => (
|
|
75
|
+
<View key={i} style={i > 0 ? styles.suivante : null}>
|
|
76
|
+
{action}
|
|
77
|
+
</View>
|
|
78
|
+
))}
|
|
79
|
+
</ScrollView>
|
|
80
|
+
}
|
|
81
|
+
/>
|
|
83
82
|
);
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
const styles = StyleSheet.create({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
row: { height: 80, flexDirection: 'row', alignItems: 'center' },
|
|
90
|
-
camera: {
|
|
91
|
-
width: 77,
|
|
92
|
-
height: 80,
|
|
93
|
-
borderRadius: 12,
|
|
94
|
-
overflow: 'hidden',
|
|
95
|
-
backgroundColor: 'rgba(0,0,0,0.12)',
|
|
96
|
-
alignItems: 'center',
|
|
97
|
-
justifyContent: 'center',
|
|
98
|
-
},
|
|
99
|
-
tile: { flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, minHeight: 56 },
|
|
100
|
-
tileText: { flex: 1, marginHorizontal: 16 },
|
|
101
|
-
gap10: { height: 10 },
|
|
102
|
-
gap20: { height: 20 },
|
|
86
|
+
content: { paddingHorizontal: 20, paddingTop: 8, paddingBottom: 16 },
|
|
87
|
+
suivante: { marginTop: 10 },
|
|
103
88
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Image } from 'expo-image';
|
|
2
|
-
import { ScrollView, StyleSheet, Text,
|
|
3
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
2
|
+
import { ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import { Images } from '../../core/assets';
|
|
6
5
|
import { scaleDownSize } from '../utils/scale_down';
|
|
@@ -8,6 +7,7 @@ import { AppRouter, useAppRouter } from '../../core/router';
|
|
|
8
7
|
import { useTheme } from '../../core/theme';
|
|
9
8
|
import { ElevatedButton } from '../material/buttons';
|
|
10
9
|
import { PopScope } from '../material/overlays';
|
|
10
|
+
import { SelectionSheet } from './selection';
|
|
11
11
|
|
|
12
12
|
/** Affichage des dialogues de notifications de succes ou erreur */
|
|
13
13
|
export enum NotificationType {
|
|
@@ -43,8 +43,8 @@ export type NotificationDialogProps = {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* Feuille du bas affichant un succès / une erreur / une info : animation
|
|
47
|
+
* selon le [type], textes centrés puis bouton(s) sur toute la largeur. Le bouton retour est
|
|
48
48
|
* bloqué : seuls les boutons ferment la feuille.
|
|
49
49
|
*/
|
|
50
50
|
export function NotificationDialog({
|
|
@@ -61,73 +61,70 @@ export function NotificationDialog({
|
|
|
61
61
|
}: NotificationDialogProps) {
|
|
62
62
|
const theme = useTheme();
|
|
63
63
|
const router = useAppRouter();
|
|
64
|
-
const { height } = useWindowDimensions();
|
|
65
|
-
const insets = useSafeAreaInsets();
|
|
66
64
|
const image = animatedImage ?? imageFor(type);
|
|
67
65
|
const close = () => AppRouter.pop(router);
|
|
68
66
|
|
|
69
67
|
return (
|
|
70
68
|
<PopScope canPop={false}>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
<ElevatedButton onPress={btnAction ?? close} style={btnColor ? { backgroundColor: btnColor } : undefined}>
|
|
115
|
-
{btnText}
|
|
116
|
-
</ElevatedButton>
|
|
117
|
-
)}
|
|
118
|
-
{/* Btns d'action */}
|
|
119
|
-
{btns?.map((btn, i) => (
|
|
120
|
-
<View key={i} style={styles.btn}>
|
|
121
|
-
<ElevatedButton
|
|
122
|
-
onPress={btn.btnAction ?? close}
|
|
123
|
-
style={btn.btnColor ? { backgroundColor: btn.btnColor } : undefined}
|
|
124
|
-
>
|
|
125
|
-
{btn.btnText}
|
|
69
|
+
<SelectionSheet
|
|
70
|
+
hauteurMax={0.8}
|
|
71
|
+
contenu={
|
|
72
|
+
<ScrollView contentContainerStyle={styles.content} bounces={false}>
|
|
73
|
+
{image != null && (
|
|
74
|
+
<>
|
|
75
|
+
<Image source={image} style={[scaleDownSize(image, 96), styles.image]} contentFit="contain" />
|
|
76
|
+
<View style={styles.gap24} />
|
|
77
|
+
</>
|
|
78
|
+
)}
|
|
79
|
+
{/* Text message */}
|
|
80
|
+
{message != null && (
|
|
81
|
+
<>
|
|
82
|
+
<Text style={[theme.textTheme.headlineSmall, styles.center]}>{message}</Text>
|
|
83
|
+
<View style={styles.gap16} />
|
|
84
|
+
</>
|
|
85
|
+
)}
|
|
86
|
+
{/* Title message */}
|
|
87
|
+
{title != null && (
|
|
88
|
+
<>
|
|
89
|
+
<Text style={[theme.textTheme.titleSmall, styles.center]}>{title}</Text>
|
|
90
|
+
<View style={styles.gap12} />
|
|
91
|
+
</>
|
|
92
|
+
)}
|
|
93
|
+
{/* Subtitle message */}
|
|
94
|
+
{subtitle != null && (
|
|
95
|
+
<>
|
|
96
|
+
<Text style={[theme.textTheme.titleSmall, styles.center]}>{subtitle}</Text>
|
|
97
|
+
<View style={styles.gap12} />
|
|
98
|
+
</>
|
|
99
|
+
)}
|
|
100
|
+
{/* Description */}
|
|
101
|
+
{description != null && (
|
|
102
|
+
<>
|
|
103
|
+
<Text style={[theme.textTheme.displaySmall, styles.center]}>{description}</Text>
|
|
104
|
+
<View style={styles.gap16} />
|
|
105
|
+
</>
|
|
106
|
+
)}
|
|
107
|
+
<View style={styles.gap8} />
|
|
108
|
+
{/* Continue btn */}
|
|
109
|
+
{btnText != null && (
|
|
110
|
+
<ElevatedButton onPress={btnAction ?? close} style={btnColor ? { backgroundColor: btnColor } : undefined}>
|
|
111
|
+
{btnText}
|
|
126
112
|
</ElevatedButton>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
113
|
+
)}
|
|
114
|
+
{/* Btns d'action */}
|
|
115
|
+
{btns?.map((btn, i) => (
|
|
116
|
+
<View key={i} style={styles.btn}>
|
|
117
|
+
<ElevatedButton
|
|
118
|
+
onPress={btn.btnAction ?? close}
|
|
119
|
+
style={btn.btnColor ? { backgroundColor: btn.btnColor } : undefined}
|
|
120
|
+
>
|
|
121
|
+
{btn.btnText}
|
|
122
|
+
</ElevatedButton>
|
|
123
|
+
</View>
|
|
124
|
+
))}
|
|
125
|
+
</ScrollView>
|
|
126
|
+
}
|
|
127
|
+
/>
|
|
131
128
|
</PopScope>
|
|
132
129
|
);
|
|
133
130
|
}
|
|
@@ -146,13 +143,12 @@ function imageFor(type: NotificationType): number | undefined {
|
|
|
146
143
|
}
|
|
147
144
|
|
|
148
145
|
const styles = StyleSheet.create({
|
|
149
|
-
|
|
150
|
-
content: { paddingHorizontal: 40, paddingVertical: 10, alignItems: 'stretch' },
|
|
146
|
+
content: { paddingHorizontal: 28, paddingTop: 8, paddingBottom: 16, alignItems: 'stretch' },
|
|
151
147
|
image: { alignSelf: 'center' },
|
|
152
148
|
center: { textAlign: 'center' },
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
gap8: { height: 8 },
|
|
150
|
+
gap12: { height: 12 },
|
|
151
|
+
gap16: { height: 16 },
|
|
155
152
|
gap24: { height: 24 },
|
|
156
|
-
gap32: { height: 32 },
|
|
157
153
|
btn: { paddingVertical: 5 },
|
|
158
154
|
});
|