jornada-ui 0.4.15 → 0.4.17

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 (222) hide show
  1. package/lib/commonjs/common/icons-svg/constants/index.js +2 -1
  2. package/lib/commonjs/common/icons-svg/constants/index.js.map +1 -1
  3. package/lib/commonjs/common/icons-svg/download/index.js +53 -0
  4. package/lib/commonjs/common/icons-svg/download/index.js.map +1 -0
  5. package/lib/commonjs/common/icons-svg/index.js +7 -0
  6. package/lib/commonjs/common/icons-svg/index.js.map +1 -1
  7. package/lib/commonjs/components/inputs/input-date-time/index.js +11 -9
  8. package/lib/commonjs/components/inputs/input-date-time/index.js.map +1 -1
  9. package/lib/commonjs/components/inputs/input-date-time/styles.js +6 -3
  10. package/lib/commonjs/components/inputs/input-date-time/styles.js.map +1 -1
  11. package/lib/commonjs/components/modals/modal-change-activitie-history/helpers/index.js +35 -0
  12. package/lib/commonjs/components/modals/modal-change-activitie-history/helpers/index.js.map +1 -0
  13. package/lib/commonjs/components/modals/modal-change-activitie-history/index.js +203 -0
  14. package/lib/commonjs/components/modals/modal-change-activitie-history/index.js.map +1 -0
  15. package/lib/commonjs/components/modals/modal-change-activitie-history/interface.js +6 -0
  16. package/lib/commonjs/components/modals/modal-change-activitie-history/interface.js.map +1 -0
  17. package/lib/commonjs/components/modals/{modal-journey-rectification → modal-edite-journey-rectification}/index.js +71 -65
  18. package/lib/commonjs/components/modals/modal-edite-journey-rectification/index.js.map +1 -0
  19. package/lib/commonjs/components/modals/modal-edite-journey-rectification/interface.d.js.map +1 -0
  20. package/lib/commonjs/components/notification-card/index.js +142 -0
  21. package/lib/commonjs/components/notification-card/index.js.map +1 -0
  22. package/lib/commonjs/components/notification-card/interface.js +6 -0
  23. package/lib/commonjs/components/notification-card/interface.js.map +1 -0
  24. package/lib/commonjs/components/notification-details-card/index.js +181 -0
  25. package/lib/commonjs/components/notification-details-card/index.js.map +1 -0
  26. package/lib/commonjs/components/notification-details-card/interface.js +6 -0
  27. package/lib/commonjs/components/notification-details-card/interface.js.map +1 -0
  28. package/lib/commonjs/components/step-indicator/index.js +131 -68
  29. package/lib/commonjs/components/step-indicator/index.js.map +1 -1
  30. package/lib/commonjs/components/user-journey-work-card/index.js +44 -4
  31. package/lib/commonjs/components/user-journey-work-card/index.js.map +1 -1
  32. package/lib/commonjs/index.js +19 -5
  33. package/lib/commonjs/index.js.map +1 -1
  34. package/lib/commonjs/stories/button/button.stories.js +0 -2
  35. package/lib/commonjs/stories/button/button.stories.js.map +1 -1
  36. package/lib/commonjs/stories/capture-photo/capture-photo.stories.js +0 -1
  37. package/lib/commonjs/stories/capture-photo/capture-photo.stories.js.map +1 -1
  38. package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js +3 -3
  39. package/lib/commonjs/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -1
  40. package/lib/commonjs/stories/notification-card/notification-card.stories.js +100 -0
  41. package/lib/commonjs/stories/notification-card/notification-card.stories.js.map +1 -0
  42. package/lib/commonjs/stories/notification-details-card/notification-details-card.stories.js +112 -0
  43. package/lib/commonjs/stories/notification-details-card/notification-details-card.stories.js.map +1 -0
  44. package/lib/commonjs/stories/user-journey-work-card/user-journey-work-card.stories.js +12 -4
  45. package/lib/commonjs/stories/user-journey-work-card/user-journey-work-card.stories.js.map +1 -1
  46. package/lib/commonjs/styles/theme/theme.js +2 -1
  47. package/lib/commonjs/styles/theme/theme.js.map +1 -1
  48. package/lib/module/common/icons-svg/constants/index.js +2 -1
  49. package/lib/module/common/icons-svg/constants/index.js.map +1 -1
  50. package/lib/module/common/icons-svg/download/index.js +47 -0
  51. package/lib/module/common/icons-svg/download/index.js.map +1 -0
  52. package/lib/module/common/icons-svg/index.js +7 -0
  53. package/lib/module/common/icons-svg/index.js.map +1 -1
  54. package/lib/module/components/inputs/input-date-time/index.js +11 -9
  55. package/lib/module/components/inputs/input-date-time/index.js.map +1 -1
  56. package/lib/module/components/inputs/input-date-time/styles.js +6 -3
  57. package/lib/module/components/inputs/input-date-time/styles.js.map +1 -1
  58. package/lib/module/components/modals/modal-change-activitie-history/helpers/index.js +32 -0
  59. package/lib/module/components/modals/modal-change-activitie-history/helpers/index.js.map +1 -0
  60. package/lib/module/components/modals/modal-change-activitie-history/index.js +196 -0
  61. package/lib/module/components/modals/modal-change-activitie-history/index.js.map +1 -0
  62. package/lib/module/components/modals/modal-change-activitie-history/interface.js +4 -0
  63. package/lib/module/components/modals/modal-change-activitie-history/interface.js.map +1 -0
  64. package/lib/module/components/modals/{modal-journey-rectification → modal-edite-journey-rectification}/index.js +69 -63
  65. package/lib/module/components/modals/modal-edite-journey-rectification/index.js.map +1 -0
  66. package/lib/module/components/modals/modal-edite-journey-rectification/interface.d.js.map +1 -0
  67. package/lib/module/components/notification-card/index.js +135 -0
  68. package/lib/module/components/notification-card/index.js.map +1 -0
  69. package/lib/module/components/notification-card/interface.js +4 -0
  70. package/lib/module/components/notification-card/interface.js.map +1 -0
  71. package/lib/module/components/notification-details-card/index.js +183 -0
  72. package/lib/module/components/notification-details-card/index.js.map +1 -0
  73. package/lib/module/components/notification-details-card/interface.js +4 -0
  74. package/lib/module/components/notification-details-card/interface.js.map +1 -0
  75. package/lib/module/components/step-indicator/index.js +129 -65
  76. package/lib/module/components/step-indicator/index.js.map +1 -1
  77. package/lib/module/components/user-journey-work-card/index.js +44 -4
  78. package/lib/module/components/user-journey-work-card/index.js.map +1 -1
  79. package/lib/module/index.js +3 -1
  80. package/lib/module/index.js.map +1 -1
  81. package/lib/module/stories/button/button.stories.js +0 -1
  82. package/lib/module/stories/button/button.stories.js.map +1 -1
  83. package/lib/module/stories/capture-photo/capture-photo.stories.js +0 -1
  84. package/lib/module/stories/capture-photo/capture-photo.stories.js.map +1 -1
  85. package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js +3 -3
  86. package/lib/module/stories/modal-journey-rectification/modal-journey-rectification.stories.js.map +1 -1
  87. package/lib/module/stories/notification-card/notification-card.stories.js +95 -0
  88. package/lib/module/stories/notification-card/notification-card.stories.js.map +1 -0
  89. package/lib/module/stories/notification-details-card/notification-details-card.stories.js +107 -0
  90. package/lib/module/stories/notification-details-card/notification-details-card.stories.js.map +1 -0
  91. package/lib/module/stories/user-journey-work-card/user-journey-work-card.stories.js +12 -4
  92. package/lib/module/stories/user-journey-work-card/user-journey-work-card.stories.js.map +1 -1
  93. package/lib/module/styles/theme/theme.js +2 -1
  94. package/lib/module/styles/theme/theme.js.map +1 -1
  95. package/lib/typescript/commonjs/src/common/icons-svg/constants/index.d.ts +1 -0
  96. package/lib/typescript/commonjs/src/common/icons-svg/constants/index.d.ts.map +1 -1
  97. package/lib/typescript/commonjs/src/common/icons-svg/download/index.d.ts +11 -0
  98. package/lib/typescript/commonjs/src/common/icons-svg/download/index.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/src/common/icons-svg/index.d.ts.map +1 -1
  100. package/lib/typescript/commonjs/src/components/card-report/index.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/components/card-scheduled-journey/index.d.ts +1 -1
  102. package/lib/typescript/commonjs/src/components/inputs/input-date-time/index.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/components/inputs/input-date-time/styles.d.ts +2 -1
  104. package/lib/typescript/commonjs/src/components/inputs/input-date-time/styles.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/helpers/index.d.ts +13 -0
  106. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/helpers/index.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/index.d.ts +10 -0
  108. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/index.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/interface.d.ts +18 -0
  110. package/lib/typescript/commonjs/src/components/modals/modal-change-activitie-history/interface.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/src/components/modals/{modal-journey-rectification → modal-edite-journey-rectification}/index.d.ts +3 -0
  112. package/lib/typescript/commonjs/src/components/modals/modal-edite-journey-rectification/index.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/src/components/notification-card/index.d.ts +11 -0
  114. package/lib/typescript/commonjs/src/components/notification-card/index.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/src/components/notification-card/interface.d.ts +17 -0
  116. package/lib/typescript/commonjs/src/components/notification-card/interface.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/src/components/notification-details-card/index.d.ts +11 -0
  118. package/lib/typescript/commonjs/src/components/notification-details-card/index.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/src/components/notification-details-card/interface.d.ts +15 -0
  120. package/lib/typescript/commonjs/src/components/notification-details-card/interface.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/src/components/selects/select-date-and-hours/index.d.ts +1 -1
  122. package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts +3 -9
  123. package/lib/typescript/commonjs/src/components/step-indicator/index.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/src/components/travel-history/index.d.ts.map +1 -1
  125. package/lib/typescript/commonjs/src/components/user-journey-work-card/index.d.ts +2 -0
  126. package/lib/typescript/commonjs/src/components/user-journey-work-card/index.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/src/index.d.ts +3 -1
  128. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/src/stories/modal-journey-rectification/modal-journey-rectification.stories.d.ts +1 -1
  130. package/lib/typescript/commonjs/src/stories/modal-journey-rectification/modal-journey-rectification.stories.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/src/stories/notification-card/notification-card.stories.d.ts +14 -0
  132. package/lib/typescript/commonjs/src/stories/notification-card/notification-card.stories.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/src/stories/notification-details-card/notification-details-card.stories.d.ts +16 -0
  134. package/lib/typescript/commonjs/src/stories/notification-details-card/notification-details-card.stories.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/src/stories/user-journey-work-card/user-journey-work-card.stories.d.ts.map +1 -1
  136. package/lib/typescript/commonjs/src/styles/global/theme-provider.d.ts +1 -0
  137. package/lib/typescript/commonjs/src/styles/global/theme-provider.d.ts.map +1 -1
  138. package/lib/typescript/commonjs/src/styles/theme/theme.d.ts +1 -0
  139. package/lib/typescript/commonjs/src/styles/theme/theme.d.ts.map +1 -1
  140. package/lib/typescript/module/src/common/icons-svg/constants/index.d.ts +1 -0
  141. package/lib/typescript/module/src/common/icons-svg/constants/index.d.ts.map +1 -1
  142. package/lib/typescript/module/src/common/icons-svg/download/index.d.ts +11 -0
  143. package/lib/typescript/module/src/common/icons-svg/download/index.d.ts.map +1 -0
  144. package/lib/typescript/module/src/common/icons-svg/index.d.ts.map +1 -1
  145. package/lib/typescript/module/src/components/card-report/index.d.ts.map +1 -1
  146. package/lib/typescript/module/src/components/card-scheduled-journey/index.d.ts +1 -1
  147. package/lib/typescript/module/src/components/inputs/input-date-time/index.d.ts.map +1 -1
  148. package/lib/typescript/module/src/components/inputs/input-date-time/styles.d.ts +2 -1
  149. package/lib/typescript/module/src/components/inputs/input-date-time/styles.d.ts.map +1 -1
  150. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/helpers/index.d.ts +13 -0
  151. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/helpers/index.d.ts.map +1 -0
  152. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/index.d.ts +10 -0
  153. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/index.d.ts.map +1 -0
  154. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/interface.d.ts +18 -0
  155. package/lib/typescript/module/src/components/modals/modal-change-activitie-history/interface.d.ts.map +1 -0
  156. package/lib/typescript/module/src/components/modals/{modal-journey-rectification → modal-edite-journey-rectification}/index.d.ts +3 -0
  157. package/lib/typescript/module/src/components/modals/modal-edite-journey-rectification/index.d.ts.map +1 -0
  158. package/lib/typescript/module/src/components/notification-card/index.d.ts +11 -0
  159. package/lib/typescript/module/src/components/notification-card/index.d.ts.map +1 -0
  160. package/lib/typescript/module/src/components/notification-card/interface.d.ts +17 -0
  161. package/lib/typescript/module/src/components/notification-card/interface.d.ts.map +1 -0
  162. package/lib/typescript/module/src/components/notification-details-card/index.d.ts +11 -0
  163. package/lib/typescript/module/src/components/notification-details-card/index.d.ts.map +1 -0
  164. package/lib/typescript/module/src/components/notification-details-card/interface.d.ts +15 -0
  165. package/lib/typescript/module/src/components/notification-details-card/interface.d.ts.map +1 -0
  166. package/lib/typescript/module/src/components/selects/select-date-and-hours/index.d.ts +1 -1
  167. package/lib/typescript/module/src/components/step-indicator/index.d.ts +3 -9
  168. package/lib/typescript/module/src/components/step-indicator/index.d.ts.map +1 -1
  169. package/lib/typescript/module/src/components/travel-history/index.d.ts.map +1 -1
  170. package/lib/typescript/module/src/components/user-journey-work-card/index.d.ts +2 -0
  171. package/lib/typescript/module/src/components/user-journey-work-card/index.d.ts.map +1 -1
  172. package/lib/typescript/module/src/index.d.ts +3 -1
  173. package/lib/typescript/module/src/index.d.ts.map +1 -1
  174. package/lib/typescript/module/src/stories/modal-journey-rectification/modal-journey-rectification.stories.d.ts +1 -1
  175. package/lib/typescript/module/src/stories/modal-journey-rectification/modal-journey-rectification.stories.d.ts.map +1 -1
  176. package/lib/typescript/module/src/stories/notification-card/notification-card.stories.d.ts +14 -0
  177. package/lib/typescript/module/src/stories/notification-card/notification-card.stories.d.ts.map +1 -0
  178. package/lib/typescript/module/src/stories/notification-details-card/notification-details-card.stories.d.ts +16 -0
  179. package/lib/typescript/module/src/stories/notification-details-card/notification-details-card.stories.d.ts.map +1 -0
  180. package/lib/typescript/module/src/stories/user-journey-work-card/user-journey-work-card.stories.d.ts.map +1 -1
  181. package/lib/typescript/module/src/styles/global/theme-provider.d.ts +1 -0
  182. package/lib/typescript/module/src/styles/global/theme-provider.d.ts.map +1 -1
  183. package/lib/typescript/module/src/styles/theme/theme.d.ts +1 -0
  184. package/lib/typescript/module/src/styles/theme/theme.d.ts.map +1 -1
  185. package/package.json +1 -1
  186. package/src/common/icons-svg/constants/index.ts +1 -0
  187. package/src/common/icons-svg/download/index.tsx +52 -0
  188. package/src/common/icons-svg/index.tsx +4 -0
  189. package/src/components/card-report/interface.d.ts +1 -1
  190. package/src/components/inputs/input-date-time/index.tsx +13 -12
  191. package/src/components/inputs/input-date-time/styles.ts +64 -63
  192. package/src/components/modals/modal-change-activitie-history/helpers/index.ts +15 -0
  193. package/src/components/modals/modal-change-activitie-history/index.tsx +189 -0
  194. package/src/components/modals/modal-change-activitie-history/interface.ts +16 -0
  195. package/src/components/modals/{modal-journey-rectification → modal-edite-journey-rectification}/index.tsx +78 -67
  196. package/src/components/modals/{modal-journey-rectification → modal-edite-journey-rectification}/interface.d.ts +10 -10
  197. package/src/components/monthly-summary-table/interface.d.ts +1 -1
  198. package/src/components/notification-card/index.tsx +123 -0
  199. package/src/components/notification-card/interface.ts +18 -0
  200. package/src/components/notification-details-card/index.tsx +180 -0
  201. package/src/components/notification-details-card/interface.ts +16 -0
  202. package/src/components/step-indicator/index.tsx +226 -155
  203. package/src/components/step-indicator/interface.d.ts +3 -2
  204. package/src/components/travel-history/interface.d.ts +1 -1
  205. package/src/components/user-journey-work-card/index.tsx +28 -1
  206. package/src/components/user-journey-work-card/interface.d.ts +149 -145
  207. package/src/index.tsx +3 -1
  208. package/src/stories/button/button.stories.tsx +1 -1
  209. package/src/stories/capture-photo/capture-photo.stories.tsx +1 -1
  210. package/src/stories/modal-journey-rectification/modal-journey-rectification.stories.tsx +60 -60
  211. package/src/stories/notification-card/notification-card.stories.tsx +93 -0
  212. package/src/stories/notification-details-card/notification-details-card.stories.tsx +109 -0
  213. package/src/stories/user-journey-work-card/user-journey-work-card.stories.tsx +71 -63
  214. package/src/styles/theme/theme.ts +1 -0
  215. package/lib/commonjs/components/modals/modal-journey-rectification/index.js.map +0 -1
  216. package/lib/commonjs/components/modals/modal-journey-rectification/interface.d.js.map +0 -1
  217. package/lib/module/components/modals/modal-journey-rectification/index.js.map +0 -1
  218. package/lib/module/components/modals/modal-journey-rectification/interface.d.js.map +0 -1
  219. package/lib/typescript/commonjs/src/components/modals/modal-journey-rectification/index.d.ts.map +0 -1
  220. package/lib/typescript/module/src/components/modals/modal-journey-rectification/index.d.ts.map +0 -1
  221. /package/lib/commonjs/components/modals/{modal-journey-rectification → modal-edite-journey-rectification}/interface.d.js +0 -0
  222. /package/lib/module/components/modals/{modal-journey-rectification → modal-edite-journey-rectification}/interface.d.js +0 -0
