jornada-ui 0.4.18 → 0.4.20
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/components/box/index.js +5 -5
- package/lib/commonjs/components/box/index.js.map +1 -1
- package/lib/commonjs/components/button/index.js +5 -5
- package/lib/commonjs/components/button/index.js.map +1 -1
- package/lib/commonjs/components/capture-photo/index.js +1 -1
- package/lib/commonjs/components/capture-photo/index.js.map +1 -1
- package/lib/commonjs/components/card-hours/index.js +5 -5
- package/lib/commonjs/components/card-hours/index.js.map +1 -1
- package/lib/commonjs/components/card-maintenance/index.js +3 -0
- package/lib/commonjs/components/card-maintenance/index.js.map +1 -1
- package/lib/commonjs/components/list-supplies/index.js +132 -111
- package/lib/commonjs/components/list-supplies/index.js.map +1 -1
- package/lib/commonjs/components/maintenance-description-input/index.js +5 -1
- package/lib/commonjs/components/maintenance-description-input/index.js.map +1 -1
- package/lib/commonjs/components/modal-maintenance/index.js +2 -0
- package/lib/commonjs/components/modal-maintenance/index.js.map +1 -1
- package/lib/commonjs/components/modal-type-activities/index.js +10 -4
- package/lib/commonjs/components/modal-type-activities/index.js.map +1 -1
- package/lib/commonjs/components/modals/modal-change-activitie-history/index.js +2 -0
- package/lib/commonjs/components/modals/modal-change-activitie-history/index.js.map +1 -1
- package/lib/commonjs/components/notification-details-card/index.js +6 -6
- package/lib/commonjs/components/report-bobinas/index.js +12 -6
- package/lib/commonjs/components/report-bobinas/index.js.map +1 -1
- package/lib/commonjs/components/resume-raking/index.js +5 -0
- package/lib/commonjs/components/resume-raking/index.js.map +1 -1
- package/lib/commonjs/components/step-indicator/index.js +12 -4
- package/lib/commonjs/components/step-indicator/index.js.map +1 -1
- package/lib/commonjs/components/toast-message/index.js +10 -6
- package/lib/commonjs/components/toast-message/index.js.map +1 -1
- package/lib/commonjs/components/toggle-fuel/index.js +1 -0
- package/lib/commonjs/components/toggle-fuel/index.js.map +1 -1
- package/lib/commonjs/components/trip-details-card/index.js +218 -182
- package/lib/commonjs/components/trip-details-card/index.js.map +1 -1
- package/lib/commonjs/components/typography/index.js +2 -0
- package/lib/commonjs/components/typography/index.js.map +1 -1
- package/lib/commonjs/components/user-journey-work-card/index.js +14 -0
- package/lib/commonjs/components/user-journey-work-card/index.js.map +1 -1
- package/lib/commonjs/components/user-profile/index.js +9 -1
- package/lib/commonjs/components/user-profile/index.js.map +1 -1
- package/lib/commonjs/components/weekly-hours-balance/index.js +2 -0
- package/lib/commonjs/components/weekly-hours-balance/index.js.map +1 -1
- package/lib/commonjs/index.js +32 -32
- package/lib/module/components/box/index.js +5 -5
- package/lib/module/components/box/index.js.map +1 -1
- package/lib/module/components/button/index.js +5 -5
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/capture-photo/index.js +1 -1
- package/lib/module/components/capture-photo/index.js.map +1 -1
- package/lib/module/components/card-hours/index.js +5 -5
- package/lib/module/components/card-hours/index.js.map +1 -1
- package/lib/module/components/card-maintenance/index.js +3 -0
- package/lib/module/components/card-maintenance/index.js.map +1 -1
- package/lib/module/components/list-supplies/index.js +134 -113
- package/lib/module/components/list-supplies/index.js.map +1 -1
- package/lib/module/components/maintenance-description-input/index.js +5 -1
- package/lib/module/components/maintenance-description-input/index.js.map +1 -1
- package/lib/module/components/modal-maintenance/index.js +2 -0
- package/lib/module/components/modal-maintenance/index.js.map +1 -1
- package/lib/module/components/modal-type-activities/index.js +10 -4
- package/lib/module/components/modal-type-activities/index.js.map +1 -1
- package/lib/module/components/modals/modal-change-activitie-history/index.js +2 -0
- package/lib/module/components/modals/modal-change-activitie-history/index.js.map +1 -1
- package/lib/module/components/notification-details-card/index.js +6 -6
- package/lib/module/components/report-bobinas/index.js +12 -6
- package/lib/module/components/report-bobinas/index.js.map +1 -1
- package/lib/module/components/resume-raking/index.js +5 -0
- package/lib/module/components/resume-raking/index.js.map +1 -1
- package/lib/module/components/step-indicator/index.js +12 -4
- package/lib/module/components/step-indicator/index.js.map +1 -1
- package/lib/module/components/toast-message/index.js +10 -6
- package/lib/module/components/toast-message/index.js.map +1 -1
- package/lib/module/components/toggle-fuel/index.js +1 -0
- package/lib/module/components/toggle-fuel/index.js.map +1 -1
- package/lib/module/components/trip-details-card/index.js +221 -184
- package/lib/module/components/trip-details-card/index.js.map +1 -1
- package/lib/module/components/typography/index.js +2 -0
- package/lib/module/components/typography/index.js.map +1 -1
- package/lib/module/components/user-journey-work-card/index.js +14 -0
- package/lib/module/components/user-journey-work-card/index.js.map +1 -1
- package/lib/module/components/user-profile/index.js +9 -1
- package/lib/module/components/user-profile/index.js.map +1 -1
- package/lib/module/components/weekly-hours-balance/index.js +2 -0
- package/lib/module/components/weekly-hours-balance/index.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/components/box/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/capture-photo/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/card-hours/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/card-maintenance/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/list-supplies/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/maintenance-description-input/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/modal-maintenance/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/modal-type-activities/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/modal-type-activities/interface.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/modal-type-activities/interface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/interface.d.ts +4 -0
- package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/interface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/report-bobinas/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/resume-raking/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/resume-raking/interface.d.ts +13 -0
- package/lib/typescript/commonjs/src/components/resume-raking/interface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/toast-message/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/toast-message/interface.d.ts +1 -0
- package/lib/typescript/commonjs/src/components/toast-message/interface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/toggle-fuel/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/trip-details-card/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/typography/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/components/typography/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/user-journey-work-card/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/user-profile/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/weekly-hours-balance/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +4 -4
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/box/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/capture-photo/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/card-hours/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/card-maintenance/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/list-supplies/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/maintenance-description-input/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/modal-maintenance/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/modal-type-activities/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/modal-type-activities/interface.d.ts +2 -0
- package/lib/typescript/module/src/components/modal-type-activities/interface.d.ts.map +1 -1
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/interface.d.ts +4 -0
- package/lib/typescript/module/src/components/modals/modal-change-activitie-history/interface.d.ts.map +1 -1
- package/lib/typescript/module/src/components/report-bobinas/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/resume-raking/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/resume-raking/interface.d.ts +13 -0
- package/lib/typescript/module/src/components/resume-raking/interface.d.ts.map +1 -1
- package/lib/typescript/module/src/components/step-indicator/index.d.ts +3 -0
- package/lib/typescript/module/src/components/step-indicator/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/toast-message/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/toast-message/interface.d.ts +1 -0
- package/lib/typescript/module/src/components/toast-message/interface.d.ts.map +1 -1
- package/lib/typescript/module/src/components/toggle-fuel/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/trip-details-card/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/typography/index.d.ts +1 -0
- package/lib/typescript/module/src/components/typography/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/user-journey-work-card/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/user-profile/index.d.ts.map +1 -1
- package/lib/typescript/module/src/components/weekly-hours-balance/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +4 -4
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/components/box/index.tsx +53 -53
- package/src/components/button/index.tsx +76 -76
- package/src/components/capture-photo/index.tsx +1 -1
- package/src/components/card-hours/index.tsx +121 -121
- package/src/components/card-maintenance/index.tsx +8 -2
- package/src/components/card-maintenance/interface.d.ts +4 -0
- package/src/components/list-supplies/index.tsx +178 -153
- package/src/components/maintenance-description-input/index.tsx +11 -4
- package/src/components/modal-maintenance/index.tsx +2 -1
- package/src/components/modal-maintenance/interface.d.ts +1 -0
- package/src/components/modal-type-activities/index.tsx +23 -5
- package/src/components/modal-type-activities/interface.ts +3 -0
- package/src/components/modals/modal-change-activitie-history/index.tsx +2 -1
- package/src/components/modals/modal-change-activitie-history/interface.ts +4 -0
- package/src/components/notification-details-card/index.tsx +180 -180
- package/src/components/report-bobinas/index.tsx +185 -175
- package/src/components/resume-raking/index.tsx +5 -1
- package/src/components/resume-raking/interface.ts +16 -0
- package/src/components/step-indicator/index.tsx +26 -8
- package/src/components/step-indicator/interface.d.ts +3 -0
- package/src/components/toast-message/index.tsx +77 -75
- package/src/components/toast-message/interface.ts +18 -17
- package/src/components/toggle-fuel/index.tsx +1 -0
- package/src/components/trip-details-card/index.tsx +65 -32
- package/src/components/typography/index.tsx +2 -0
- package/src/components/typography/interface.d.ts +104 -102
- package/src/components/user-journey-work-card/index.tsx +23 -2
- package/src/components/user-profile/index.tsx +10 -1
- package/src/components/weekly-hours-balance/index.tsx +2 -1
- package/src/index.tsx +4 -4
|
@@ -19,6 +19,7 @@ import { theme } from "../../styles/theme/theme";
|
|
|
19
19
|
import { getStatusColorHex } from "../../utils/get-status-color";
|
|
20
20
|
|
|
21
21
|
const ModalMaintenance: React.FC<IModalMaintenanceProps> = ({
|
|
22
|
+
testID = "modal-maintenance",
|
|
22
23
|
visible,
|
|
23
24
|
onClose,
|
|
24
25
|
dataRegistro,
|
|
@@ -27,7 +28,7 @@ const ModalMaintenance: React.FC<IModalMaintenanceProps> = ({
|
|
|
27
28
|
imagemUrl,
|
|
28
29
|
}) => {
|
|
29
30
|
return (
|
|
30
|
-
<Modal animationType="fade" transparent visible={visible}>
|
|
31
|
+
<Modal testID={testID} animationType="fade" transparent visible={visible}>
|
|
31
32
|
<View
|
|
32
33
|
style={{
|
|
33
34
|
flex: 1,
|
|
@@ -29,13 +29,23 @@ const NUM_COLS = 3;
|
|
|
29
29
|
const GUTTER = 8; // espaço horizontal entre botões
|
|
30
30
|
const ROW_SPACE = 12; // espaço vertical entre linhas
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const ModalTypeActivities = forwardRef<any, IModalTypeActivities>(
|
|
33
33
|
(
|
|
34
|
-
{
|
|
34
|
+
{
|
|
35
|
+
testID = "modal-activity",
|
|
36
|
+
visible,
|
|
37
|
+
onClose,
|
|
38
|
+
driverType,
|
|
39
|
+
handleSelectActivity,
|
|
40
|
+
activityType,
|
|
41
|
+
isLoading,
|
|
42
|
+
style,
|
|
43
|
+
},
|
|
35
44
|
ref
|
|
36
45
|
): React.ReactElement => {
|
|
37
46
|
return (
|
|
38
47
|
<Modal
|
|
48
|
+
testID={testID}
|
|
39
49
|
ref={ref}
|
|
40
50
|
animationType="fade"
|
|
41
51
|
transparent={true}
|
|
@@ -69,6 +79,7 @@ const ModalTest = forwardRef<any, IModalTypeActivities>(
|
|
|
69
79
|
}}
|
|
70
80
|
>
|
|
71
81
|
<Typography
|
|
82
|
+
testID={`${testID}-title`}
|
|
72
83
|
text="Atividades"
|
|
73
84
|
size={theme.fontSizes.md}
|
|
74
85
|
color={theme.colors.blue[500]}
|
|
@@ -76,7 +87,11 @@ const ModalTest = forwardRef<any, IModalTypeActivities>(
|
|
|
76
87
|
lineHeight={theme.fontSizes.xl}
|
|
77
88
|
/>
|
|
78
89
|
|
|
79
|
-
<TouchableOpacity
|
|
90
|
+
<TouchableOpacity
|
|
91
|
+
testID={`${testID}-close-button`}
|
|
92
|
+
activeOpacity={0.7}
|
|
93
|
+
onPress={onClose}
|
|
94
|
+
>
|
|
80
95
|
<Icons icon="CLOSED" color={theme.colors.blue[500]} />
|
|
81
96
|
</TouchableOpacity>
|
|
82
97
|
</Box>
|
|
@@ -100,6 +115,7 @@ const ModalTest = forwardRef<any, IModalTypeActivities>(
|
|
|
100
115
|
|
|
101
116
|
return (
|
|
102
117
|
<TouchableOpacity
|
|
118
|
+
testID={`${testID}-${index}`}
|
|
103
119
|
style={{
|
|
104
120
|
alignItems: "center",
|
|
105
121
|
justifyContent: "flex-start",
|
|
@@ -114,6 +130,7 @@ const ModalTest = forwardRef<any, IModalTypeActivities>(
|
|
|
114
130
|
{getIconByProperty(item.referencia as PropertyType)}
|
|
115
131
|
|
|
116
132
|
<Typography
|
|
133
|
+
testID={`${testID}-description-${index}`}
|
|
117
134
|
text={item.descricao}
|
|
118
135
|
size={theme.fontSizes.xs}
|
|
119
136
|
color={theme.colors.blue[500]}
|
|
@@ -132,6 +149,7 @@ const ModalTest = forwardRef<any, IModalTypeActivities>(
|
|
|
132
149
|
</Box>
|
|
133
150
|
|
|
134
151
|
<Button
|
|
152
|
+
testID={`${testID}-cancel-button`}
|
|
135
153
|
title={"CANCELAR ATIVIDADE"}
|
|
136
154
|
width="100%"
|
|
137
155
|
height={40}
|
|
@@ -165,9 +183,9 @@ const ModalTest = forwardRef<any, IModalTypeActivities>(
|
|
|
165
183
|
}
|
|
166
184
|
);
|
|
167
185
|
|
|
168
|
-
|
|
186
|
+
ModalTypeActivities.displayName = "ModalTypeActivities";
|
|
169
187
|
|
|
170
188
|
/**
|
|
171
189
|
* EXPORT
|
|
172
190
|
*/
|
|
173
|
-
export default asBaseComponent(
|
|
191
|
+
export default asBaseComponent(ModalTypeActivities);
|
|
@@ -27,6 +27,7 @@ import { theme } from "../../../styles/theme/theme";
|
|
|
27
27
|
* Componente Modal para alteração de atividade.
|
|
28
28
|
*/
|
|
29
29
|
export const ModalChangeActivity: React.FC<IModalChangeActivityProps> = ({
|
|
30
|
+
testID = "modal-change-activity",
|
|
30
31
|
visible,
|
|
31
32
|
onClose,
|
|
32
33
|
modalConfirm,
|
|
@@ -59,7 +60,7 @@ export const ModalChangeActivity: React.FC<IModalChangeActivityProps> = ({
|
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
return (
|
|
62
|
-
<Modal animationType="fade" transparent visible={visible}>
|
|
63
|
+
<Modal testID={testID} animationType="fade" transparent visible={visible}>
|
|
63
64
|
<View
|
|
64
65
|
style={{
|
|
65
66
|
flex: 1,
|
|
@@ -1,180 +1,180 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IMPORTS
|
|
3
|
-
*/
|
|
4
|
-
import React, { forwardRef, useState } from "react";
|
|
5
|
-
import { Modal, TouchableOpacity, Image, View } from "react-native";
|
|
6
|
-
|
|
7
|
-
// commons / icons
|
|
8
|
-
import { Icons } from "../../common/icons-svg";
|
|
9
|
-
|
|
10
|
-
// components
|
|
11
|
-
import Box from "../box";
|
|
12
|
-
import Typography from "../typography";
|
|
13
|
-
|
|
14
|
-
// typings
|
|
15
|
-
import type { INotificationDetailCardProps } from "./interface";
|
|
16
|
-
import { asBaseComponent } from "../../@types/as-base-component";
|
|
17
|
-
|
|
18
|
-
// styles / theme
|
|
19
|
-
import { theme } from "../../styles/theme/theme";
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Componente NotificationDetailCard
|
|
23
|
-
*/
|
|
24
|
-
const NotificationDetailCard: React.FC<INotificationDetailCardProps> = forwardRef<
|
|
25
|
-
View,
|
|
26
|
-
INotificationDetailCardProps
|
|
27
|
-
>(({ title, description, fileUrl, fileType = "image", testID }, ref) => {
|
|
28
|
-
const [visible, setVisible] = useState(false);
|
|
29
|
-
|
|
30
|
-
function openFile() {
|
|
31
|
-
if (fileType === "image") {
|
|
32
|
-
setVisible(true);
|
|
33
|
-
} else if (fileUrl) {
|
|
34
|
-
import("react-native").then(({ Linking }) => {
|
|
35
|
-
Linking.openURL(fileUrl).catch((err) => console.warn("Erro ao abrir arquivo:", err));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const borderColor = theme.colors.blue[500];
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<Box
|
|
44
|
-
ref={ref}
|
|
45
|
-
testID={testID ?? "notification-detail-card"}
|
|
46
|
-
flexStyle={{ flexDirection: "row" }}
|
|
47
|
-
borderStyled={{
|
|
48
|
-
borderWidth: 1,
|
|
49
|
-
borderColor: theme.colors.neutral[200],
|
|
50
|
-
borderRadius: theme.borderWidths.thick_medium,
|
|
51
|
-
}}
|
|
52
|
-
marginStyle={{ marginBottom: 16 }}
|
|
53
|
-
backgroundColor={theme.colors.neutral[25]}
|
|
54
|
-
>
|
|
55
|
-
{/* borda fixa lateral esquerda */}
|
|
56
|
-
<Box
|
|
57
|
-
width={8}
|
|
58
|
-
backgroundColor={borderColor}
|
|
59
|
-
borderStyled={{
|
|
60
|
-
borderTopLeftRadius: theme.borderWidths.thick_medium,
|
|
61
|
-
borderBottomLeftRadius: theme.borderWidths.thick_medium,
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
|
|
65
|
-
{/* Conteúdo do card */}
|
|
66
|
-
<Box flexStyle={{ flex: 1 }} paddingStyle={{ padding: theme.paddings.md }}>
|
|
67
|
-
{/* header */}
|
|
68
|
-
<Typography
|
|
69
|
-
text={title}
|
|
70
|
-
fontFamily={theme.fonts.inter_bold}
|
|
71
|
-
fontWeight="700"
|
|
72
|
-
size={theme.fontSizes.md}
|
|
73
|
-
color={theme.colors.black[100]}
|
|
74
|
-
marginBottom={8}
|
|
75
|
-
/>
|
|
76
|
-
|
|
77
|
-
{/* texto */}
|
|
78
|
-
<Typography
|
|
79
|
-
text={description}
|
|
80
|
-
size={theme.fontSizes.sm}
|
|
81
|
-
lineHeight={theme.lineHeight.md}
|
|
82
|
-
color={theme.colors.gray[700]}
|
|
83
|
-
marginBottom={fileUrl ? 12 : 0}
|
|
84
|
-
/>
|
|
85
|
-
|
|
86
|
-
{/* arquivo (se existir) */}
|
|
87
|
-
{fileUrl && (
|
|
88
|
-
<TouchableOpacity
|
|
89
|
-
testID="button"
|
|
90
|
-
onPress={openFile}
|
|
91
|
-
activeOpacity={0.8}
|
|
92
|
-
style={{
|
|
93
|
-
borderRadius: theme.borderWidths.thick_medium,
|
|
94
|
-
overflow: "hidden",
|
|
95
|
-
borderWidth: 1,
|
|
96
|
-
borderColor: theme.colors.gray[300],
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
{fileType === "image" ? (
|
|
100
|
-
<Box
|
|
101
|
-
borderStyled={{
|
|
102
|
-
borderWidth: 2,
|
|
103
|
-
borderColor: theme.colors.blue[525],
|
|
104
|
-
borderRadius: theme.borderWidths.thick_medium,
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<Image
|
|
108
|
-
source={{ uri: fileUrl }}
|
|
109
|
-
style={{
|
|
110
|
-
width: "100%",
|
|
111
|
-
height: 180,
|
|
112
|
-
borderRadius: theme.borderWidths.thick_medium,
|
|
113
|
-
borderWidth: 2,
|
|
114
|
-
borderColor: theme.colors.blue[525],
|
|
115
|
-
}}
|
|
116
|
-
resizeMode="cover"
|
|
117
|
-
/>
|
|
118
|
-
</Box>
|
|
119
|
-
) : (
|
|
120
|
-
<Box
|
|
121
|
-
flexStyle={{
|
|
122
|
-
flexDirection: "row",
|
|
123
|
-
alignItems: "center",
|
|
124
|
-
justifyContent: "space-between",
|
|
125
|
-
}}
|
|
126
|
-
paddingStyle={{ padding: theme.paddings.sm }}
|
|
127
|
-
>
|
|
128
|
-
<Typography
|
|
129
|
-
text={`Abrir arquivo (${fileType.toUpperCase()})`}
|
|
130
|
-
fontFamily={theme.fonts.inter_medium_500}
|
|
131
|
-
color={theme.colors.blue[500]}
|
|
132
|
-
size={theme.fontSizes.md}
|
|
133
|
-
/>
|
|
134
|
-
<Icons icon="FILES" size={20} color={theme.colors.blue[500]} />
|
|
135
|
-
</Box>
|
|
136
|
-
)}
|
|
137
|
-
</TouchableOpacity>
|
|
138
|
-
)}
|
|
139
|
-
</Box>
|
|
140
|
-
|
|
141
|
-
{/* modal para zoom da imagem */}
|
|
142
|
-
{fileType === "image" && (
|
|
143
|
-
<Modal visible={visible} transparent animationType="fade">
|
|
144
|
-
<View
|
|
145
|
-
style={{
|
|
146
|
-
flex: 1,
|
|
147
|
-
backgroundColor: "rgba(0,0,0,0.9)",
|
|
148
|
-
justifyContent: "center",
|
|
149
|
-
alignItems: "center",
|
|
150
|
-
}}
|
|
151
|
-
>
|
|
152
|
-
<TouchableOpacity
|
|
153
|
-
onPress={() => setVisible(false)}
|
|
154
|
-
style={{ position: "absolute", top: 40, right: 20 }}
|
|
155
|
-
>
|
|
156
|
-
<Icons icon="CLOSED" size={28} color={theme.colors.neutral[25]} />
|
|
157
|
-
</TouchableOpacity>
|
|
158
|
-
|
|
159
|
-
<Image
|
|
160
|
-
source={{ uri: fileUrl }}
|
|
161
|
-
style={{
|
|
162
|
-
width: "90%",
|
|
163
|
-
height: "70%",
|
|
164
|
-
borderRadius: theme.borderWidths.thick_medium,
|
|
165
|
-
}}
|
|
166
|
-
resizeMode="contain"
|
|
167
|
-
/>
|
|
168
|
-
</View>
|
|
169
|
-
</Modal>
|
|
170
|
-
)}
|
|
171
|
-
</Box>
|
|
172
|
-
);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
NotificationDetailCard.displayName = "NotificationDetailCard";
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* EXPORTS
|
|
179
|
-
*/
|
|
180
|
-
export default asBaseComponent(NotificationDetailCard);
|
|
1
|
+
/**
|
|
2
|
+
* IMPORTS
|
|
3
|
+
*/
|
|
4
|
+
import React, { forwardRef, useState } from "react";
|
|
5
|
+
import { Modal, TouchableOpacity, Image, View } from "react-native";
|
|
6
|
+
|
|
7
|
+
// commons / icons
|
|
8
|
+
import { Icons } from "../../common/icons-svg";
|
|
9
|
+
|
|
10
|
+
// components
|
|
11
|
+
import Box from "../box";
|
|
12
|
+
import Typography from "../typography";
|
|
13
|
+
|
|
14
|
+
// typings
|
|
15
|
+
import type { INotificationDetailCardProps } from "./interface";
|
|
16
|
+
import { asBaseComponent } from "../../@types/as-base-component";
|
|
17
|
+
|
|
18
|
+
// styles / theme
|
|
19
|
+
import { theme } from "../../styles/theme/theme";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Componente NotificationDetailCard
|
|
23
|
+
*/
|
|
24
|
+
const NotificationDetailCard: React.FC<INotificationDetailCardProps> = forwardRef<
|
|
25
|
+
View,
|
|
26
|
+
INotificationDetailCardProps
|
|
27
|
+
>(({ title, description, fileUrl, fileType = "image", testID }, ref) => {
|
|
28
|
+
const [visible, setVisible] = useState(false);
|
|
29
|
+
|
|
30
|
+
function openFile() {
|
|
31
|
+
if (fileType === "image") {
|
|
32
|
+
setVisible(true);
|
|
33
|
+
} else if (fileUrl) {
|
|
34
|
+
import("react-native").then(({ Linking }) => {
|
|
35
|
+
Linking.openURL(fileUrl).catch((err) => console.warn("Erro ao abrir arquivo:", err));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const borderColor = theme.colors.blue[500];
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Box
|
|
44
|
+
ref={ref}
|
|
45
|
+
testID={testID ?? "notification-detail-card"}
|
|
46
|
+
flexStyle={{ flexDirection: "row" }}
|
|
47
|
+
borderStyled={{
|
|
48
|
+
borderWidth: 1,
|
|
49
|
+
borderColor: theme.colors.neutral[200],
|
|
50
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
51
|
+
}}
|
|
52
|
+
marginStyle={{ marginBottom: 16 }}
|
|
53
|
+
backgroundColor={theme.colors.neutral[25]}
|
|
54
|
+
>
|
|
55
|
+
{/* borda fixa lateral esquerda */}
|
|
56
|
+
<Box
|
|
57
|
+
width={8}
|
|
58
|
+
backgroundColor={borderColor}
|
|
59
|
+
borderStyled={{
|
|
60
|
+
borderTopLeftRadius: theme.borderWidths.thick_medium,
|
|
61
|
+
borderBottomLeftRadius: theme.borderWidths.thick_medium,
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
{/* Conteúdo do card */}
|
|
66
|
+
<Box flexStyle={{ flex: 1 }} paddingStyle={{ padding: theme.paddings.md }}>
|
|
67
|
+
{/* header */}
|
|
68
|
+
<Typography
|
|
69
|
+
text={title}
|
|
70
|
+
fontFamily={theme.fonts.inter_bold}
|
|
71
|
+
fontWeight="700"
|
|
72
|
+
size={theme.fontSizes.md}
|
|
73
|
+
color={theme.colors.black[100]}
|
|
74
|
+
marginBottom={8}
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
{/* texto */}
|
|
78
|
+
<Typography
|
|
79
|
+
text={description}
|
|
80
|
+
size={theme.fontSizes.sm}
|
|
81
|
+
lineHeight={theme.lineHeight.md}
|
|
82
|
+
color={theme.colors.gray[700]}
|
|
83
|
+
marginBottom={fileUrl ? 12 : 0}
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
{/* arquivo (se existir) */}
|
|
87
|
+
{fileUrl && (
|
|
88
|
+
<TouchableOpacity
|
|
89
|
+
testID="button"
|
|
90
|
+
onPress={openFile}
|
|
91
|
+
activeOpacity={0.8}
|
|
92
|
+
style={{
|
|
93
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
94
|
+
overflow: "hidden",
|
|
95
|
+
borderWidth: 1,
|
|
96
|
+
borderColor: theme.colors.gray[300],
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
{fileType === "image" ? (
|
|
100
|
+
<Box
|
|
101
|
+
borderStyled={{
|
|
102
|
+
borderWidth: 2,
|
|
103
|
+
borderColor: theme.colors.blue[525],
|
|
104
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<Image
|
|
108
|
+
source={{ uri: fileUrl }}
|
|
109
|
+
style={{
|
|
110
|
+
width: "100%",
|
|
111
|
+
height: 180,
|
|
112
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
113
|
+
borderWidth: 2,
|
|
114
|
+
borderColor: theme.colors.blue[525],
|
|
115
|
+
}}
|
|
116
|
+
resizeMode="cover"
|
|
117
|
+
/>
|
|
118
|
+
</Box>
|
|
119
|
+
) : (
|
|
120
|
+
<Box
|
|
121
|
+
flexStyle={{
|
|
122
|
+
flexDirection: "row",
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
justifyContent: "space-between",
|
|
125
|
+
}}
|
|
126
|
+
paddingStyle={{ padding: theme.paddings.sm }}
|
|
127
|
+
>
|
|
128
|
+
<Typography
|
|
129
|
+
text={`Abrir arquivo (${fileType.toUpperCase()})`}
|
|
130
|
+
fontFamily={theme.fonts.inter_medium_500}
|
|
131
|
+
color={theme.colors.blue[500]}
|
|
132
|
+
size={theme.fontSizes.md}
|
|
133
|
+
/>
|
|
134
|
+
<Icons icon="FILES" size={20} color={theme.colors.blue[500]} />
|
|
135
|
+
</Box>
|
|
136
|
+
)}
|
|
137
|
+
</TouchableOpacity>
|
|
138
|
+
)}
|
|
139
|
+
</Box>
|
|
140
|
+
|
|
141
|
+
{/* modal para zoom da imagem */}
|
|
142
|
+
{fileType === "image" && (
|
|
143
|
+
<Modal visible={visible} transparent animationType="fade">
|
|
144
|
+
<View
|
|
145
|
+
style={{
|
|
146
|
+
flex: 1,
|
|
147
|
+
backgroundColor: "rgba(0,0,0,0.9)",
|
|
148
|
+
justifyContent: "center",
|
|
149
|
+
alignItems: "center",
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<TouchableOpacity
|
|
153
|
+
onPress={() => setVisible(false)}
|
|
154
|
+
style={{ position: "absolute", top: 40, right: 20 }}
|
|
155
|
+
>
|
|
156
|
+
<Icons icon="CLOSED" size={28} color={theme.colors.neutral[25]} />
|
|
157
|
+
</TouchableOpacity>
|
|
158
|
+
|
|
159
|
+
<Image
|
|
160
|
+
source={{ uri: fileUrl }}
|
|
161
|
+
style={{
|
|
162
|
+
width: "90%",
|
|
163
|
+
height: "70%",
|
|
164
|
+
borderRadius: theme.borderWidths.thick_medium,
|
|
165
|
+
}}
|
|
166
|
+
resizeMode="contain"
|
|
167
|
+
/>
|
|
168
|
+
</View>
|
|
169
|
+
</Modal>
|
|
170
|
+
)}
|
|
171
|
+
</Box>
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
NotificationDetailCard.displayName = "NotificationDetailCard";
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* EXPORTS
|
|
179
|
+
*/
|
|
180
|
+
export default asBaseComponent(NotificationDetailCard);
|