Skip to content

Commit c10f8ca

Browse files
committed
fix(search): stop showing undefined age in subject card
1 parent fa8c542 commit c10f8ca

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/components/SearchPage/SubjectCard.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import RoutesEnum from "types/routes.enum";
88
interface SubjectCardProps {
99
dbname: string;
1010
dsname: string;
11-
age: string;
11+
agemin: string;
1212
subj: string;
1313
parsedJson: {
1414
key: string[];
@@ -26,17 +26,14 @@ interface SubjectCardProps {
2626
const SubjectCard: React.FC<SubjectCardProps> = ({
2727
dbname,
2828
dsname,
29-
age,
29+
agemin,
3030
subj,
3131
parsedJson,
3232
index,
3333
onChipClick,
3434
}) => {
3535
const { modalities, tasks, sessions, types } = parsedJson.value;
3636
const subjectLink = `${RoutesEnum.DATABASES}/${dbname}/${dsname}`;
37-
// const subjectLink = `${
38-
// RoutesEnum.DATABASES
39-
// }/${dbname}/${dsname}?focusSubj=${encodeURIComponent(subj)}`;
4037
const canonicalSubj = /^sub-/i.test(subj)
4138
? subj
4239
: `sub-${String(subj)
@@ -55,8 +52,8 @@ const SubjectCard: React.FC<SubjectCardProps> = ({
5552

5653
// cover age string to readable format
5754
let ageDisplay = "N/A";
58-
if (age) {
59-
const ageNum = parseInt(age, 10) / 100;
55+
if (agemin) {
56+
const ageNum = parseInt(agemin, 10) / 100;
6057
if (Number.isInteger(ageNum)) {
6158
ageDisplay = `${ageNum} years`;
6259
} else {

src/pages/SearchPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ const SearchPage: React.FC = () => {
814814
paginatedResults.length > 0 &&
815815
paginatedResults.map((item, idx) => {
816816
try {
817+
// console.log("item:", item);
817818
const parsedJson = JSON.parse(item.json);
818819
const globalIndex =
819820
(page - 1) * itemsPerPage + idx;

src/pages/UpdatedDatasetDetailPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const UpdatedDatasetDetailPage: React.FC = () => {
6262
: /^sub-/i.test(focusSubjRaw)
6363
? focusSubjRaw
6464
: `sub-${focusSubjRaw.replace(/^0+/, "").padStart(2, "0")}`;
65-
console.log("focusSubj", focusSubj);
65+
6666
// for revision
6767
const rev = searchParams.get("rev") || undefined;
6868

@@ -210,7 +210,7 @@ const UpdatedDatasetDetailPage: React.FC = () => {
210210
obj.MeshNode?.hasOwnProperty("_ArrayZipData_") &&
211211
typeof obj.MeshNode["_ArrayZipData_"] === "string"
212212
) {
213-
console.log("path", path);
213+
// console.log("path", path);
214214
internalLinks.push({
215215
name: "JMesh",
216216
data: obj,
@@ -297,7 +297,7 @@ const UpdatedDatasetDetailPage: React.FC = () => {
297297
useEffect(() => {
298298
if (datasetDocument) {
299299
// Extract External Data & Assign `index`
300-
console.log("datasetDocument", datasetDocument);
300+
// console.log("datasetDocument", datasetDocument);
301301
const links = extractDataLinks(datasetDocument, "").map(
302302
(link, index) => ({
303303
...link,

0 commit comments

Comments
 (0)