11
11
12
12
import { signOut , useSession } from 'next-auth/react'
13
13
import { useTranslations } from 'next-intl'
14
- import { notFound } from 'next/navigation'
14
+ import { notFound , useRouter } from 'next/navigation'
15
15
import { useEffect , useState } from 'react'
16
16
import { Button , Col , Dropdown , ListGroup , Row , Spinner , Tab } from 'react-bootstrap'
17
17
@@ -29,6 +29,7 @@ export default function ViewProjects({ projectId }: { projectId: string }) {
29
29
const [ summaryData , setSummaryData ] = useState < SummaryDataType | undefined > ( undefined )
30
30
const [ administrationData , setAdministrationData ] = useState < AdministrationDataType | undefined > ( undefined )
31
31
const [ show , setShow ] = useState ( false )
32
+ const router = useRouter ( )
32
33
33
34
useEffect ( ( ) => {
34
35
if ( status !== 'authenticated' ) return
@@ -61,6 +62,10 @@ export default function ViewProjects({ projectId }: { projectId: string }) {
61
62
return ( ) => controller . abort ( )
62
63
} , [ projectId , session ] )
63
64
65
+ const handleEditProject = ( projectId : string ) => {
66
+ router . push ( `/projects/edit/${ projectId } ` )
67
+ }
68
+
64
69
return (
65
70
< >
66
71
< LinkProjects show = { show } setShow = { setShow } projectId = { projectId } />
@@ -105,7 +110,11 @@ export default function ViewProjects({ projectId }: { projectId: string }) {
105
110
< Row className = 'd-flex justify-content-between' >
106
111
< Col lg = { 6 } >
107
112
< 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
+ >
109
118
{ t ( 'Edit Projects' ) }
110
119
</ Button >
111
120
< Button variant = 'secondary' className = 'col-auto' onClick = { ( ) => setShow ( true ) } >
0 commit comments