Add missing useNavigate hook in ChoreView component
This commit is contained in:
parent
bc741d920a
commit
7a490116b7
1 changed files with 19 additions and 9 deletions
|
@ -30,7 +30,7 @@ import {
|
||||||
} from '@mui/joy'
|
} from '@mui/joy'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useParams, useSearchParams } from 'react-router-dom'
|
import { useNavigate, useParams, useSearchParams } from 'react-router-dom'
|
||||||
import {
|
import {
|
||||||
GetAllUsers,
|
GetAllUsers,
|
||||||
GetChoreDetailById,
|
GetChoreDetailById,
|
||||||
|
@ -48,7 +48,7 @@ const IconCard = styled('div')({
|
||||||
})
|
})
|
||||||
const ChoreView = () => {
|
const ChoreView = () => {
|
||||||
const [chore, setChore] = useState({})
|
const [chore, setChore] = useState({})
|
||||||
|
const navigate = useNavigate()
|
||||||
const [performers, setPerformers] = useState([])
|
const [performers, setPerformers] = useState([])
|
||||||
const [infoCards, setInfoCards] = useState([])
|
const [infoCards, setInfoCards] = useState([])
|
||||||
const { choreId } = useParams()
|
const { choreId } = useParams()
|
||||||
|
@ -266,6 +266,9 @@ const ChoreView = () => {
|
||||||
color='success'
|
color='success'
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
fullWidth
|
fullWidth
|
||||||
|
onClick={() => {
|
||||||
|
navigate(`/chores/${choreId}/history`)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
History
|
History
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -277,6 +280,9 @@ const ChoreView = () => {
|
||||||
color='success'
|
color='success'
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
fullWidth
|
fullWidth
|
||||||
|
onClick={() => {
|
||||||
|
navigate(`/chores/${choreId}/edit`)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -333,9 +339,11 @@ const ChoreView = () => {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
overlay
|
overlay
|
||||||
sx={{
|
sx={
|
||||||
my: 1,
|
{
|
||||||
}}
|
// my: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
label={<Typography level='body2'>Set completion date</Typography>}
|
label={<Typography level='body2'>Set completion date</Typography>}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
@ -349,21 +357,23 @@ const ChoreView = () => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{completedDate === null && (
|
|
||||||
|
{/* {completedDate === null && (
|
||||||
// placeholder for the completion date with margin:
|
// placeholder for the completion date with margin:
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
height: 56,
|
height: 56,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)} */}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
fullWidth
|
fullWidth
|
||||||
size='lg'
|
size='lg'
|
||||||
sx={{
|
sx={{
|
||||||
height: 50,
|
height: 50,
|
||||||
mb: 2,
|
// mb: 2,
|
||||||
}}
|
}}
|
||||||
onClick={handleTaskCompletion}
|
onClick={handleTaskCompletion}
|
||||||
disabled={isPendingCompletion}
|
disabled={isPendingCompletion}
|
||||||
|
|
Loading…
Add table
Reference in a new issue