diff --git a/next-app/src/app/datasources/page.tsx b/next-app/src/app/datasources/page.tsx index dfd53d5..3afe673 100644 --- a/next-app/src/app/datasources/page.tsx +++ b/next-app/src/app/datasources/page.tsx @@ -93,13 +93,13 @@ export default function DataPage(): ReactElement { } function checkedDataFilter( - tagType: string, + tagType: keyof IDataSourceFilters, tagName: string, boxIndex: number ) { setSelectedFilters((prev) => { const newFilters = { ...prev }; - const key = tagType === "dataType" ? "dataTypes" : "diseaseTypes"; + const key = tagType === "dataTypes" ? "dataTypes" : "diseaseTypes"; if (newFilters[key].includes(tagName)) { newFilters[key] = newFilters[key].filter((item) => item !== tagName); } else { @@ -118,10 +118,8 @@ export default function DataPage(): ReactElement { function applyDataTypeFilter(dataSource: IDataSourcesDC) { return ( selectedFilters.dataTypes.length === 0 || - selectedFilters.dataTypes.every((filter) => - dataSource.data.some( - (tag) => tag.toLowerCase() === filter.toLowerCase() - ) + selectedFilters.dataTypes.some((filter) => + dataSource.data.some((tag) => tag.toLowerCase() === filter.toLowerCase()) ) ); } @@ -129,7 +127,7 @@ export default function DataPage(): ReactElement { function applyDiseaseTypeFilter(dataSource: IDataSourcesDC) { return ( selectedFilters.diseaseTypes.length === 0 || - selectedFilters.diseaseTypes.every((filter) => + selectedFilters.diseaseTypes.some((filter) => dataSource.disease_type.some( (tag) => tag.toLowerCase() === filter.toLowerCase() ) @@ -158,13 +156,11 @@ export default function DataPage(): ReactElement { function sanitizeURL(url: string) { try { const parsedURL = new URL(url); - // Only allow http and https protocols if (parsedURL.protocol !== "http:" && parsedURL.protocol !== "https:") { return "#"; } return parsedURL.toString(); } catch { - // If URL is invalid, return a safe default return "#"; } } @@ -199,6 +195,11 @@ export default function DataPage(): ReactElement {
+ {/* Disclaimer */} +
+ To access data, researchers may need to obtain ethical approval, submit data requests and set up data management agreements. +
+ {/* Search */}
+ {/* Data Type Filters */}

Data Type

@@ -229,11 +231,7 @@ export default function DataPage(): ReactElement { id={`dataType-${index}`} checked={checkedList[index]} onCheckedChange={() => - checkedDataFilter( - "dataType", - element.toLowerCase(), - index - ) + checkedDataFilter("dataTypes", element, index) } />
+ {/* Disease Type Filters */}

Disease Type @@ -263,8 +262,8 @@ export default function DataPage(): ReactElement { checked={checkedList[filters.dataTypes.length + index]} onCheckedChange={() => checkedDataFilter( - "diseaseType", - element.toLowerCase(), + "diseaseTypes", + element, filters.dataTypes.length + index ) } diff --git a/next-app/src/app/registries/page.tsx b/next-app/src/app/registries/page.tsx index 0ead18a..7c81ea3 100644 --- a/next-app/src/app/registries/page.tsx +++ b/next-app/src/app/registries/page.tsx @@ -83,8 +83,6 @@ export default function RegistryPage() { useEffect(() => { async function fetchRegistryData() { try { - // In a real-world scenario, you might fetch this data from an API - // For this example, we'll simulate an API call with a local import const registryData = await import( "@/assets/Kvalitetsregister_geo_dates_02.09.2024.json" ); @@ -196,6 +194,11 @@ export default function RegistryPage() {
+ {/* Disclaimer */} +
+ To access data, researchers may need to obtain ethical approval, submit data requests and set up data management agreements. +
+ {/* Search */}
+ {/* Organisation Filters */}

Organisation @@ -242,6 +246,7 @@ export default function RegistryPage() {

+ {/* Category Filters */}

Category