react-native-exp-fig 0.1.29 → 0.1.31

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.
Files changed (27) hide show
  1. package/lib/commonjs/components/modals/modal-activities/data-activities/index.js +34 -13
  2. package/lib/commonjs/components/modals/modal-activities/data-activities/index.js.map +1 -1
  3. package/lib/commonjs/components/modals/modal-activities/helpers/index.js +30 -0
  4. package/lib/commonjs/components/modals/modal-activities/helpers/index.js.map +1 -0
  5. package/lib/commonjs/components/modals/modal-activities/index.js +5 -4
  6. package/lib/commonjs/components/modals/modal-activities/index.js.map +1 -1
  7. package/lib/commonjs/components/modals/modal-activities/interface.d.js.map +1 -1
  8. package/lib/commonjs/components/selects/select-option/styles.js +10 -7
  9. package/lib/commonjs/components/selects/select-option/styles.js.map +1 -1
  10. package/lib/module/components/modals/modal-activities/data-activities/index.js +33 -12
  11. package/lib/module/components/modals/modal-activities/data-activities/index.js.map +1 -1
  12. package/lib/module/components/modals/modal-activities/helpers/index.js +24 -0
  13. package/lib/module/components/modals/modal-activities/helpers/index.js.map +1 -0
  14. package/lib/module/components/modals/modal-activities/index.js +5 -4
  15. package/lib/module/components/modals/modal-activities/index.js.map +1 -1
  16. package/lib/module/components/modals/modal-activities/interface.d.js.map +1 -1
  17. package/lib/module/components/selects/select-option/styles.js +10 -7
  18. package/lib/module/components/selects/select-option/styles.js.map +1 -1
  19. package/lib/typescript/src/components/modals/modal-activities/data-activities/index.d.ts +12 -17
  20. package/lib/typescript/src/components/modals/modal-activities/helpers/index.d.ts +11 -0
  21. package/lib/typescript/src/components/selects/select-option/styles.d.ts +6 -3
  22. package/package.json +1 -1
  23. package/src/components/modals/modal-activities/data-activities/index.ts +95 -65
  24. package/src/components/modals/modal-activities/helpers/index.ts +25 -0
  25. package/src/components/modals/modal-activities/index.tsx +138 -137
  26. package/src/components/modals/modal-activities/interface.d.ts +34 -32
  27. package/src/components/selects/select-option/styles.ts +78 -75
