Skip to content

Commit

Permalink
fix(edit_project): Added route from project detail to edit projetcs page
Browse files Browse the repository at this point in the history
  • Loading branch information
amritkv committed Jan 2, 2024
1 parent a19e70b commit 412ba9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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

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

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

const handleEditProject = (projectId: string) => {
router.push(`/projects/edit/${projectId}`)
}

return (
<>
<LinkProjects show={show} setShow={setShow} projectId={projectId} />
Expand Down Expand Up @@ -105,7 +110,11 @@ export default function ViewProjects({ projectId }: { projectId: string }) {
<Row className='d-flex justify-content-between'>
<Col lg={6}>
<Row>
<Button variant='primary' className='me-2 col-auto'>
<Button
variant='primary'
className='me-2 col-auto'
onClick={() => handleEditProject(projectId)}
>
{t('Edit Projects')}
</Button>
<Button variant='secondary' className='col-auto' onClick={() => setShow(true)}>
Expand Down
2 changes: 1 addition & 1 deletion src/object-types/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { Links, User } from '@/object-types'

interface Project {
id: string
id?: string
name: string
considerReleasesFromExternalList?: boolean
additionalData?: object
Expand Down

0 comments on commit 412ba9c

Please sign in to comment.