react-native-exp-fig 0.1.21 → 0.1.23

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 (228) hide show
  1. package/lib/commonjs/@types/as-base-component.js +12 -0
  2. package/lib/commonjs/@types/as-base-component.js.map +1 -0
  3. package/lib/commonjs/common/icons-svg/constants/index.js +2 -1
  4. package/lib/commonjs/common/icons-svg/constants/index.js.map +1 -1
  5. package/lib/commonjs/common/icons-svg/eclamation-triangle/index.js +33 -0
  6. package/lib/commonjs/common/icons-svg/eclamation-triangle/index.js.map +1 -0
  7. package/lib/commonjs/common/icons-svg/index.js +8 -0
  8. package/lib/commonjs/common/icons-svg/index.js.map +1 -1
  9. package/lib/commonjs/common/icons-svg/truck/index.js +2 -2
  10. package/lib/commonjs/common/icons-svg/truck/index.js.map +1 -1
  11. package/lib/commonjs/components/activities-daily/index.js +9 -9
  12. package/lib/commonjs/components/activities-daily/index.js.map +1 -1
  13. package/lib/commonjs/components/activities-progress/index.js +14 -14
  14. package/lib/commonjs/components/activities-progress/index.js.map +1 -1
  15. package/lib/commonjs/components/avatar-profile/index.js +4 -4
  16. package/lib/commonjs/components/avatar-profile/index.js.map +1 -1
  17. package/lib/commonjs/components/box/index.js +27 -22
  18. package/lib/commonjs/components/box/index.js.map +1 -1
  19. package/lib/commonjs/components/box/interface.d.js.map +1 -1
  20. package/lib/commonjs/components/box/styles.js.map +1 -1
  21. package/lib/commonjs/components/card-history/index.js +16 -16
  22. package/lib/commonjs/components/card-history/index.js.map +1 -1
  23. package/lib/commonjs/components/card-hours/index.js +3 -3
  24. package/lib/commonjs/components/card-hours/index.js.map +1 -1
  25. package/lib/commonjs/components/card-loading/index.js +13 -13
  26. package/lib/commonjs/components/card-loading/index.js.map +1 -1
  27. package/lib/commonjs/components/card-scheduled-journey/index.js +6 -6
  28. package/lib/commonjs/components/card-scheduled-journey/index.js.map +1 -1
  29. package/lib/commonjs/components/card-work-session/index.js +12 -12
  30. package/lib/commonjs/components/card-work-session/index.js.map +1 -1
  31. package/lib/commonjs/components/check-box/index.js +5 -5
  32. package/lib/commonjs/components/check-box/index.js.map +1 -1
  33. package/lib/commonjs/components/coil/index.js +5 -5
  34. package/lib/commonjs/components/coil/index.js.map +1 -1
  35. package/lib/commonjs/components/filter-date-selector/index.js +2 -2
  36. package/lib/commonjs/components/filter-date-selector/index.js.map +1 -1
  37. package/lib/commonjs/components/header-profile/index.js +8 -8
  38. package/lib/commonjs/components/header-profile/index.js.map +1 -1
  39. package/lib/commonjs/components/history-activities-card/index.js +198 -0
  40. package/lib/commonjs/components/history-activities-card/index.js.map +1 -0
  41. package/lib/commonjs/components/history-activities-card/interface.js +6 -0
  42. package/lib/commonjs/components/history-activities-card/interface.js.map +1 -0
  43. package/lib/commonjs/components/history-details/index.js +5 -5
  44. package/lib/commonjs/components/history-details/index.js.map +1 -1
  45. package/lib/commonjs/components/image-capture-with-remove/index.js +2 -2
  46. package/lib/commonjs/components/image-capture-with-remove/index.js.map +1 -1
  47. package/lib/commonjs/components/input/index.js +11 -11
  48. package/lib/commonjs/components/input/index.js.map +1 -1
  49. package/lib/commonjs/components/loading-details/index.js +10 -10
  50. package/lib/commonjs/components/loading-details/index.js.map +1 -1
  51. package/lib/commonjs/components/loading-progress/index.js +5 -5
  52. package/lib/commonjs/components/loading-progress/index.js.map +1 -1
  53. package/lib/commonjs/components/menu-item/index.js +3 -3
  54. package/lib/commonjs/components/menu-item/index.js.map +1 -1
  55. package/lib/commonjs/components/modal-activities/index.js +5 -5
  56. package/lib/commonjs/components/modal-activities/index.js.map +1 -1
  57. package/lib/commonjs/components/modal-change-activity/index.js +217 -0
  58. package/lib/commonjs/components/modal-change-activity/index.js.map +1 -0
  59. package/lib/commonjs/components/no-data/index.js +2 -2
  60. package/lib/commonjs/components/no-data/index.js.map +1 -1
  61. package/lib/commonjs/components/notification-loading/index.js +12 -12
  62. package/lib/commonjs/components/notification-loading/index.js.map +1 -1
  63. package/lib/commonjs/components/profile-menu-option/index.js +3 -3
  64. package/lib/commonjs/components/profile-menu-option/index.js.map +1 -1
  65. package/lib/commonjs/components/scheduled-journey-indicators/index.js +4 -4
  66. package/lib/commonjs/components/scheduled-journey-indicators/index.js.map +1 -1
  67. package/lib/commonjs/components/selects/select-option/index.js +28 -11
  68. package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
  69. package/lib/commonjs/components/selects/select-option/interface.d.js.map +1 -1
  70. package/lib/commonjs/components/step-indicator/index.js +45 -7
  71. package/lib/commonjs/components/step-indicator/index.js.map +1 -1
  72. package/lib/commonjs/components/user-profile/index.js +9 -9
  73. package/lib/commonjs/components/user-profile/index.js.map +1 -1
  74. package/lib/commonjs/helpers/text-utils.js +21 -0
  75. package/lib/commonjs/helpers/text-utils.js.map +1 -0
  76. package/lib/commonjs/index.js +17 -2
  77. package/lib/commonjs/index.js.map +1 -1
  78. package/lib/commonjs/stories/box/box.stories.js +2 -2
  79. package/lib/commonjs/stories/box/box.stories.js.map +1 -1
  80. package/lib/commonjs/stories/history-activities-card/history-activities-card.stories.js +104 -0
  81. package/lib/commonjs/stories/history-activities-card/history-activities-card.stories.js.map +1 -0
  82. package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js +52 -0
  83. package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -0
  84. package/lib/commonjs/utils/get-icon-by-property/index.js.map +1 -1
  85. package/lib/module/@types/as-base-component.js +6 -0
  86. package/lib/module/@types/as-base-component.js.map +1 -0
  87. package/lib/module/common/icons-svg/constants/index.js +2 -1
  88. package/lib/module/common/icons-svg/constants/index.js.map +1 -1
  89. package/lib/module/common/icons-svg/eclamation-triangle/index.js +25 -0
  90. package/lib/module/common/icons-svg/eclamation-triangle/index.js.map +1 -0
  91. package/lib/module/common/icons-svg/index.js +8 -0
  92. package/lib/module/common/icons-svg/index.js.map +1 -1
  93. package/lib/module/common/icons-svg/truck/index.js +2 -2
  94. package/lib/module/common/icons-svg/truck/index.js.map +1 -1
  95. package/lib/module/components/activities-daily/index.js +5 -5
  96. package/lib/module/components/activities-daily/index.js.map +1 -1
  97. package/lib/module/components/activities-progress/index.js +5 -5
  98. package/lib/module/components/activities-progress/index.js.map +1 -1
  99. package/lib/module/components/avatar-profile/index.js +1 -1
  100. package/lib/module/components/avatar-profile/index.js.map +1 -1
  101. package/lib/module/components/box/index.js +24 -21
  102. package/lib/module/components/box/index.js.map +1 -1
  103. package/lib/module/components/box/interface.d.js.map +1 -1
  104. package/lib/module/components/box/styles.js.map +1 -1
  105. package/lib/module/components/card-history/index.js +8 -8
  106. package/lib/module/components/card-history/index.js.map +1 -1
  107. package/lib/module/components/card-hours/index.js +1 -1
  108. package/lib/module/components/card-hours/index.js.map +1 -1
  109. package/lib/module/components/card-loading/index.js +1 -1
  110. package/lib/module/components/card-loading/index.js.map +1 -1
  111. package/lib/module/components/card-scheduled-journey/index.js +1 -1
  112. package/lib/module/components/card-scheduled-journey/index.js.map +1 -1
  113. package/lib/module/components/card-work-session/index.js +1 -1
  114. package/lib/module/components/card-work-session/index.js.map +1 -1
  115. package/lib/module/components/check-box/index.js +1 -1
  116. package/lib/module/components/check-box/index.js.map +1 -1
  117. package/lib/module/components/coil/index.js +1 -1
  118. package/lib/module/components/coil/index.js.map +1 -1
  119. package/lib/module/components/filter-date-selector/index.js +1 -1
  120. package/lib/module/components/filter-date-selector/index.js.map +1 -1
  121. package/lib/module/components/header-profile/index.js +1 -1
  122. package/lib/module/components/header-profile/index.js.map +1 -1
  123. package/lib/module/components/history-activities-card/index.js +190 -0
  124. package/lib/module/components/history-activities-card/index.js.map +1 -0
  125. package/lib/module/components/history-activities-card/interface.js +2 -0
  126. package/lib/module/components/history-activities-card/interface.js.map +1 -0
  127. package/lib/module/components/history-details/index.js +1 -1
  128. package/lib/module/components/history-details/index.js.map +1 -1
  129. package/lib/module/components/image-capture-with-remove/index.js +1 -1
  130. package/lib/module/components/image-capture-with-remove/index.js.map +1 -1
  131. package/lib/module/components/input/index.js +1 -1
  132. package/lib/module/components/input/index.js.map +1 -1
  133. package/lib/module/components/loading-details/index.js +5 -5
  134. package/lib/module/components/loading-details/index.js.map +1 -1
  135. package/lib/module/components/loading-progress/index.js +1 -1
  136. package/lib/module/components/loading-progress/index.js.map +1 -1
  137. package/lib/module/components/menu-item/index.js +1 -1
  138. package/lib/module/components/menu-item/index.js.map +1 -1
  139. package/lib/module/components/modal-activities/index.js +1 -1
  140. package/lib/module/components/modal-activities/index.js.map +1 -1
  141. package/lib/module/components/modal-change-activity/index.js +208 -0
  142. package/lib/module/components/modal-change-activity/index.js.map +1 -0
  143. package/lib/module/components/no-data/index.js +1 -1
  144. package/lib/module/components/no-data/index.js.map +1 -1
  145. package/lib/module/components/notification-loading/index.js +5 -5
  146. package/lib/module/components/notification-loading/index.js.map +1 -1
  147. package/lib/module/components/profile-menu-option/index.js +1 -1
  148. package/lib/module/components/profile-menu-option/index.js.map +1 -1
  149. package/lib/module/components/scheduled-journey-indicators/index.js +1 -1
  150. package/lib/module/components/scheduled-journey-indicators/index.js.map +1 -1
  151. package/lib/module/components/selects/select-option/index.js +28 -11
  152. package/lib/module/components/selects/select-option/index.js.map +1 -1
  153. package/lib/module/components/selects/select-option/interface.d.js.map +1 -1
  154. package/lib/module/components/step-indicator/index.js +45 -7
  155. package/lib/module/components/step-indicator/index.js.map +1 -1
  156. package/lib/module/components/user-profile/index.js +1 -1
  157. package/lib/module/components/user-profile/index.js.map +1 -1
  158. package/lib/module/helpers/text-utils.js +14 -0
  159. package/lib/module/helpers/text-utils.js.map +1 -0
  160. package/lib/module/index.js +3 -1
  161. package/lib/module/index.js.map +1 -1
  162. package/lib/module/stories/box/box.stories.js +1 -1
  163. package/lib/module/stories/box/box.stories.js.map +1 -1
  164. package/lib/module/stories/history-activities-card/history-activities-card.stories.js +97 -0
  165. package/lib/module/stories/history-activities-card/history-activities-card.stories.js.map +1 -0
  166. package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js +45 -0
  167. package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -0
  168. package/lib/module/utils/get-icon-by-property/index.js +0 -1
  169. package/lib/module/utils/get-icon-by-property/index.js.map +1 -1
  170. package/lib/typescript/src/@types/as-base-component.d.ts +2 -0
  171. package/lib/typescript/src/common/icons-svg/constants/index.d.ts +1 -0
  172. package/lib/typescript/src/common/icons-svg/eclamation-triangle/index.d.ts +4 -0
  173. package/lib/typescript/src/components/box/index.d.ts +4 -3
  174. package/lib/typescript/src/components/box/styles.d.ts +2 -2
  175. package/lib/typescript/src/components/history-activities-card/index.d.ts +76 -0
  176. package/lib/typescript/src/components/history-activities-card/interface.d.ts +120 -0
  177. package/lib/typescript/src/components/modal-change-activity/index.d.ts +24 -0
  178. package/lib/typescript/src/helpers/text-utils.d.ts +7 -0
  179. package/lib/typescript/src/index.d.ts +3 -1
  180. package/lib/typescript/src/stories/box/box.stories.d.ts +1 -1
  181. package/lib/typescript/src/stories/history-activities-card/history-activities-card.stories.d.ts +10 -0
  182. package/lib/typescript/src/stories/modal-change-activity/modal-change-activity.stories.d.ts +9 -0
  183. package/lib/typescript/src/utils/get-icon-by-property/index.d.ts +2 -1
  184. package/package.json +11 -8
  185. package/src/@types/as-base-component.ts +9 -0
  186. package/src/common/icons-svg/constants/index.ts +1 -0
  187. package/src/common/icons-svg/eclamation-triangle/index.tsx +46 -0
  188. package/src/common/icons-svg/index.tsx +5 -1
  189. package/src/common/icons-svg/truck/index.tsx +2 -2
  190. package/src/components/activities-daily/index.tsx +116 -116
  191. package/src/components/activities-progress/index.tsx +170 -170
  192. package/src/components/avatar-profile/index.tsx +1 -1
  193. package/src/components/box/index.tsx +28 -22
  194. package/src/components/box/interface.d.ts +2 -2
  195. package/src/components/box/styles.ts +2 -2
  196. package/src/components/card-history/index.tsx +221 -221
  197. package/src/components/card-hours/index.tsx +2 -1
  198. package/src/components/card-loading/index.tsx +1 -1
  199. package/src/components/card-scheduled-journey/index.tsx +1 -1
  200. package/src/components/card-work-session/index.tsx +1 -1
  201. package/src/components/check-box/index.tsx +1 -1
  202. package/src/components/coil/index.tsx +1 -1
  203. package/src/components/filter-date-selector/index.tsx +1 -1
  204. package/src/components/header-profile/index.tsx +1 -1
  205. package/src/components/history-activities-card/index.tsx +217 -0
  206. package/src/components/history-activities-card/interface.ts +147 -0
  207. package/src/components/history-details/index.tsx +1 -1
  208. package/src/components/image-capture-with-remove/index.tsx +1 -1
  209. package/src/components/input/index.tsx +1 -1
  210. package/src/components/loading-details/index.tsx +156 -156
  211. package/src/components/loading-progress/index.tsx +1 -1
  212. package/src/components/menu-item/index.tsx +1 -1
  213. package/src/components/modal-activities/index.tsx +1 -1
  214. package/src/components/modal-change-activity/index.tsx +200 -0
  215. package/src/components/no-data/index.tsx +1 -1
  216. package/src/components/notification-loading/index.tsx +157 -157
  217. package/src/components/profile-menu-option/index.tsx +1 -1
  218. package/src/components/scheduled-journey-indicators/index.tsx +1 -1
  219. package/src/components/selects/select-option/index.tsx +115 -100
  220. package/src/components/selects/select-option/interface.d.ts +18 -18
  221. package/src/components/step-indicator/index.tsx +63 -7
  222. package/src/components/user-profile/index.tsx +1 -1
  223. package/src/helpers/text-utils.ts +15 -0
  224. package/src/index.ts +3 -1
  225. package/src/stories/box/box.stories.tsx +1 -1
  226. package/src/stories/history-activities-card/history-activities-card.stories.tsx +107 -0
  227. package/src/stories/modal-change-activity/modal-change-activity.stories.tsx +51 -0
  228. package/src/utils/get-icon-by-property/index.tsx +13 -1