@@ -1 +1 @@
1
- {"version":3,"names":["StyleSheet","theme","styles","props","_props$sizeTitleLabel","_props$colortitleLabe","create","container","width","marginBottom","label","fontSize","sizeTitleLabel","fontWeight","color","colortitleLabel","colors","black","selectBox","flexDirection","alignItems","justifyContent","height","borderWidth","borderColor","gray","borderRadius","backgroundColor","neutral","paddingHorizontal","selectedText","modalOverlay","flex","padding","modalContainer","option","borderBottomWidth","borderBottomColor","optionText","closeButtonText"],"sources":["styles.ts"],"sourcesContent":["/**\n * IMPORTS\n */\nimport { StyleSheet } from \"react-native\";\n\n// typings\nimport { ISelectDropDownProps } from \"./interface\";\n\n// theme\nimport { theme } from \"../../../styles/theme/theme\";\n\nconst styles = (props: ISelectDropDownProps) =>\n StyleSheet.create({\n container: {\n width: \"100%\",\n marginBottom: 16,\n },\n label: {\n fontSize: props.sizeTitleLabel ?? 16,\n fontWeight: \"bold\",\n color: props.colortitleLabel ?? theme.colors.black[100],\n marginBottom: 5,\n },\n selectBox: {\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n width: \"100%\",\n height: 45,\n borderWidth: 1,\n borderColor: theme.colors.gray[700],\n borderRadius: 10,\n backgroundColor: theme.colors.neutral[25],\n paddingHorizontal: 10,\n },\n selectedText: {\n fontSize: 14,\n color: \"#666\",\n },\n modalOverlay: {\n flex: 1,\n backgroundColor: \"rgba(0,0,0,0.5)\",\n justifyContent: \"center\",\n alignItems: \"center\",\n padding: 24,\n },\n modalContainer: {\n width: \"100%\",\n backgroundColor: theme.colors.neutral[25],\n borderRadius: 10,\n padding: 15,\n alignItems: \"center\",\n },\n option: {\n width: \"100%\",\n padding: 10,\n alignItems: \"flex-start\",\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.gray[300],\n },\n optionText: {\n fontSize: 14,\n color: theme.colors.black[100],\n fontWeight: \"500\",\n },\n closeButtonText: {\n color: theme.colors.neutral[25],\n fontWeight: \"bold\",\n },\n });\n\n/**\n * EXPORTS\n */\nexport { styles };\n"],"mappings":"AA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1B,KAAK,CAACe,MAAM,CAACY,OAAO,CAAC,EAAE,CAAC;MACzCF,YAAY,EAAE,EAAE;MAChBO,OAAO,EAAE,EAAE;MACXb,UAAU,EAAE;IACd,CAAC;IACDe,MAAM,EAAE;MACN3B,KAAK,EAAE,MAAM;MACbyB,OAAO,EAAE,EAAE;MACXb,UAAU,EAAE,YAAY;MACxBgB,iBAAiB,EAAE,CAAC;MACpBC,iBAAiB,EAAEpC,KAAK,CAACe,MAAM,CAACS,IAAI,CAAC,GAAG;IAC1C,CAAC;IACDa,UAAU,EAAE;MACV3B,QAAQ,EAAE,EAAE;MACZG,KAAK,EAAEb,KAAK,CAACe,MAAM,CAACC,KAAK,CAAC,GAAG,CAAC;MAC9BJ,UAAU,EAAE;IACd,CAAC;IACD0B,eAAe,EAAE;MACfzB,KAAK,EAAEb,KAAK,CAACe,MAAM,CAACY,OAAO,CAAC,EAAE,CAAC;MAC/Bf,UAAU,EAAE;IACd;EACF,CAAC,CAAC;AAAA;;AAEJ;AACA;AACA;AACA,SAASX,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["StyleSheet","theme","styles","props","_props$sizeTitleLabel","_props$colortitleLabe","create","container","width","marginBottom","label","fontSize","sizeTitleLabel","fontWeight","color","colortitleLabel","colors","black","selectBox","flexDirection","alignItems","justifyContent","height","borderWidth","borderColor","gray","borderRadius","backgroundColor","neutral","paddingHorizontal","selectedText","modalOverlay","flex","padding","modalContainer","paddingVertical","option","paddingRight","paddingLeft","borderBottomWidth","borderBottomColor","optionText","closeButtonText"],"sources":["styles.ts"],"sourcesContent":["/**\r\n * IMPORTS\r\n */\r\nimport { StyleSheet } from \"react-native\";\r\n\r\n// typings\r\nimport { ISelectDropDownProps } from \"./interface\";\r\n\r\n// theme\r\nimport { theme } from \"../../../styles/theme/theme\";\r\n\r\nconst styles = (props: ISelectDropDownProps) =>\r\n StyleSheet.create({\r\n container: {\r\n width: \"100%\",\r\n marginBottom: 16,\r\n },\r\n label: {\r\n fontSize: props.sizeTitleLabel ?? 16,\r\n fontWeight: \"bold\",\r\n color: props.colortitleLabel ?? theme.colors.black[100],\r\n marginBottom: 5,\r\n },\r\n selectBox: {\r\n flexDirection: \"row\",\r\n alignItems: \"center\",\r\n justifyContent: \"space-between\",\r\n width: \"100%\",\r\n height: 45,\r\n borderWidth: 1,\r\n borderColor: theme.colors.gray[700],\r\n borderRadius: 10,\r\n backgroundColor: theme.colors.neutral[25],\r\n paddingHorizontal: 10,\r\n },\r\n selectedText: {\r\n fontSize: 14,\r\n color: \"#666\",\r\n },\r\n modalOverlay: {\r\n flex: 1,\r\n backgroundColor: \"rgba(0,0,0,0.5)\",\r\n justifyContent: \"center\",\r\n alignItems: \"center\",\r\n padding: 24,\r\n },\r\n modalContainer: {\r\n width: \"100%\",\r\n backgroundColor: theme.colors.neutral[25],\r\n borderRadius: 10,\r\n paddingVertical: 15,\r\n paddingHorizontal: 20,\r\n alignItems: \"stretch\",\r\n },\r\n option: {\r\n width: \"100%\",\r\n paddingVertical: 10,\r\n paddingRight: 10,\r\n paddingLeft: 0,\r\n alignItems: \"flex-start\",\r\n borderBottomWidth: 1,\r\n borderBottomColor: theme.colors.gray[300],\r\n },\r\n optionText: {\r\n fontSize: 14,\r\n color: theme.colors.black[100],\r\n fontWeight: \"500\",\r\n },\r\n closeButtonText: {\r\n color: theme.colors.neutral[25],\r\n fontWeight: \"bold\",\r\n },\r\n });\r\n\r\n/**\r\n * EXPORTS\r\n */\r\nexport { styles };\r\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,cAAc;;AAEzC;;AAGA;AACA,SAASC,KAAK,QAAQ,6BAA6B;AAEnD,MAAMC,MAAM,GAAIC,KAA2B;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAAA,OACzCL,UAAU,CAACM,MAAM,CAAC;IAChBC,SAAS,EAAE;MACTC,KAAK,EAAE,MAAM;MACbC,YAAY,EAAE;IAChB,CAAC;IACDC,KAAK,EAAE;MACLC,QAAQ,G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;MACxBmB,iBAAiB,EAAE,CAAC;MACpBC,iBAAiB,EAAEvC,KAAK,CAACe,MAAM,CAACS,IAAI,CAAC,GAAG;IAC1C,CAAC;IACDgB,UAAU,EAAE;MACV9B,QAAQ,EAAE,EAAE;MACZG,KAAK,EAAEb,KAAK,CAACe,MAAM,CAACC,KAAK,CAAC,GAAG,CAAC;MAC9BJ,UAAU,EAAE;IACd,CAAC;IACD6B,eAAe,EAAE;MACf5B,KAAK,EAAEb,KAAK,CAACe,MAAM,CAACY,OAAO,CAAC,EAAE,CAAC;MAC/Bf,UAAU,EAAE;IACd;EACF,CAAC,CAAC;AAAA;;AAEJ;AACA;AACA;AACA,SAASX,MAAM","ignoreList":[]}
@@ -1,19 +1,14 @@
1
1
  /**
2
- * dados para os tipos de atividades selecionado
2
+ * Tipagem da atividade
3
3
  */
