File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed
src/library-authoring/collections Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change 5
5
Tab ,
6
6
Tabs ,
7
7
} from '@openedx/paragon' ;
8
- import { Link } from 'react-router-dom' ;
8
+ import { Link , useMatch } from 'react-router-dom' ;
9
9
10
10
import type { CollectionHit } from '../../search-manager' ;
11
11
import type { ContentLibrary } from '../data/api' ;
@@ -19,19 +19,24 @@ interface CollectionInfoProps {
19
19
20
20
const CollectionInfo = ( { library, collection } : CollectionInfoProps ) => {
21
21
const intl = useIntl ( ) ;
22
+ const url = `/library/${ library . id } /collection/${ collection . blockId } /` ;
23
+ const urlMatch = useMatch ( url ) ;
22
24
23
25
return (
24
26
< Stack >
25
- < div className = "d-flex flex-wrap" >
26
- < Button
27
- as = { Link }
28
- to = { `/library/${ library . id } /collection/${ collection . blockId } /` }
29
- variant = "outline-primary"
30
- className = "m-1 text-nowrap flex-grow-1"
31
- >
32
- { intl . formatMessage ( messages . openCollectionButton ) }
33
- </ Button >
34
- </ div >
27
+ { ! urlMatch && (
28
+ < div className = "d-flex flex-wrap" >
29
+ < Button
30
+ as = { Link }
31
+ to = { `/library/${ library . id } /collection/${ collection . blockId } /` }
32
+ variant = "outline-primary"
33
+ className = "m-1 text-nowrap flex-grow-1"
34
+ disabled = { ! ! urlMatch }
35
+ >
36
+ { intl . formatMessage ( messages . openCollectionButton ) }
37
+ </ Button >
38
+ </ div >
39
+ ) }
35
40
< Tabs
36
41
variant = "tabs"
37
42
className = "my-3 d-flex justify-content-around"
You can’t perform that action at this time.
0 commit comments