1
1
import { useContext , useEffect , useState } from "react" ;
2
2
import { Stack , Typography , Modal , Box } from "@mui/material" ;
3
3
import {
4
- headerCardPlaceholder ,
5
4
vwhomeBody ,
6
5
vwhomeBodyControls ,
7
6
vwhomeBodyProjects ,
8
7
vwhomeBodyProjectsGrid ,
9
8
vwhomeCreateModalFrame ,
10
- vwhomeHeaderCards ,
11
9
vwhomeHeading ,
12
10
} from "./style" ;
13
- import SmallStatsCard from "../../../components/Cards/SmallStatsCard" ;
14
11
import VWButton from "../../../vw-v2-components/Buttons" ;
15
12
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline" ;
16
13
import CloudDownloadIcon from "@mui/icons-material/CloudDownload" ;
17
14
import VWProjectCard from "../../../components/Cards/ProjectCard" ;
18
- import VWSkeleton from "../../../vw-v2-components/Skeletons" ;
15
+
19
16
import { postAutoDrivers } from "../../../../application/repository/entity.repository" ;
20
17
import { VerifyWiseContext } from "../../../../application/contexts/VerifyWise.context" ;
21
18
import NoProject from "../../../components/NoProject/NoProject" ;
22
19
import VWToast from "../../../vw-v2-components/Toast" ;
23
20
import Alert from "../../../components/Alert" ;
24
21
import { logEngine } from "../../../../application/tools/log.engine" ;
25
22
import VWProjectForm from "../../../vw-v2-components/Forms/ProjectForm" ;
26
- import {
27
- AssessmentProgress ,
28
- ComplianceProgress ,
29
- } from "../../../../application/interfaces/iprogress" ;
30
23
import { useProjectData } from "../../../../application/hooks/useFetchProjects" ;
31
24
import { AlertState } from "../../../../application/interfaces/appStates" ;
32
25
import { fetchData } from "../../../../application/hooks/fetchDataHook" ;
@@ -37,10 +30,10 @@ import useMultipleOnScreen from "../../../../application/hooks/useMultipleOnScre
37
30
const VWHome = ( ) => {
38
31
const { setDashboardValues, componentsVisible, changeComponentVisibility } =
39
32
useContext ( VerifyWiseContext ) ;
40
- const [ complianceProgressData , setComplianceProgressData ] =
41
- useState < ComplianceProgress > ( ) ;
42
- const [ assessmentProgressData , setAssessmentProgressData ] =
43
- useState < AssessmentProgress > ( ) ;
33
+ // const [complianceProgressData, setComplianceProgressData] =
34
+ // useState<ComplianceProgress>();
35
+ // const [assessmentProgressData, setAssessmentProgressData] =
36
+ // useState<AssessmentProgress>();
44
37
const [ alertState , setAlertState ] = useState < AlertState > ( ) ;
45
38
const [ isProjectFormModalOpen , setIsProjectFormModalOpen ] =
46
39
useState < boolean > ( false ) ;
@@ -49,7 +42,7 @@ const VWHome = () => {
49
42
const [ showToastNotification , setShowToastNotification ] =
50
43
useState < boolean > ( false ) ;
51
44
52
- const { projects, loading : projectLoading , fetchProjects } = useProjectData ( ) ;
45
+ const { projects, fetchProjects } = useProjectData ( ) ;
53
46
54
47
const [ runHomeTour , setRunHomeTour ] = useState ( false ) ;
55
48
const { refs, allVisible } = useMultipleOnScreen < HTMLElement > ( {
@@ -72,14 +65,14 @@ const VWHome = () => {
72
65
await fetchData ( "/users" , ( data ) => {
73
66
setDashboardValues ( { users : data } ) ;
74
67
} ) ;
75
- await fetchData (
76
- "/eu-ai-act/all/compliances/progress" ,
77
- setComplianceProgressData
78
- ) ;
79
- await fetchData (
80
- "/eu-ai-act/all/assessments/progress" ,
81
- setAssessmentProgressData
82
- ) ;
68
+ // await fetchData(
69
+ // "/eu-ai-act/all/compliances/progress",
70
+ // setComplianceProgressData
71
+ // );
72
+ // await fetchData(
73
+ // "/eu-ai-act/all/assessments/progress",
74
+ // setAssessmentProgressData
75
+ // );
83
76
await fetchProjects ( ) ;
84
77
} ;
85
78
@@ -109,14 +102,14 @@ const VWHome = () => {
109
102
} , 100 ) ;
110
103
111
104
await fetchProjects ( ) ;
112
- await fetchData (
113
- "/eu-ai-act/all/compliances/progress" ,
114
- setComplianceProgressData
115
- ) ;
116
- await fetchData (
117
- "/eu-ai-act/all/assessments/progress" ,
118
- setAssessmentProgressData
119
- ) ;
105
+ // await fetchData(
106
+ // "/eu-ai-act/all/compliances/progress",
107
+ // setComplianceProgressData
108
+ // );
109
+ // await fetchData(
110
+ // "/eu-ai-act/all/assessments/progress",
111
+ // setAssessmentProgressData
112
+ // );
120
113
setShowToastNotification ( false ) ;
121
114
window . location . reload ( ) ;
122
115
} else {
@@ -166,49 +159,6 @@ const VWHome = () => {
166
159
{ showToastNotification && (
167
160
< VWToast title = "Generating demo data. Please wait..." />
168
161
) }
169
- < Stack className = "vwhome-header" sx = { { mb : 15 } } >
170
- < Typography sx = { vwhomeHeading } >
171
- All projects compliance status
172
- </ Typography >
173
- < Stack className = "vwhome-header-cards" sx = { vwhomeHeaderCards } >
174
- { projectLoading ? (
175
- < VWSkeleton variant = "rectangular" sx = { headerCardPlaceholder } />
176
- ) : (
177
- < SmallStatsCard
178
- attributeTitle = "Compliance tracker"
179
- progress = { `${
180
- complianceProgressData
181
- ? complianceProgressData . allDonesubControls
182
- : 0
183
- } /${
184
- complianceProgressData
185
- ? complianceProgressData . allsubControls
186
- : 1
187
- } `}
188
- rate = {
189
- ( complianceProgressData ?. allDonesubControls ?? 0 ) /
190
- ( complianceProgressData ?. allsubControls ?? 1 )
191
- }
192
- />
193
- ) }
194
- { projectLoading ? (
195
- < VWSkeleton variant = "rectangular" sx = { headerCardPlaceholder } />
196
- ) : (
197
- < SmallStatsCard
198
- attributeTitle = "Assessment tracker"
199
- progress = { `${ assessmentProgressData ?. answeredQuestions ?? 0 } /${
200
- assessmentProgressData ?. totalQuestions ?? 1
201
- } `}
202
- rate = {
203
- assessmentProgressData
204
- ? ( assessmentProgressData . answeredQuestions ?? 0 ) /
205
- ( assessmentProgressData . totalQuestions ?? 1 )
206
- : 0
207
- }
208
- />
209
- ) }
210
- </ Stack >
211
- </ Stack >
212
162
< Stack className = "vwhome-body" >
213
163
< Stack sx = { vwhomeBody } >
214
164
< Typography sx = { vwhomeHeading } > Projects overview</ Typography >
0 commit comments