4
- export declare const activities: {
5
- trabalho: {
6
- id: number;
7
- referencia: string;
8
- cor_hex: string;
9
- descricao: string;
10
- tipo: string;
11
- }[];
12
- descanso: {
13
- id: number;
14
- referencia: string;
15
- cor_hex: string;
16
- descricao: string;
17
- tipo: string;
18
- }[];
19
- };
4
+ export interface IActivity {
5
+ id: number;
6
+ referencia: string;
7
+ cor_hex: string;
8
+ descricao: string;
9
+ tipo: "trabalho" | "descanso";
10
+ }
11
+ /**
12
+ * Atividades específicas por tipo de usuário
13
+ */
14
+ export declare const activitiesByDriverType: Record<string, Record<string, IActivity[]>>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Função que retorna as atividades por tipo de atividade e tipo de usuário (normal ou carregador)
3
+ * @param driverType
4
+ * @param activityType
5
+ * @returns
6
+ */
7
+ declare const getActivitiesByType: (driverType: string, activityType: string) => import("../data-activities").IActivity[];
8
+ /**
9
+ * EXPORTS
10
+ */
11
+ export { getActivitiesByType };
@@ -37,12 +37,15 @@ declare const styles: (props: ISelectDropDownProps) => {
37
37
  width: "100%";
38
38
  backgroundColor: string;
39
39
  borderRadius: number;
40
- padding: number;
41
- alignItems: "center";
40
+ paddingVertical: number;
41
+ paddingHorizontal: number;
42
+ alignItems: "stretch";
42
43
  };
