1- import { useCallback , useEffect , useMemo , useState } from "react" ;
2- import { generatePath , useNavigate } from "react-router-dom" ;
1+ import { useEffect , useMemo , useState } from "react" ;
2+ import { generatePath , Link } from "react-router-dom" ;
33import { Box } from "@mui/material" ;
44import { KeenSliderOptions } from "keen-slider" ;
55import "keen-slider/keen-slider.min.css" ;
@@ -39,7 +39,6 @@ export const Slider = ({
3939 const [ isSliderInitialized , setIsSliderInitialized ] = useState ( false ) ;
4040
4141 const { isMobile, screenWidth } = useScreenDimension ( ) ;
42- const navigate = useNavigate ( ) ;
4342 const { pendingTransaction } = useCardano ( ) ;
4443 const { t } = useTranslation ( ) ;
4544
@@ -77,19 +76,6 @@ export const Slider = ({
7776 instanceRef . current ?. moveToIdx ( 0 ) ;
7877 } ;
7978
80- const onClickShowAll = useCallback ( ( ) => {
81- navigate (
82- generatePath (
83- onDashboard
84- ? PATHS . dashboardGovernanceActionsCategory
85- : PATHS . governanceActionsCategory ,
86- {
87- category : navigateKey ,
88- } ,
89- ) ,
90- ) ;
91- } , [ navigate , onDashboard ] ) ;
92-
9379 useEffect ( ( ) => {
9480 if ( instanceRef . current ) {
9581 setIsSliderInitialized ( true ) ;
@@ -129,6 +115,15 @@ export const Slider = ({
129115 < Typography variant = "title2" > { title } </ Typography >
130116 { ( notSlicedDataLength > 6 || ( isMobile && isShowAll ) ) && (
131117 < Button
118+ component = { Link }
119+ to = { `${ generatePath (
120+ onDashboard
121+ ? PATHS . dashboardGovernanceActionsCategory
122+ : PATHS . governanceActionsCategory ,
123+ {
124+ category : navigateKey ,
125+ } ,
126+ ) } `}
132127 variant = "contained"
133128 size = "medium"
134129 sx = { {
@@ -139,7 +134,6 @@ export const Slider = ({
139134 minWidth : 93 ,
140135 "&:hover" : { backgroundColor : arcticWhite } ,
141136 } }
142- onClick = { onClickShowAll }
143137 >
144138 { t ( "slider.showAll" ) }
145139 </ Button >
0 commit comments