diff --git a/src/client/Router.tsx b/src/client/Router.tsx index 1bdc352..3f5e050 100644 --- a/src/client/Router.tsx +++ b/src/client/Router.tsx @@ -45,7 +45,7 @@ const router = createBrowserRouter( errorElement: , children: [ { - index: true, + path: 'summary', element: , }, { diff --git a/src/client/components/Admin/Admin.tsx b/src/client/components/Admin/Admin.tsx index 4000731..e59ce7d 100644 --- a/src/client/components/Admin/Admin.tsx +++ b/src/client/components/Admin/Admin.tsx @@ -16,7 +16,7 @@ const Admin = () => { const pathParts = location.pathname.split('/').filter(Boolean) - const tab = pathParts.length === 1 ? 'summary' : pathParts[1] + const tab = pathParts[1] === 'entry' ? 'summary' : pathParts[1] return ( { > diff --git a/src/client/components/Admin/Summary/Summary.tsx b/src/client/components/Admin/Summary/Summary.tsx index 14de7c1..da2fb6f 100644 --- a/src/client/components/Admin/Summary/Summary.tsx +++ b/src/client/components/Admin/Summary/Summary.tsx @@ -63,7 +63,7 @@ const Table = ({ tableValues }: { tableValues: TableValues[] }) => { })} > {columnId === 'projectName' ? ( - + {cell.getValue()} ) : ( @@ -77,6 +77,7 @@ const Table = ({ tableValues }: { tableValues: TableValues[] }) => { ) const handleDeleteRiskAssessment = (row: MRT_Row) => { + // eslint-disable-next-line no-alert if (!window.confirm('Haluatko poistaa valitun riskiarvion?')) return try { diff --git a/src/client/components/UserPage/UserEntry.tsx b/src/client/components/UserPage/UserEntry.tsx index 1dfcaa4..48f5bd8 100644 --- a/src/client/components/UserPage/UserEntry.tsx +++ b/src/client/components/UserPage/UserEntry.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react' import { Box, Button, Tab, Tabs } from '@mui/material' import ArrowBackIcon from '@mui/icons-material/ArrowBack' -import { Link, useLocation, useParams } from 'react-router-dom' +import { Link, useParams } from 'react-router-dom' import { useTranslation } from 'react-i18next' import RenderAnswers from '../ResultPage/RenderAnswers' import RiskTable from '../ResultPage/RiskTable' @@ -51,7 +51,6 @@ const UserEntry = () => { const { entryId } = useParams() const { survey } = useSurvey() const { entry } = useEntry(entryId) - const location = useLocation() const [tabValue, setTabValue] = useState(0) const { t } = useTranslation() @@ -59,8 +58,6 @@ const UserEntry = () => { setTabValue(newValue) } - const parentRoute = location.pathname.split('/')[1] - if (!entry || !survey) return null const { answers, country, updatedData } = entry.data @@ -69,7 +66,7 @@ const UserEntry = () => {