@@ -8,8 +8,12 @@ import {
88 Avatar ,
99} from "@mui/material" ;
1010import { Colors } from "design/theme" ;
11+ import { useAppDispatch } from "hooks/useAppDispatch" ;
12+ import { useAppSelector } from "hooks/useAppSelector" ;
1113import React from "react" ;
14+ import { useEffect } from "react" ;
1215import { Link } from "react-router-dom" ;
16+ import { fetchDbInfo } from "redux/neurojson/neurojson.action" ;
1317import RoutesEnum from "types/routes.enum" ;
1418import { modalityValueToEnumLabel } from "utils/SearchPageFunctions/modalityLabels" ;
1519
@@ -32,6 +36,10 @@ const DatabaseCard: React.FC<Props> = ({
3236 keyword,
3337 onChipClick,
3438} ) => {
39+ const dispatch = useAppDispatch ( ) ;
40+ const { loading, error, data, limit } = useAppSelector (
41+ ( state ) => state . neurojson
42+ ) ;
3543 const databaseLink = `${ RoutesEnum . DATABASES } /${ dbId } ` ;
3644 // keyword hightlight functional component
3745 const highlightKeyword = ( text : string , keyword ?: string ) => {
@@ -42,6 +50,12 @@ const DatabaseCard: React.FC<Props> = ({
4250 const regex = new RegExp ( `(${ keyword } )` , "gi" ) ; // for case-insensitive and global
4351 const parts = text . split ( regex ) ;
4452
53+ useEffect ( ( ) => {
54+ if ( dbId ) {
55+ dispatch ( fetchDbInfo ( dbId . toLowerCase ( ) ) ) ;
56+ }
57+ } , [ dbId , dispatch ] ) ;
58+
4559 return (
4660 < >
4761 { parts . map ( ( part , i ) =>
@@ -181,7 +195,8 @@ const DatabaseCard: React.FC<Props> = ({
181195
182196 < Stack direction = "row" spacing = { 1 } flexWrap = "wrap" gap = { 1 } >
183197 < Typography variant = "body2" mt = { 1 } >
184- < strong > Datasets:</ strong > { datasets ?? "N/A" }
198+ { /* <strong>Datasets:</strong> {datasets ?? "N/A"} */ }
199+ < strong > Datasets:</ strong > { limit ?? "N/A" }
185200 </ Typography >
186201 </ Stack >
187202 </ Stack >
0 commit comments