@@ -14,6 +14,7 @@ import { styles } from "./styles";
14
14
  import { Icons } from "../../common/icons-svg";
15
15
  import { formHoursMinute } from "../../utils/format-data";
16
16
  import { theme } from "../../styles/theme/theme";
17
+ import { ModalChangeActivity } from "../modal-change-activity";
17
18
 
18
19
  /**
19
20
  * Componente StepIndicator para a interação da ui.
@@ -27,13 +28,54 @@ const StepIndicator: React.FC<IStepIndicator> = ({
27
28
  titleNumberColor,
28
29
  }) => {
29
30
  const StepDefault = () => {
31
+ const [isModalVisible, setIsModalVisible] = React.useState(false);
32
+ const [currentStepIndex, setCurrentStepIndex] = React.useState<number | null>(null);
33
+ const [stepData, setStepData] = React.useState(data);
34
+
35
+ const handleOpenModal = (index: number) => {
36
+ const stepItem = stepData[index];
37
+ const desc = stepItem?.descricao?.toLowerCase?.();
38
+ if (!desc) return;
39
+
40
+ const isDescanso = [
41
+ "descanso",
42
+ "refeição",
43
+ "repouso_noturno",
44
+ "repouso_semanal",
45
+ ].includes(desc.replace(/\s+/g, "_"));
46
+
47
+ // Só abre o modal se for do tipo descanso E se estiver sincronizado
48
+ if (isDescanso && stepItem?.sincronizado === true) {
49
+ setCurrentStepIndex(index);
50
+ setIsModalVisible(true);
51
+ }
52
+ };
53
+
54
+ const handleConfirmModal = (newData: { label: string; value: string; key: number }) => {
55
+ if (currentStepIndex !== null) {
56
+ const newSteps = stepData.map((item, index) =>
57
+ index === currentStepIndex
58
+ ? { ...item, descricao: newData.label, tipo_atividade: newData.value, identificador: newData.key }
59
+ : item
60
+ );
61
+ setStepData(newSteps);
62
+ }
63
+
64
+ setIsModalVisible(false);
65
+ setCurrentStepIndex(null);
66
+ };
67
+
30
68
  return (
31
69
  <>
32
- {data!.length > 0 &&
33
- data!.map((history, index) => (
34
- <View testID="step-indicator" style={styles({}).containerIndicator} key={history.id}>
70
+ {stepData.length > 0 &&
71
+ stepData.map((history, index) => (
72
+ <View
73
+ testID="step-indicator"
74
+ style={styles({}).containerIndicator}
75
+ key={`${history.id}-${index}`}
76
+ >
35
77
  <View style={styles({ sincronizado: history.sincronizado }).containerBall}>
36
- {data!?.length > 1 && index < data!?.length - 1 && (
78
+ {stepData.length > 1 && index < stepData.length - 1 && (
37
79
  <View
38
80
  style={{
39
81
  width: 2,
@@ -47,16 +89,19 @@ const StepIndicator: React.FC<IStepIndicator> = ({
47
89
  />
48
90
  )}
49
91
  <Text style={styles({ titleNumberColor }).titleNumber}>
50
- {data!?.length - index}
92
+ {stepData.length - index}
51
93
  </Text>
52
94
  </View>
53
95
 
54
- <View style={styles({}).containerMain}>
96
+ <View
97
+ style={styles({}).containerMain}
98
+ onTouchEnd={() => handleOpenModal(index)}
99
+ >
55
100
  <Text style={styles({ titleColor }).title}>{history?.descricao}</Text>
56
101
 
57
102
  {history?.data_inicio && (
58
103
  <Text style={styles({ textColorDescription }).titleDescription}>
59
- {`Inicio: ${history.data_inicio} ás ${history.data_fim}`}
104
+ {`Inicio: ${history.data_inicio} às ${history.data_fim}`}
60
105
  </Text>
61
106
  )}
62
107
 
@@ -68,10 +113,21 @@ const StepIndicator: React.FC<IStepIndicator> = ({
68
113
  </View>
69
114
  </View>
70
115
  ))}
116
+
117
+ {isModalVisible && currentStepIndex !== null && (
118
+ <ModalChangeActivity
119
+ visible={isModalVisible}
120
+ onClose={() => setIsModalVisible(false)}
121
+ modalConfirm={handleConfirmModal}
122
+ dataRegistro={""}
123
+ descricao={stepData[currentStepIndex!]?.descricao || ""}
124
+ />
125
+ )}
71
126
  </>
72
127
  );
73
128
  };
74
129
 
130
+
75
131
  const StepCustom = () => {
76
132
  return (
77
133
  <View
@@ -5,7 +5,7 @@ import React from "react";
5
5
  import { Image, TouchableOpacity } from "react-native";
6
6
 
7
7
  // components
8
- import { Box } from "../box";
8
+ import Box from "../box";
9
9
  import { Typography } from "../typography";
10
10
 
11
11
  // comons / constants
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Função para limitar a quantidade de caracteres de um texto
3
+ * @param text - O texto a ser limitado
4
+ * @param maxLength - Número máximo de caracteres (padrão: 20)
5
+ * @returns Texto limitado com "..." se exceder o limite
6
+ */
7
+ export const truncateText = (text: string, maxLength: number = 20): string => {
8
+ if (!text) return "";
9
+
10
+ if (text.length <= maxLength) {
11
+ return text;
12
+ }
13
+
14
+ return text.substring(0, maxLength) + "...";
15
+ };
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  // Components
6
- export { Box } from "./components/box";
6
+ export { default as Box } from "./components/box";
7
7
  export { Button } from "./components/button";
