react-native-exp-fig 0.1.21 → 0.1.22
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/@types/as-base-component.js +12 -0
- package/lib/commonjs/@types/as-base-component.js.map +1 -0
- package/lib/commonjs/common/icons-svg/constants/index.js +2 -1
- package/lib/commonjs/common/icons-svg/constants/index.js.map +1 -1
- package/lib/commonjs/common/icons-svg/eclamation-triangle/index.js +33 -0
- package/lib/commonjs/common/icons-svg/eclamation-triangle/index.js.map +1 -0
- package/lib/commonjs/common/icons-svg/index.js +8 -0
- package/lib/commonjs/common/icons-svg/index.js.map +1 -1
- package/lib/commonjs/common/icons-svg/truck/index.js +2 -2
- package/lib/commonjs/common/icons-svg/truck/index.js.map +1 -1
- package/lib/commonjs/components/box/index.js +11 -11
- package/lib/commonjs/components/box/index.js.map +1 -1
- package/lib/commonjs/components/history-activities-card/index.js +197 -0
- package/lib/commonjs/components/history-activities-card/index.js.map +1 -0
- package/lib/commonjs/components/history-activities-card/interface.js +6 -0
- package/lib/commonjs/components/history-activities-card/interface.js.map +1 -0
- package/lib/commonjs/components/modal-change-activity/index.js +216 -0
- package/lib/commonjs/components/modal-change-activity/index.js.map +1 -0
- package/lib/commonjs/components/selects/select-option/index.js +28 -11
- package/lib/commonjs/components/selects/select-option/index.js.map +1 -1
- package/lib/commonjs/components/selects/select-option/interface.d.js.map +1 -1
- package/lib/commonjs/components/step-indicator/index.js +45 -7
- package/lib/commonjs/components/step-indicator/index.js.map +1 -1
- package/lib/commonjs/helpers/text-utils.js +21 -0
- package/lib/commonjs/helpers/text-utils.js.map +1 -0
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/stories/history-activities-card/history-activities-card.stories.js +104 -0
- package/lib/commonjs/stories/history-activities-card/history-activities-card.stories.js.map +1 -0
- package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js +52 -0
- package/lib/commonjs/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -0
- package/lib/commonjs/utils/get-icon-by-property/index.js.map +1 -1
- package/lib/module/@types/as-base-component.js +6 -0
- package/lib/module/@types/as-base-component.js.map +1 -0
- package/lib/module/common/icons-svg/constants/index.js +2 -1
- package/lib/module/common/icons-svg/constants/index.js.map +1 -1
- package/lib/module/common/icons-svg/eclamation-triangle/index.js +25 -0
- package/lib/module/common/icons-svg/eclamation-triangle/index.js.map +1 -0
- package/lib/module/common/icons-svg/index.js +8 -0
- package/lib/module/common/icons-svg/index.js.map +1 -1
- package/lib/module/common/icons-svg/truck/index.js +2 -2
- package/lib/module/common/icons-svg/truck/index.js.map +1 -1
- package/lib/module/components/box/index.js +10 -8
- package/lib/module/components/box/index.js.map +1 -1
- package/lib/module/components/history-activities-card/index.js +190 -0
- package/lib/module/components/history-activities-card/index.js.map +1 -0
- package/lib/module/components/history-activities-card/interface.js +2 -0
- package/lib/module/components/history-activities-card/interface.js.map +1 -0
- package/lib/module/components/modal-change-activity/index.js +207 -0
- package/lib/module/components/modal-change-activity/index.js.map +1 -0
- package/lib/module/components/selects/select-option/index.js +28 -11
- package/lib/module/components/selects/select-option/index.js.map +1 -1
- package/lib/module/components/selects/select-option/interface.d.js.map +1 -1
- package/lib/module/components/step-indicator/index.js +45 -7
- package/lib/module/components/step-indicator/index.js.map +1 -1
- package/lib/module/helpers/text-utils.js +14 -0
- package/lib/module/helpers/text-utils.js.map +1 -0
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/stories/history-activities-card/history-activities-card.stories.js +97 -0
- package/lib/module/stories/history-activities-card/history-activities-card.stories.js.map +1 -0
- package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js +45 -0
- package/lib/module/stories/modal-change-activity/modal-change-activity.stories.js.map +1 -0
- package/lib/module/utils/get-icon-by-property/index.js +0 -1
- package/lib/module/utils/get-icon-by-property/index.js.map +1 -1
- package/lib/typescript/src/@types/as-base-component.d.ts +2 -0
- package/lib/typescript/src/common/icons-svg/constants/index.d.ts +1 -0
- package/lib/typescript/src/common/icons-svg/eclamation-triangle/index.d.ts +4 -0
- package/lib/typescript/src/components/box/index.d.ts +3 -5
- package/lib/typescript/src/components/history-activities-card/index.d.ts +76 -0
- package/lib/typescript/src/components/history-activities-card/interface.d.ts +120 -0
- package/lib/typescript/src/components/modal-change-activity/index.d.ts +24 -0
- package/lib/typescript/src/helpers/text-utils.d.ts +7 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/stories/history-activities-card/history-activities-card.stories.d.ts +10 -0
- package/lib/typescript/src/stories/modal-change-activity/modal-change-activity.stories.d.ts +9 -0
- package/lib/typescript/src/utils/get-icon-by-property/index.d.ts +2 -1
- package/package.json +11 -8
- package/src/@types/as-base-component.ts +9 -0
- package/src/common/icons-svg/constants/index.ts +1 -0
- package/src/common/icons-svg/eclamation-triangle/index.tsx +46 -0
- package/src/common/icons-svg/index.tsx +5 -1
- package/src/common/icons-svg/truck/index.tsx +2 -2
- package/src/components/box/index.tsx +49 -47
- package/src/components/history-activities-card/index.tsx +217 -0
- package/src/components/history-activities-card/interface.ts +147 -0
- package/src/components/modal-change-activity/index.tsx +202 -0
- package/src/components/selects/select-option/index.tsx +115 -100
- package/src/components/selects/select-option/interface.d.ts +18 -18
- package/src/components/step-indicator/index.tsx +63 -7
- package/src/helpers/text-utils.ts +15 -0
- package/src/index.ts +45 -43
- package/src/stories/history-activities-card/history-activities-card.stories.tsx +107 -0
- package/src/stories/modal-change-activity/modal-change-activity.stories.tsx +52 -0
- 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
|
-
{
|
|
33
|
-
|
|
34
|
-
<View
|
|
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
|
-
{
|
|
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
|
-
{
|
|
92
|
+
{stepData.length - index}
|
|
51
93
|
</Text>
|
|
52
94
|
</View>
|
|
53
95
|
|
|
54
|
-
<View
|
|
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}
|
|
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
|
|
@@ -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
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EXPORTS
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Components
|
|
6
|
-
export { Box } from "./components/box";
|
|
7
|
-
export { Button } from "./components/button";
|
|
8
|
-
export { StepIndicator } from "./components/step-indicator";
|
|
9
|
-
export { Typography } from "./components/typography";
|
|
10
|
-
export { Input } from "./components/input";
|
|
11
|
-
export { CapturePhoto } from "./components/capture-photo";
|
|
12
|
-
export { CardHours } from "./components/card-hours";
|
|
13
|
-
export { SelectOption } from "./components/selects/select-option";
|
|
14
|
-
export { Header } from "./components/header-profile";
|
|
15
|
-
export { ScheduledJourneyIndicators } from "./components/scheduled-journey-indicators";
|
|
16
|
-
export { CardScheduledJourney } from "./components/card-scheduled-journey";
|
|
17
|
-
export { UserProfile } from "./components/user-profile";
|
|
18
|
-
export { MenuItem } from "./components/menu-item";
|
|
19
|
-
export { CardLoading } from "./components/card-loading";
|
|
20
|
-
export { CardWorkSession } from "./components/card-work-session";
|
|
21
|
-
export { LoadingProgress } from "./components/loading-progress";
|
|
22
|
-
export { NoData } from "./components/no-data";
|
|
23
|
-
export { FilterJourney } from "./components/filter-journey";
|
|
24
|
-
export { Coil } from "./components/coil";
|
|
25
|
-
export { FilterDateSelector } from "./components/filter-date-selector";
|
|
26
|
-
export { CardHistory } from "./components/card-history";
|
|
27
|
-
export { NotificationLoading } from "./components/notification-loading";
|
|
28
|
-
export { CheckBox } from "./components/check-box";
|
|
29
|
-
export { ImageCaptureWithRemove } from "./components/image-capture-with-remove";
|
|
30
|
-
export { LoadingDetails } from "./components/loading-details";
|
|
31
|
-
export { AvatarProfile } from "./components/avatar-profile";
|
|
32
|
-
export { HistoryDetails } from "./components/history-details";
|
|
33
|
-
export { ActivitiesDaily } from "./components/activities-daily";
|
|
34
|
-
export { ActivitiesProgress } from "./components/activities-progress";
|
|
35
|
-
export { ProfileMenuOption } from "./components/profile-menu-option";
|
|
36
|
-
export { ModalActivities } from "./components/modal-activities";
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
/**
|
|
2
|
+
* EXPORTS
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Components
|
|
6
|
+
export { Box } from "./components/box";
|
|
7
|
+
export { Button } from "./components/button";
|
|
8
|
+
export { StepIndicator } from "./components/step-indicator";
|
|
9
|
+
export { Typography } from "./components/typography";
|
|
10
|
+
export { Input } from "./components/input";
|
|
11
|
+
export { CapturePhoto } from "./components/capture-photo";
|
|
12
|
+
export { CardHours } from "./components/card-hours";
|
|
13
|
+
export { SelectOption } from "./components/selects/select-option";
|
|
14
|
+
export { Header } from "./components/header-profile";
|
|
15
|
+
export { ScheduledJourneyIndicators } from "./components/scheduled-journey-indicators";
|
|
16
|
+
export { CardScheduledJourney } from "./components/card-scheduled-journey";
|
|
17
|
+
export { UserProfile } from "./components/user-profile";
|
|
18
|
+
export { MenuItem } from "./components/menu-item";
|
|
19
|
+
export { CardLoading } from "./components/card-loading";
|
|
20
|
+
export { CardWorkSession } from "./components/card-work-session";
|
|
21
|
+
export { LoadingProgress } from "./components/loading-progress";
|
|
22
|
+
export { NoData } from "./components/no-data";
|
|
23
|
+
export { FilterJourney } from "./components/filter-journey";
|
|
24
|
+
export { Coil } from "./components/coil";
|
|
25
|
+
export { FilterDateSelector } from "./components/filter-date-selector";
|
|
26
|
+
export { CardHistory } from "./components/card-history";
|
|
27
|
+
export { NotificationLoading } from "./components/notification-loading";
|
|
28
|
+
export { CheckBox } from "./components/check-box";
|
|
29
|
+
export { ImageCaptureWithRemove } from "./components/image-capture-with-remove";
|
|
30
|
+
export { LoadingDetails } from "./components/loading-details";
|
|
31
|
+
export { AvatarProfile } from "./components/avatar-profile";
|
|
32
|
+
export { HistoryDetails } from "./components/history-details";
|
|
33
|
+
export { ActivitiesDaily } from "./components/activities-daily";
|
|
34
|
+
export { ActivitiesProgress } from "./components/activities-progress";
|
|
35
|
+
export { ProfileMenuOption } from "./components/profile-menu-option";
|
|
36
|
+
export { ModalActivities } from "./components/modal-activities";
|
|
37
|
+
export { HistoryActivitiesCard } from "./components/history-activities-card";
|
|
38
|
+
export { ModalChangeActivity } from "./components/modal-change-activity";
|
|
39
|
+
|
|
40
|
+
// Utilities
|
|
41
|
+
export { multiply } from "./utils/mutiply";
|
|
42
|
+
export { formatDate, getLastSevenDays, formHoursMinute } from "./utils/format-data";
|
|
43
|
+
|
|
44
|
+
// Styles
|
|
45
|
+
export { theme } from "./styles/theme/theme";
|
|
@@ -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,52 @@
|
|
|
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: () => console.log("Modal fechado"),
|
|
19
|
+
modalConfirm: (data: { label: string; value: string; key: number }) =>
|
|
20
|
+
console.log("Confirmado:", data),
|
|
21
|
+
},
|
|
22
|
+
parameters: {
|
|
23
|
+
docs: {
|
|
24
|
+
description: {
|
|
25
|
+
component: `
|
|
26
|
+
# ModalChangeActivity
|
|
27
|
+
|
|
28
|
+
Componente de modal para alterar a atividade do usuário.
|
|
29
|
+
|
|
30
|
+
## Uso
|
|
31
|
+
\`\`\`tsx
|
|
32
|
+
<ModalChangeActivity
|
|
33
|
+
visible
|
|
34
|
+
dataRegistro="07/03/2024"
|
|
35
|
+
descricao="Repouso Noturno"
|
|
36
|
+
modalConfirm={(data) => console.log(data)}
|
|
37
|
+
onClose={() => console.log("fechar modal")}
|
|
38
|
+
/>
|
|
39
|
+
\`\`\`
|
|
40
|
+
`,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default meta;
|
|
47
|
+
|
|
48
|
+
type Story = StoryObj<typeof meta>;
|
|
49
|
+
|
|
50
|
+
export const Default: Story = {
|
|
51
|
+
name: "Modal - Alterar Descanso",
|
|
52
|
+
};
|
|
@@ -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
|
|
27
|
+
const getIconByProperty = (propertyType: PropertyType, color?: string): React.ReactNode => {
|
|
16
28
|
switch (propertyType) {
|
|
17
29
|
|
|
18
30
|
case "operacao_veiculo":
|