@@ -1,8 +1,8 @@
1
- /**
2
- * IMPORTS
3
- */
4
- import React from "react";
5
- import { View, Text, TouchableOpacity } from "react-native";
1
+ import React, { useState, forwardRef, useImperativeHandle, useRef } from "react";
2
+ import { View, Text, TouchableOpacity, FlatList, FlatList as FlatListType } from "react-native";
3
+
4
+ // components
5
+ import { ModalChangeActivity } from "../modals/modal-change-activitie-history";
6
6
 
7
7
  // commons / svg
8
8
  import { Icons } from "../../common/icons-svg";
@@ -10,182 +10,253 @@ import { Icons } from "../../common/icons-svg";
10
10
  // helpers
11
11
  import { getIconKeyByValue } from "./helpers/get-icon-by-status";
12
12
 
13
- // utils
14
- import { formHoursMinute } from "../../utils/format-date";
15
-
16
13
  // typings
17
14
  import type { IStepIndicator } from "./interface";
18
15
 
16
+ // utils
17
+ import { formHoursMinute } from "../../utils/format-date";
18
+
19
19
  // styles
20
20
  import { styles } from "./styles";
21
21
  import { theme } from "../../styles/theme/theme";
22
+ import { asBaseComponent } from "../../@types/as-base-component";
22
23
 
