Skip to content

Commit 40e0359

Browse files
committed
fix(edit_project): Added route from project detail to edit projetcs page
1 parent a19e70b commit 40e0359

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/app/[locale]/projects/detail/[id]/components/ProjectDetailTab.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import { signOut, useSession } from 'next-auth/react'
1313
import { useTranslations } from 'next-intl'
14-
import { notFound } from 'next/navigation'
14+
import { notFound, useRouter } from 'next/navigation'
1515
import { useEffect, useState } from 'react'
1616
import { Button, Col, Dropdown, ListGroup, Row, Spinner, Tab } from 'react-bootstrap'
1717

@@ -29,6 +29,7 @@ export default function ViewProjects({ projectId }: { projectId: string }) {
2929
const [summaryData, setSummaryData] = useState<SummaryDataType | undefined>(undefined)
3030
const [administrationData, setAdministrationData] = useState<AdministrationDataType | undefined>(undefined)
3131
const [show, setShow] = useState(false)
32+
const router = useRouter()
3233

3334
useEffect(() => {
3435
if (status !== 'authenticated') return
@@ -61,6 +62,10 @@ export default function ViewProjects({ projectId }: { projectId: string }) {
6162
return () => controller.abort()
6263
}, [projectId, session])
6364

65+
const handleEditProject = (projectId: string) => {
66+
router.push(`/projects/edit/${projectId}`)
67+
}
68+
6469
return (
6570
<>
6671
<LinkProjects show={show} setShow={setShow} projectId={projectId} />
@@ -105,7 +110,11 @@ export default function ViewProjects({ projectId }: { projectId: string }) {
105110
<Row className='d-flex justify-content-between'>
106111
<Col lg={6}>
107112
<Row>
108-
<Button variant='primary' className='me-2 col-auto'>
113+
<Button
114+
variant='primary'
115+
className='me-2 col-auto'
116+
onClick={() => handleEditProject(projectId)}
117+
>
109118
{t('Edit Projects')}
110119
</Button>
111120
<Button variant='secondary' className='col-auto' onClick={() => setShow(true)}>

0 commit comments

Comments
 (0)