diff --git a/src/frontend/src/api/CreateProjectService.ts b/src/frontend/src/api/CreateProjectService.ts index b2ee671d05..4ac164106b 100755 --- a/src/frontend/src/api/CreateProjectService.ts +++ b/src/frontend/src/api/CreateProjectService.ts @@ -286,6 +286,9 @@ const GetIndividualProjectDetails = (url: string) => { dispatch(CreateProjectActions.SetIndividualProjectDetails(modifiedResponse)); dispatch(CreateProjectActions.SetIndividualProjectDetailsLoading(false)); } catch (error) { + if (error.response.status === 404) { + dispatch(CommonActions.SetProjectNotFound(true)); + } dispatch(CreateProjectActions.SetIndividualProjectDetailsLoading(false)); } finally { dispatch(CreateProjectActions.SetIndividualProjectDetailsLoading(false)); diff --git a/src/frontend/src/api/Project.ts b/src/frontend/src/api/Project.ts index 6aec85a702..1f5718f71e 100755 --- a/src/frontend/src/api/Project.ts +++ b/src/frontend/src/api/Project.ts @@ -53,6 +53,9 @@ export const ProjectById = (projectId: string) => { ); dispatch(ProjectActions.SetProjectDetialsLoading(false)); } catch (error) { + if (error.response.status === 404) { + dispatch(CommonActions.SetProjectNotFound(true)); + } dispatch(ProjectActions.SetProjectDetialsLoading(false)); dispatch( CommonActions.SetSnackBar({ @@ -221,6 +224,9 @@ export const GetProjectDashboard = (url: string) => { dispatch(ProjectActions.SetProjectDashboardDetail(response.data)); dispatch(ProjectActions.SetProjectDashboardLoading(false)); } catch (error) { + if (error.response.status === 404) { + dispatch(CommonActions.SetProjectNotFound(true)); + } dispatch(ProjectActions.SetProjectDashboardLoading(false)); } finally { dispatch(ProjectActions.SetProjectDashboardLoading(false)); diff --git a/src/frontend/src/assets/images/no-file.png b/src/frontend/src/assets/images/no-file.png new file mode 100644 index 0000000000..25174e76ab Binary files /dev/null and b/src/frontend/src/assets/images/no-file.png differ diff --git a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx index 17ed993eb1..a81a041874 100644 --- a/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx +++ b/src/frontend/src/components/ProjectSubmissions/SubmissionsTable.tsx @@ -434,7 +434,9 @@ const SubmissionsTable = ({ toggleView }) => { { - navigate(`/project/${projectId}/tasks/${taskUId}/submission/${row?.meta?.instanceID}`); + navigate( + `/project-submissions/${projectId}/tasks/${taskUId}/submission/${row?.meta?.instanceID}`, + ); }} />{' '} {' '} diff --git a/src/frontend/src/routes.jsx b/src/frontend/src/routes.jsx index b010f0066a..176b3967a5 100755 --- a/src/frontend/src/routes.jsx +++ b/src/frontend/src/routes.jsx @@ -81,7 +81,7 @@ const routes = createBrowserRouter([ ), }, { - path: '/project/:projectId/tasks/:taskId/submission/:instanceId', + path: '/project-submissions/:projectId/tasks/:taskId/submission/:instanceId', element: ( }> diff --git a/src/frontend/src/store/slices/CommonSlice.ts b/src/frontend/src/store/slices/CommonSlice.ts index d6553c0f3e..67211bafc6 100755 --- a/src/frontend/src/store/slices/CommonSlice.ts +++ b/src/frontend/src/store/slices/CommonSlice.ts @@ -15,6 +15,7 @@ const initialState: CommonStateTypes = { step: 1, }, }, + projectNotFound: false, }; const CommonSlice = createSlice({ @@ -33,6 +34,9 @@ const CommonSlice = createSlice({ SetCurrentStepFormStep(state, action) { state.currentStepFormStep[action.payload.flag] = { step: action.payload.step }; }, + SetProjectNotFound(state, action) { + state.projectNotFound = action.payload; + }, }, }); diff --git a/src/frontend/src/store/types/ICommon.ts b/src/frontend/src/store/types/ICommon.ts index 83ad79f385..c5ef875c85 100644 --- a/src/frontend/src/store/types/ICommon.ts +++ b/src/frontend/src/store/types/ICommon.ts @@ -7,6 +7,7 @@ export type CommonStateTypes = { step: number; }; }; + projectNotFound: boolean; }; type snackbarTypes = { diff --git a/src/frontend/src/views/MainView.tsx b/src/frontend/src/views/MainView.tsx index 944525cfc7..57c65733dc 100755 --- a/src/frontend/src/views/MainView.tsx +++ b/src/frontend/src/views/MainView.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import windowDimention from '@/hooks/WindowDimension'; import PrimaryAppBar from '@/utilities/PrimaryAppBar'; import CoreModules from '@/shared/CoreModules'; @@ -8,6 +8,7 @@ import Loader from '@/utilities/AppLoader'; import MappingHeader from '@/utilities/MappingHeader'; import { useLocation, useSearchParams } from 'react-router-dom'; import { useAppSelector } from '@/types/reduxTypes'; +import ProjectNotFound from './ProjectNotFound'; const MainView = () => { const dispatch = CoreModules.useAppDispatch(); @@ -17,6 +18,7 @@ const MainView = () => { const checkTheme = useAppSelector((state) => state.theme.hotTheme); const theme = CoreModules.createTheme(checkTheme); const stateSnackBar = useAppSelector((state) => state.common.snackbar); + const projectNotFound = useAppSelector((state) => state.common.projectNotFound); const handleClose = (event: React.SyntheticEvent, reason: string) => { if (reason === 'clickaway') { @@ -34,6 +36,11 @@ const MainView = () => { const popupInParams = searchParams.get('popup'); + useEffect(() => { + if (!projectNotFound) return; + dispatch(CommonActions.SetProjectNotFound(false)); + }, [pathname]); + return ( { )} - + ) : ( + - - {/* Footer */} - + : pathname.includes('project/') && windowSize.width <= 640 + ? '100vh' + : windowSize.width <= 599 + ? '90vh' + : '92vh', + overflow: 'auto', + // p: '1.3rem', + }} + > + + {/* Footer */} + + )} diff --git a/src/frontend/src/views/ProjectNotFound.tsx b/src/frontend/src/views/ProjectNotFound.tsx new file mode 100644 index 0000000000..703814451b --- /dev/null +++ b/src/frontend/src/views/ProjectNotFound.tsx @@ -0,0 +1,33 @@ +import React from 'react'; +import NoFileImage from '@/assets/images/no-file.png'; +import Button from '@/components/common/Button'; +import { useNavigate } from 'react-router-dom'; + +const ProjectNotFound = () => { + const navigate = useNavigate(); + return ( +
+
+
+ Project Not Found Photo +
+
+

+ PROJECT NOT FOUND +

+

+ There is no project to show, please create a project by clicking the button below.{' '} +

+
+
+
+ ); +}; + +export default ProjectNotFound;