23
24
  /**
24
25
  * Componente StepIndicator para a interação da ui.
25
26
  */
27
+ const StepIndicator = forwardRef<any, IStepIndicator>(
28
+ (
29
+ { data = [], type, textColorDescription, titleColor, titleNumberColor, onChangeActivity },
30
+ ref
31
+ ) => {
32
+ const StepDefault = () => {
33
+ const [isModalVisible, setIsModalVisible] = useState(false);
34
+ const [currentStepIndex, setCurrentStepIndex] = useState<number | null>(null);
35
+ const [stepData, setStepData] = useState(data);
26
36
 
27
- const StepIndicator: React.FC<IStepIndicator> = ({
28
- data = [],
29
- type,
30
- textColorDescription,
31
- titleColor,
32
- titleNumberColor,
33
- handleOnPressActivitie,
34
- }) => {
35
- const StepDefault = () => {
36
- return (
37
- <>
38
- {data!.length > 0 &&
39
- data!.map((history, index) => {
40
- // pegando primeira atividade pelo index
41
- const isFirst = index === 0;
42
- //pegando o tipo de atividade
43
- const isEditableType = history.tipo === "descanso";
44
-
45
- // pegando o valor para saber se atividade ta ou não sincronizada
46
- const isSynced = history?.sincronizado === true;
47
-
48
- const canEdit = isFirst && isEditableType && isSynced;
37
+ const flatListRef = useRef<FlatListType<any>>(null);
49
38
 
50
- return (
51
- <TouchableOpacity
52
- testID="step-indicator"
53
- activeOpacity={0.7}
54
- key={history.id}
55
- style={styles({}).containerIndicator}
56
- disabled={!canEdit}
57
- onPress={() => handleOnPressActivitie(history as any)}
58
- >
59
- <View style={styles({ sincronizado: history.sincronizado }).containerBall}>
60
- {data!?.length > 1 && index < data!?.length - 1 && (
61
- <View
62
- style={{
63
- width: 2,
64
- height: 84,
65
- marginTop: 116,
66
- position: "relative",
67
- backgroundColor: history.sincronizado
68
- ? theme.colors.blue[500]
69
- : theme.colors.orange[150],
70
- }}
71
- />
72
- )}
73
- <Text style={styles({ titleNumberColor }).titleNumber}>
74
- {data!?.length - index}
75
- </Text>
76
- </View>
39
+ const handleOnPressActivitie = (stepItem: any, index: number) => {
40
+ const desc = stepItem?.descricao?.toLowerCase?.();
41
+ if (!desc) return;
77
42
 
78
- <View style={styles({}).containerMain}>
79
- <Text style={styles({ titleColor }).title}>{history?.descricao}</Text>
43
+ const isDescanso = ["descanso", "refeição", "repouso_noturno", "repouso_semanal"].includes(
44
+ desc.replace(/\s+/g, "_")
45
+ );
80
46
 
81
- {history?.data_inicio && (
82
- <Text style={styles({ textColorDescription }).titleDescription}>
83
- {`Inicio: ${history.data_inicio} ás ${history.data_fim}`}
84
- </Text>
85
- )}
47
+ if (isDescanso && stepItem?.sincronizado === true) {
48
+ setCurrentStepIndex(index);
49
+ setIsModalVisible(true);
50
+ }
51
+ };
86
52
 
87
- {history.duracao_segundos && (
88
- <Text style={styles({ textColorDescription }).titleDescription}>
89
- Duração: {formHoursMinute(history?.duracao_segundos as string)}
90
- </Text>
91
- )}
92
- </View>
93
- </TouchableOpacity>
94
- );
95
- })}
96
- </>
97
- );
98
- };
99
-
100
- const StepCustom = () => {
101
- return (
102
- <View
103
- style={{
104
- width: "100%",
105
- height: 84,
106
- paddingHorizontal: 24,
107
- display: "flex",
108
- flexDirection: "row",
109
- }}
110
- >
111
- {data.map((step, indexCustom) => {
112
- const descricao = getIconKeyByValue(step.descricao);
113
-
114
- return (
115
- <React.Fragment key={`step-${indexCustom}`}>
116
- <View
117
- style={{
118
- width: 45,
119
- height: 45,
120
- backgroundColor: indexCustom <= 3 ? "orange" : "transparent",
121
- borderRadius: 50,
122
- alignItems: "center",
123
- justifyContent: "center",
124
- borderWidth: 1,
125
- borderColor: "#fff",
126
- }}
127
- >
53
+ const handleConfirmModal = (newData: { label: string; value: string; key: number }) => {
54
+ if (currentStepIndex !== null) {
55
+ const updatedStep = {
56
+ ...stepData[currentStepIndex],
57
+ descricao: newData.label,
58
+ referencia: newData.value,
59
+ jr_tipo_atividade_id: newData.key,
60
+ };
61
+
62
+ const newSteps = stepData.map((item, index) =>
63
+ index === currentStepIndex ? updatedStep : item
64
+ );
65
+
66
+ setStepData(newSteps as any);
67
+
68
+ if (onChangeActivity) {
69
+ onChangeActivity(updatedStep);
70
+ }
71
+ }
72
+
73
+ setIsModalVisible(false);
74
+ setCurrentStepIndex(null);
75
+ };
76
+
77
+ // render item padrão do step indicator
78
+ const renderItem = ({ item: history, index }: { item: any; index: number }) => {
79
+ const isFirst = index === 0;
80
+ const isEditableType = history.tipo === "descanso";
81
+ const isSynced = history?.sincronizado === true;
82
+ const canEdit = isFirst && isEditableType && isSynced;
83
+
84
+ return (
85
+ <TouchableOpacity
86
+ testID="step-indicator"
87
+ activeOpacity={0.7}
88
+ style={styles({}).containerIndicator}
89
+ disabled={!canEdit}
90
+ onPress={() => handleOnPressActivitie(history, index)}
91
+ >
92
+ <View style={styles({ sincronizado: history.sincronizado }).containerBall}>
93
+ {stepData.length > 1 && index < stepData.length - 1 && (
94
+ <View
95
+ style={{
96
+ width: 2,
97
+ height: 84,
98
+ marginTop: 116,
99
+ position: "relative",
100
+ backgroundColor: history.sincronizado
101
+ ? theme.colors.blue[500]
102
+ : theme.colors.orange[150],
103
+ }}
104
+ />
105
+ )}
106
+ <Text style={styles({ titleNumberColor }).titleNumber}>
107
+ {stepData.length - index}
108
+ </Text>
109
+ </View>
110
+
111
+ <View style={styles({}).containerMain}>
112
+ <Text style={styles({ titleColor }).title}>{history?.descricao}</Text>
113
+
114
+ {history?.data_inicio && (
115
+ <Text style={styles({ textColorDescription }).titleDescription}>
116
+ {`Inicio: ${history.data_inicio} ás ${history.data_fim}`}
117
+ </Text>
118
+ )}
119
+
120
+ {history.duracao_segundos && (
121
+ <Text style={styles({ textColorDescription }).titleDescription}>
122
+ Duração: {formHoursMinute(history?.duracao_segundos as string)}
123
+ </Text>
124
+ )}
125
+ </View>
126
+ </TouchableOpacity>
127
+ );
128
+ };
129
+
130
+ // Expor funções para o pai via forwardRef
131
+ useImperativeHandle(ref, () => ({
132
+ scrollToIndex: (index: number) => {
133
+ flatListRef.current?.scrollToIndex({ index, animated: true });
134
+ },
135
+ openModalAt: (index: number) => {
136
+ if (stepData[index]) {
137
+ setCurrentStepIndex(index);
138
+ setIsModalVisible(true);
139
+ }
140
+ },
141
+ resetSteps: (newData: any[]) => {
142
+ setStepData(newData);
143
+ },
144
+ }));
145
+
146
+ return (
147
+ <>
148
+ <FlatList
149
+ ref={flatListRef}
150
+ data={stepData}
151
+ renderItem={renderItem}
152
+ keyExtractor={(item, index) => String(item?.id ?? String(index))}
153
+ showsVerticalScrollIndicator={false}
154
+ />
155
+
156
+ {isModalVisible && (
157
+ <ModalChangeActivity
158
+ visible={isModalVisible}
159
+ modalConfirm={handleConfirmModal}
160
+ descricao=""
161
+ onClose={() => setIsModalVisible(false)}
162
+ />
163
+ )}
164
+ </>
165
+ );
166
+ };
167
+
168
+ const StepCustom = () => {
169
+ return (
170
+ <View
171
+ style={{
172
+ width: "100%",
173
+ height: 84,
174
+ paddingHorizontal: 24,
175
+ display: "flex",
176
+ flexDirection: "row",
177
+ }}
178
+ >
179
+ {data.map((step, indexCustom) => {
180
+ const descricao = getIconKeyByValue(step.descricao);
181
+
182
+ return (
183
+ <React.Fragment key={`step-${indexCustom}`}>
128
184
  <View
129
185
  style={{
130
186
  width: 45,
131
187
  height: 45,
132
- backgroundColor: "transparent",
188
+ backgroundColor: indexCustom <= 3 ? "orange" : "transparent",
133
189
  borderRadius: 50,
134
190
  alignItems: "center",
135
191
  justifyContent: "center",
192
+ borderWidth: 1,
193
+ borderColor: "#fff",
136
194
  }}
137
195
  >
138
- {descricao && <Icons icon={descricao} />}
196
+ <View
197
+ style={{
198
+ width: 45,
199
+ height: 45,
200
+ backgroundColor: "transparent",
201
+ borderRadius: 50,
202
+ alignItems: "center",
203
+ justifyContent: "center",
204
+ }}
205
+ >
206
+ {descricao && <Icons icon={descricao} />}
207
+ </View>
208
+ <Text
209
+ style={{
210
+ position: "absolute",
211
+ top: 56,
212
+ fontWeight: "600",
213
+ fontSize: 10,
214
+ lineHeight: 14,
215
+ textAlign: "center",
216
+ color: "#fff",
217
+ width: 75,
218
+ }}
219
+ >
220
+ {step.descricao}
221
+ </Text>
139
222
  </View>
140
- <Text
141
- style={{
142
- position: "absolute",
143
- top: 56,
144
- fontWeight: "600",
145
- fontSize: 10,
146
- lineHeight: 14,
147
- textAlign: "center",
148
- color: "#fff",
149
- width: 75,
150
- }}
151
- >
152
- {step.descricao}
153
- </Text>
154
- </View>
155
223
 
156
- {data?.length > 1 && indexCustom < data?.length - 1 && (
157
- <View
158
- style={{
159
- width: 35,
160
- height: 2,
161
- marginTop: 24,
162
- position: "relative",
163
- backgroundColor: "orange",
164
- }}
165
- />
166
- )}
167
- </React.Fragment>
168
- );
169
- })}
170
- </View>
171
- );
172
- };
173
-
174
- const handleRenderComponent = (stepType: "default" | "custom") => {
175
- switch (stepType) {
176
- case "default":
177
- return <StepDefault />;
178
- case "custom":
179
- return <StepCustom />;
180
- default:
181
- return <View />;
182
- }
183
- };
184
-
185
- return <>{handleRenderComponent(type!)}</>;
186
- };
224
+ {data?.length > 1 && indexCustom < data?.length - 1 && (
225
+ <View
226
+ style={{
227
+ width: 35,
228
+ height: 2,
229
+ marginTop: 24,
230
+ position: "relative",
231
+ backgroundColor: "orange",
232
+ }}
233
+ />
234
+ )}
235
+ </React.Fragment>
236
+ );
237
+ })}
238
+ </View>
239
+ );
240
+ };
241
+
242
+ const handleRenderComponent = (stepType: "default" | "custom") => {
243
+ switch (stepType) {
244
+ case "default":
245
+ return <StepDefault />;
246
+ case "custom":
247
+ return <StepCustom />;
248
+ default:
249
+ return <View />;
250
+ }
251
+ };
252
+
253
+ return <>{handleRenderComponent(type!)}</>;
254
+ }
255
+ );
256
+
257
+ StepIndicator.displayName = "StepIndicator";
187
258
 