8
8
  export { StepIndicator } from "./components/step-indicator";
9
9
  export { Typography } from "./components/typography";
@@ -34,6 +34,8 @@ export { ActivitiesDaily } from "./components/activities-daily";
34
34
  export { ActivitiesProgress } from "./components/activities-progress";
35
35
  export { ProfileMenuOption } from "./components/profile-menu-option";
36
36
  export { ModalActivities } from "./components/modal-activities";
37
+ export { HistoryActivitiesCard } from "./components/history-activities-card";
38
+ export { ModalChangeActivity } from "./components/modal-change-activity";
37
39
 
38
40
  // Utilities
39
41
  export { multiply } from "./utils/mutiply";
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { Meta, StoryObj } from "@storybook/react";
3
3
 
4
4
  // components
5
- import { Box } from "../../components/box";
5
+ import Box from "../../components/box";
6
6
  import { Typography } from "../../components/typography";
7
7
 
8
8
  // styles
@@ -0,0 +1,107 @@
1
+ import type { StoryObj, Meta } from "@storybook/react";
2
+
3
+ import HistoryActivitiesCard from "../../components/history-activities-card";
4
+ import { IMAGES } from "../../common/constants";
5
+
6
+ const meta: Meta<typeof HistoryActivitiesCard> = {
7
+ title: "componente/HistoryActivitiesCard",
8
+ component: HistoryActivitiesCard,
9
+ args: {
10
+ name: "João Silva",
11
+ ciclo: "Ciclo 1",
12
+ data_start: "08:00",
13
+ data_end: "17:00",
14
+ idAtividade: 12345,
15
+ duration: "9:00m",
16
+ name_activitie: "Operação de Veículo",
17
+ referencia: "operacao_veiculo",
18
+ type_activitie: "Operação Veículo",
19
+ avatar: IMAGES.IMAGE_ANONIMA,
20
+ },
21
+ parameters: {
22
+ notes: `
23
+ # HistoryActivitiesCard
24
+
25
+ Este é um componente de Card de histórico de atividades.
26
+
27
+ ## Uso
28
+
29
+ \`\`\`tsx
30
+ <HistoryActivitiesCard
31
+ name="João Silva"
32
+ ciclo="Ciclo 1"
33
+ data_start="08:00"
34
+ data_end="17:00"
35
+ idAtividade={12345}
36
+ duration="9h 00m"
37
+ name_activitie="Operação de Veículo"
38
+ referencia="operacao_veiculo"
39
+ type_activitie="Operação Veículo"
40
+ avatar="https://randomuser.me/api/portraits/men/1.jpg"
41
+ />
42
+ \`\`\`
43
+ `,
44
+ },
45
+ };
46
+
47
+ export default meta;
48
+
49
+ type Story = StoryObj<typeof meta>;
50
+
51
+ export const Default: Story = {
52
+ name: "default",
53
+ };
54
+
55
+ export const WithoutAvatar: Story = {
56
+ name: "sem-avatar",
57
+ args: {
58
+ avatar: "",
59
+ name: "Maria Santos",
60
+ },
61
+ };
62
+
63
+ export const LongActivity: Story = {
64
+ name: "atividade-longa",
65
+ args: {
66
+ name: "Pedro Oliveira",
67
+ ciclo: "Ciclo 2",
68
+ data_start: "06:00",
69
+ data_end: "22:00",
70
+ idAtividade: 67890,
71
+ duration: "16h 00m",
72
+ name_activitie: "Viagem Longa Distância",
73
+ referencia: "operacao_veiculo",
74
+ type_activitie: "Viagem Longa Distância",
75
+ avatar: "https://randomuser.me/api/portraits/men/2.jpg",
76
+ },
77
+ };
78
+
79
+ export const MinimalData: Story = {
80
+ name: "dados-minimos",
81
+ args: {
82
+ name: "Ana Costa",
83
+ data_start: "08:00",
84
+ duration: "8h 00m",
85
+ name_activitie: "Atividade Básica",
86
+ referencia: "descanso",
87
+ type_activitie: "Básico",
88
+ idAtividade: 11111,
89
+ // Outros campos serão undefined para testar fallbacks
90
+ },
91
+ };
92
+
93
+ export const CompleteData: Story = {
94
+ name: "dados-completos",
95
+ args: {
96
+ name: "Carlos Ferreira",
97
+ ciclo: "Ciclo 3",
98
+ data_start: "14:30",
99
+ data_end: "18:45",
100
+ idAtividade: 54321,
101
+ duration: "4h 15m",
102
+ name_activitie: "Manutenção de Equipamentos",
103
+ referencia: "manutencao",
104
+ type_activitie: "Manutenção",
105
+ avatar: "https://randomuser.me/api/portraits/men/3.jpg",
106
+ },
107
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * IMPORTS
3
+ */
4
+
5
+ import type { Meta, StoryObj } from "@storybook/react";
6
+
7
+ // component
8
+ import { ModalChangeActivity } from "../../components/modal-change-activity";
9
+
10
+ const meta: Meta<typeof ModalChangeActivity> = {
11
+ title: "Componente/ModalChangeActivity",
12
+ component: ModalChangeActivity,
13
+ args: {
14
+ visible: true,
15
+ dataRegistro: "07/03/2024",
16
+ descricao: "Repouso Noturno",
17
+ imagemUrl: "https://via.placeholder.com/150",
18
+ onClose: () => {},
19
+ modalConfirm: () => {},
20
+ },
21
+ parameters: {
22
+ docs: {
23
+ description: {
24
+ component: `
25
+ # ModalChangeActivity
26
+
27
+ Componente de modal para alterar a atividade do usuário.
28
+
29
+ ## Uso
30
+ \`\`\`tsx
31
+ <ModalChangeActivity
32
+ visible
33
+ dataRegistro="07/03/2024"
34
+ descricao="Repouso Noturno"
35
+ modalConfirm={(data) => console.log(data)}
36
+ onClose={() => console.log("fechar modal")}
37
+ />
38
+ \`\`\`
39
+ `,
40
+ },
41
+ },
42
+ },
43
+ };
44
+
45
+ export default meta;
46
+
47
+ type Story = StoryObj<typeof meta>;
48
+
49
+ export const Default: Story = {
50
+ name: "Modal - Alterar Descanso",
51
+ };
@@ -6,13 +6,25 @@ import React from "react";
6
6
  import { Icons } from "../../common/icons-svg";
7
7
  import { theme } from "../../styles/theme/theme";
8
8
 
9
+ export type PropertyType =
10
+ | "operacao_veiculo"
11
+ | "manutencao"
12
+ | "aguardando_carga"
13
+ | "disposicao_veiculo_parado"
14
+ | "aguardando_descarga"
15
+ | "descanso"
16
+ | "repouso_semanal"
17
+ | "repouso_noturno"
18
+ | "refeicao"
19
+ | "ferias";
20
+
9
21
  /**
10
22
  * Function that will map property types to corresponding icons in SVG 🛠️.
11
23
  * @param propertyType
12
24
  * @param color
13
25
  * @returns SVG
14
26
  */
15
- const getIconByProperty: React.FC<any> = (propertyType: string, color?: string) => {
27
+ const getIconByProperty = (propertyType: PropertyType, color?: string): React.ReactNode => {
16
28
  switch (propertyType) {
17
29
 
18
30
  case "operacao_veiculo":