43
44
  option: {
44
45
  width: "100%";
45
- padding: number;
46
+ paddingVertical: number;
47
+ paddingRight: number;
48
+ paddingLeft: number;
46
49
  alignItems: "flex-start";
47
50
  borderBottomWidth: number;
48
51
  borderBottomColor: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-exp-fig",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Biblioteca para desenvolvimento dos componentes para utilizar nos app da Expresso Figueiredo.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,65 +1,95 @@
1
- /**
2
- * dados para os tipos de atividades selecionado
3
- */
4
- export const activities = {
5
- trabalho: [
6
- {
7
- id: 1,
8
- referencia: "operacao_veiculo",
9
- cor_hex: "000000",
10
- descricao: "Operação com Veículo",
11
- tipo: "trabalho",
12
- },
13
- {
14
- id: 2,
15
- referencia: "aguardando_carga",
16
- cor_hex: "000000",
17
- descricao: "Em carga",
18
- tipo: "trabalho",
19
- },
20
- {
21
- id: 3,
22
- referencia: "aguardando_descarga",
23
- cor_hex: "000000",
24
- descricao: "Em Descarga",
25
- tipo: "trabalho",
26
- },
27
- {
28
- id: 8,
29
- referencia: "disposicao_veiculo_parado",
30
- cor_hex: "000000",
31
- descricao: "Disposição com Veículo Parado",
32
- tipo: "trabalho",
33
- },
34
- ],
35
- descanso: [
36
- {
37
- id: 5,
38
- referencia: "repouso_semanal",
39
- cor_hex: "000000",
40
- descricao: "Repouso Semanal",
41
- tipo: "descanso",
42
- },
43
- {
44
- id: 6,
45
- referencia: "repouso_noturno",
46
- cor_hex: "000000",
47
- descricao: "Repouso Noturno",
48
- tipo: "descanso",
49
- },
50
- {
51
- id: 7,
52
- referencia: "refeicao",
53
- cor_hex: "000000",
54
- descricao: "Refeição",
55
- tipo: "descanso",
56
- },
57
- {
58
- id: 9,
59
- referencia: "descanso",
60
- cor_hex: "000000",
61
- descricao: "Descanso",
62
- tipo: "descanso",
63
- },
64
- ],
65
- };
1
+ /**
2
+ * Tipagem da atividade
3
+ */
4
+ export interface IActivity {
5
+ id: number;
6
+ referencia: string;
7
+ cor_hex: string;
8
+ descricao: string;
9
+ tipo: "trabalho" | "descanso";
10
+ }
11
+
12
+ /**
13
+ * Lista base de atividades padrão (normal)
14
+ */
15
+ const baseActivities: Record<string, IActivity[]> = {
16
+ trabalho: [
17
+ {
18
+ id: 1,
19
+ referencia: "operacao_veiculo",
20
+ cor_hex: "#000000",
21
+ descricao: "Operação com Veículo",
22
+ tipo: "trabalho",
23
+ },
24
+ {
25
+ id: 2,
26
+ referencia: "aguardando_carga",
27
+ cor_hex: "#000000",
28
+ descricao: "Em Carga",
29
+ tipo: "trabalho",
30
+ },
31
+ {
32
+ id: 3,
33
+ referencia: "aguardando_descarga",
34
+ cor_hex: "#000000",
35
+ descricao: "Em Descarga",
36
+ tipo: "trabalho",
37
+ },
38
+ {
39
+ id: 8,
40
+ referencia: "disposicao_veiculo_parado",
41
+ cor_hex: "#000000",
42
+ descricao: "Disposição com Veículo Parado",
43
+ tipo: "trabalho",
44
+ },
45
+ ],
46
+ descanso: [
47
+ {
48
+ id: 5,
49
+ referencia: "repouso_semanal",
50
+ cor_hex: "#000000",
51
+ descricao: "Repouso Semanal",
52
+ tipo: "descanso",
53
+ },
54
+ {
55
+ id: 6,
56
+ referencia: "repouso_noturno",
57
+ cor_hex: "#000000",
58
+ descricao: "Repouso Noturno",
59
+ tipo: "descanso",
60
+ },
61
+ {
62
+ id: 7,
63
+ referencia: "refeicao",
64
+ cor_hex: "#000000",
65
+ descricao: "Refeição",
66
+ tipo: "descanso",
67
+ },
68
+ {
69
+ id: 9,
70
+ referencia: "descanso",
71
+ cor_hex: "#000000",
72
+ descricao: "Descanso",
73
+ tipo: "descanso",
74
+ },
75
+ ],
76
+ };
77
+
78
+ /**
79
+ * Atividades específicas por tipo de usuário
80
+ */
81
+ export const activitiesByDriverType: Record<string, Record<string, IActivity[]>> = {
82
+ normal: baseActivities,
83
+ carregador: {
84
+ trabalho: [
85
+ {
86
+ id: 1,
87
+ referencia: "operacao_veiculo",
88
+ cor_hex: "#000000",
89
+ descricao: "Operação com Veículo",
90
+ tipo: "trabalho",
91
+ },
92
+ ],
93
+ descanso: baseActivities.descanso!,
94
+ },
95
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import { activitiesByDriverType } from "../data-activities";
5
+
6
+ /**
7
+ * Função que retorna as atividades por tipo de atividade e tipo de usuário (normal ou carregador)
8
+ * @param driverType
9
+ * @param activityType
10
+ * @returns
11
+ */
12
+ const getActivitiesByType = (driverType: string, activityType: string) => {
13
+ const driverActivities = activitiesByDriverType[driverType];
14
+
15
+ if (!driverActivities) {
16
+ return activitiesByDriverType["carregador"]![activityType] || [];
17
+ }
18
+
19
+ return driverActivities[activityType] || [];
20
+ };
21
+
22
+ /**
23
+ * EXPORTS
24
+ */
25
+ export { getActivitiesByType };
@@ -1,137 +1,138 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import React from "react";
5
- import { Modal, TouchableOpacity, FlatList } from "react-native";
6
-
7
- // components
8
-
9
- import Box from "../../box";
10
-
11
- // commons / icons
12
- import { Icons } from "../../../common/icons-svg";
13
- import { getIconModalActivities } from "../../../common/icons-svg/modal-activities";
14
-
15
- // styles
16
- import { theme } from "../../../styles/theme/theme";
17
- import { Typography } from "../../typography";
18
- import { Button } from "../../button";
19
-
20
- //typing
21
- import { IModalActivities, IActivity } from "./interface";
22
-
23
- // atividades
24
- import { activities } from "./data-activities";
25
-
26
- export const ModalActivities: React.FC<IModalActivities> = ({
27
- onClose,
28
- handleActivity,
29
- activityType,
30
- isLoading,
31
- style,
32
- }) => {
33
- return (
34
- <Modal animationType="fade" transparent={true} onRequestClose={onClose}>
35
- <Box
36
- backgroundColor={"rgba(0, 0, 0, 0.7)"}
37
- flexStyle={{ flex: 1, justifyContent: "center", alignItems: "center" }}
38
- >
39
- <Box
40
- height={310}
41
- width={"92%"}
42
- backgroundColor={theme.colors.neutral[25]}
43
- borderStyled={{
44
- borderColor: theme.colors.blue[500],
45
- borderWidth: theme.borderWidths.thick,
46
- borderRadius: theme.borderWidths.thick_medium,
47
- }}
48
- paddingStyle={{
49
- padding: theme.paddings.md,
50
- }}
51
- style={{ position: "relative" }}
52
- >
53
- <Box
54
- width={"100%"}
55
- flexStyle={{
56
- flexDirection: "row",
57
- justifyContent: "space-between",
58
- alignItems: "center",
59
- }}
60
- >
61
- <Typography
62
- text="Atividades"
63
- size={theme.fontSizes.md}
64
- color={theme.colors.blue[500]}
65
- fontFamily={theme.fonts.inter_bold_700}
66
- lineHeight={theme.fontSizes.xl}
67
- />
68
-
69
- <TouchableOpacity activeOpacity={0.7} onPress={onClose} style={{}}>
70
- <Icons icon="CLOSED" color={theme.colors.blue[500]} />
71
- </TouchableOpacity>
72
- </Box>
73
- {/* as atividades */}
74
- <Box marginStyle={{ marginTop: theme.margins["2xl"] }}>
75
- <FlatList
76
- data={activities[activityType]}
77
- numColumns={3}
78
- keyExtractor={(item) => item.id.toString()}
79
- scrollEnabled={false}
80
- renderItem={({ item }) => (
81
- <TouchableOpacity
82
- style={{
83
- alignItems: "center",
84
- width: 110,
85
- marginBottom: theme.margins["2xl"], // espaço entre as linhas
86
- }}
87
- onPress={() => handleActivity(item as IActivity)}
88
- >
89
- {getIconModalActivities(item.referencia)}
90
-
91
- <Typography
92
- text={item.descricao}
93
- size={theme.fontSizes.xs}
94
- color={theme.colors.blue[500]}
95
- lineHeight={theme.fontSizes.md}
96
- fontFamily={theme.fonts.inter_medium_500}
97
- fontWeight="500"
98
- align="center"
99
- marginTop={5}
100
- />
101
- </TouchableOpacity>
102
- )}
103
- />
104
- </Box>
105
-
106
- <Button
107
- title={"CANCELAR ATIVIDADE"}
108
- width="100%"
109
- height={40}
110
- activeOpacity={0.7}
111
- onPress={onClose}
112
- backgroundColor={theme.colors.blue[500]}
113
- buttonTextStyle={{
114
- color: theme.colors.neutral[25],
115
- fontFamily: theme.fonts.inter_medium_500,
116
- fontSize: theme.fontSizes.md,
117
- fontWeight: "500",
118
- }}
119
- flexStyle={{
120
- flexDirection: "row",
121
- alignItems: "center",
122
- justifyContent: "center",
123
- }}
124
- borderStyled={{
125
- borderWidth: theme.borderWidths.thin,
126
- borderColor: theme.colors.blue[500],
127
- borderRadius: theme.borderWidths.thick_medium,
128
- }}
129
- marginStyle={{ marginLeft: theme.margins.md }}
130
- isLoading={isLoading ?? false}
131
- style={[style, { position: "absolute", bottom: 10, left: 0 }]}
132
- />
133
- </Box>
134
- </Box>
135
- </Modal>
136
- );
137
- };
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import React from "react";
5
+ import { Modal, TouchableOpacity, FlatList } from "react-native";
6
+
7
+ // components
8
+
9
+ import Box from "../../box";
10
+
11
+ // commons / icons
12
+ import { Icons } from "../../../common/icons-svg";
13
+ import { getIconModalActivities } from "../../../common/icons-svg/modal-activities";
14
+
15
+ // styles
16
+ import { theme } from "../../../styles/theme/theme";
17
+ import { Typography } from "../../typography";
18
+ import { Button } from "../../button";
19
+
20
+ //typing
21
+ import { IModalActivities, IActivity } from "./interface";
22
+
23
+ // atividades
24
+ import { getActivitiesByType } from "./helpers";
25
+
26
+ export const ModalActivities: React.FC<IModalActivities> = ({
27
+ onClose,
28
+ handleActivity,
29
+ activityType,
30
+ driverType = "carregador",
31
+ isLoading,
32
+ style,
33
+ }) => {
34
+ return (
35
+ <Modal animationType="fade" transparent={true} onRequestClose={onClose}>
36
+ <Box
37
+ backgroundColor={"rgba(0, 0, 0, 0.7)"}
38
+ flexStyle={{ flex: 1, justifyContent: "center", alignItems: "center" }}
39
+ >
40
+ <Box
41
+ height={310}
42
+ width={"92%"}
43
+ backgroundColor={theme.colors.neutral[25]}
44
+ borderStyled={{
45
+ borderColor: theme.colors.blue[500],
46
+ borderWidth: theme.borderWidths.thick,
47
+ borderRadius: theme.borderWidths.thick_medium,
48
+ }}
49
+ paddingStyle={{
50
+ padding: theme.paddings.md,
51
+ }}
52
+ style={{ position: "relative" }}
53
+ >
54
+ <Box
55
+ width={"100%"}
56
+ flexStyle={{
57
+ flexDirection: "row",
58
+ justifyContent: "space-between",
59
+ alignItems: "center",
60
+ }}
61
+ >
62
+ <Typography
63
+ text="Atividades"
64
+ size={theme.fontSizes.md}
65
+ color={theme.colors.blue[500]}
66
+ fontFamily={theme.fonts.inter_bold_700}
67
+ lineHeight={theme.fontSizes.xl}
68
+ />
69
+
70
+ <TouchableOpacity activeOpacity={0.7} onPress={onClose} style={{}}>
71
+ <Icons icon="CLOSED" color={theme.colors.blue[500]} />
72
+ </TouchableOpacity>
73
+ </Box>
74
+ {/* as atividades */}
75
+ <Box marginStyle={{ marginTop: theme.margins["2xl"] }}>
76
+ <FlatList
77
+ data={getActivitiesByType(driverType, activityType)}
78
+ numColumns={3}
79
+ keyExtractor={(item) => item.id.toString()}
80
+ scrollEnabled={false}
81
+ renderItem={({ item }) => (
82
+ <TouchableOpacity
83
+ style={{
84
+ alignItems: "center",
85
+ width: 110,
86
+ marginBottom: theme.margins["2xl"], // espaço entre as linhas
87
+ }}
88
+ onPress={() => handleActivity(item as IActivity)}
89
+ >
90
+ {getIconModalActivities(item.referencia)}
91
+
92
+ <Typography
93
+ text={item.descricao}
94
+ size={theme.fontSizes.xs}
95
+ color={theme.colors.blue[500]}
96
+ lineHeight={theme.fontSizes.md}
97
+ fontFamily={theme.fonts.inter_medium_500}
98
+ fontWeight="500"
99
+ align="center"
100
+ marginTop={5}
101
+ />
102
+ </TouchableOpacity>
103
+ )}
104
+ />
105
+ </Box>
106
+
107
+ <Button
108
+ title={"CANCELAR ATIVIDADE"}
109
+ width="100%"
110
+ height={40}
111
+ activeOpacity={0.7}
112
+ onPress={onClose}
113
+ backgroundColor={theme.colors.blue[500]}
114
+ buttonTextStyle={{
115
+ color: theme.colors.neutral[25],
116
+ fontFamily: theme.fonts.inter_medium_500,
117
+ fontSize: theme.fontSizes.md,
118
+ fontWeight: "500",
119
+ }}
120
+ flexStyle={{
121
+ flexDirection: "row",
122
+ alignItems: "center",
123
+ justifyContent: "center",
124
+ }}
125
+ borderStyled={{
126
+ borderWidth: theme.borderWidths.thin,
127
+ borderColor: theme.colors.blue[500],
128
+ borderRadius: theme.borderWidths.thick_medium,
129
+ }}
130
+ marginStyle={{ marginLeft: theme.margins.md }}
131
+ isLoading={isLoading ?? false}
132
+ style={[style, { position: "absolute", bottom: 10, left: 0 }]}
133
+ />
134
+ </Box>
135
+ </Box>
136
+ </Modal>
137
+ );
138
+ };
@@ -1,32 +1,34 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import { ModalProps } from "react-native";
5
-
6
- // typing
7
- import { IGlobalCss } from "../../../styles/global/interface";
8
-
9
- interface IActivity {
10
- id: number;
11
- referencia: string;
12
- cor_hex: string;
13
- descricao: string;
14
- tipo: "trabalho" | "descanso";
15
- }
16
-
17
- interface IModalActivities extends ModalProps, IGlobalCss {
18
- /** função que fecha modal */
19
- onClose: () => void;
20
-
21
- /** tipo de atividades */
22
- activityType: IActivity["tipo"];
23
-
24
- /** função que manda atividade selecionada */
25
- // eslint-disable-next-line no-unused-vars
26
- handleActivity: (activity: IActivity) => void;
27
- }
28
-
29
- /**
30
- * EXPORTS
31
- */
32
- export { IModalActivities, IActivity };
1
+ /**
2
+ * IMPORTS
3
+ */
4
+ import { ModalProps } from "react-native";
5
+
6
+ // typing
7
+ import { IGlobalCss } from "../../../styles/global/interface";
8
+
9
+ interface IActivity {
10
+ id: number;
11
+ referencia: string;
12
+ cor_hex: string;
13
+ descricao: string;
14
+ tipo: "trabalho" | "descanso";
15
+ }
16
+
17
+ interface IModalActivities extends ModalProps, IGlobalCss {
18
+ /** função que fecha modal */
19
+ onClose: () => void;
20
+
21
+ /** tipo de atividades */
22
+ activityType: IActivity["tipo"];
23
+
24
+ /** função que manda atividade selecionada */
25
+ // eslint-disable-next-line no-unused-vars
26
+ handleActivity: (activity: IActivity) => void;
27
+
28
+ driverType?: "normal" | "carregador";
29
+ }
30
+
31
+ /**
32
+ * EXPORTS
33
+ */
34
+ export { IModalActivities, IActivity };