188
259
  /**
189
- * EXPORTS
260
+ * Componente StepIndicator para a interação da ui.
190
261
  */
191
- export default StepIndicator;
262
+ export default asBaseComponent(StepIndicator);
@@ -4,7 +4,8 @@
4
4
  */
5
5
 
6
6
  type IData = {
7
- id: number;
7
+ id?: number | string;
8
+ jr_tipo_atividade_id?: number;
8
9
  duracao_segundos: string | number;
9
10
  data_inicio: string;
10
11
  data_fim: string;
@@ -38,7 +39,7 @@ interface IStepIndicator {
38
39
  textColorDescription?: string;
39
40
 
40
41
  /**params para lidar com selecionamento de atividade única */
41
- handleOnPressActivitie: (data: IData) => void;
42
+ onChangeActivity?: (activity: any) => void;
42
43
  }
43
44
  /**
44
45
  * EXPORTS
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-unused-vars */
2
- /* eslint-disable no-undef */
2
+
3
3
  /**
4
4
  * IMPORTS
5
5
  */
@@ -27,9 +27,11 @@ const UserJourneyWorkCard = forwardRef<any, IUserJourneyWorkCard>(
27
27
  initialTime = "00:40",
28
28
  duration = "00:00",
29
29
  avatar = "",
30
+ counterBadge = 0,
30
31
  backgroundColor,
31
32
  width,
32
33
  handleNavigation,
34
+ handleNavigationNotification,
33
35
  } = props;
34
36
  return (
35
37
  <Box
@@ -125,7 +127,32 @@ const UserJourneyWorkCard = forwardRef<any, IUserJourneyWorkCard>(
125
127
  </Box>
126
128
  </Box>
127
129
 
128
- <Icons icon={"BELL"} size={28} />
130
+ <TouchableOpacity activeOpacity={0.7} onPress={handleNavigationNotification}>
131
+ {counterBadge > 0 && (
132
+ <Box
133
+ backgroundColor={theme.colors.red[500]}
134
+ flexStyle={{ alignItems: "center", justifyContent: "center" }}
135
+ borderStyled={{ borderRadius: theme.borderWidths.hairline }}
136
+ style={[
137
+ counterBadge < 10
138
+ ? { right: -5, top: -2, height: 16, width: 16 }
139
+ : { right: -8, top: -5, padding: 2 },
140
+ { position: "absolute", zIndex: 10 },
141
+ ]}
142
+ >
143
+ <Typography
144
+ text={`${counterBadge}`}
145
+ align={"center"}
146
+ size={theme.fontSizes["2xs"]}
147
+ color={theme.colors.neutral[25]}
148
+ fontFamily={theme.fonts.inter_bold_700}
149
+ lineHeight={theme.fontSizes.sm}
150
+ letterSpacing={"regular"}
151
+ />
152
+ </Box>
153
+ )}
154
+ <Icons icon={"BELL"} size={28} style={{ position: "relative" }} />
155
+ </TouchableOpacity>
129
156
  </Box>
130
157
 
131
158
  <Box