From 81484bde105fea6f3dbd69a153e51c2da8bb2b52 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Jagannathan <37613906+jagnathan@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:35:28 -0500 Subject: [PATCH] Add option to search based on authorized and unauthorized studies --- .../query/filteredSearch/Phrase.tsx | 2 +- .../unknownStudies/UnknownStudiesWarning.tsx | 58 ++++++++++++++++--- src/shared/lib/query/QueryParser.ts | 2 +- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/src/shared/components/query/filteredSearch/Phrase.tsx b/src/shared/components/query/filteredSearch/Phrase.tsx index 7beeef04b76..3b795975ca1 100644 --- a/src/shared/components/query/filteredSearch/Phrase.tsx +++ b/src/shared/components/query/filteredSearch/Phrase.tsx @@ -129,7 +129,7 @@ export class ListPhrase implements Phrase { for (const fieldName of this.fields) { let anyPhraseMatch = false; const fieldValue = study[fieldName]; - if (fieldValue) { + if (typeof fieldValue !== 'undefined') { for (const phrase of this._phraseList) { anyPhraseMatch = anyPhraseMatch || diff --git a/src/shared/components/unknownStudies/UnknownStudiesWarning.tsx b/src/shared/components/unknownStudies/UnknownStudiesWarning.tsx index babb75fb54c..a8e4635de03 100644 --- a/src/shared/components/unknownStudies/UnknownStudiesWarning.tsx +++ b/src/shared/components/unknownStudies/UnknownStudiesWarning.tsx @@ -1,12 +1,29 @@ import * as React from 'react'; import { observer } from 'mobx-react'; +import { Collapse } from 'react-collapse'; +import classnames from 'classnames'; @observer export default class UnknownStudiesWarning extends React.Component< { ids: String[] }, + { studiesCollapsed: boolean }, {} > { + constructor(props: { ids: String[] }) { + super(props); + this.state = { + studiesCollapsed: true + }; + } + + toggleStudiesCollapse = () => { + this.setState(prevState => ({ + studiesCollapsed: !prevState.studiesCollapsed + })); + } + render() { + const { studiesCollapsed } = this.state; if (this.props.ids.length > 0) { return (