Skip to content

Commit

Permalink
OCLOMRS-1044:Bug Fix: Pick Concepts from Source and Dictionaries
Browse files Browse the repository at this point in the history
  • Loading branch information
jwamalwa committed Oct 5, 2021
1 parent cdbc57e commit 7bb2a77
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/apps/concepts/components/ViewConceptsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const ViewConceptsHeader: React.FC<Props> = ({
// toggleShowVerified
}) => {
const [showSources, setShowSources] = useState(false);
const [search, setSearch] = useState("");
const [preferredSources, setPreferredSources] = useState< { name: string; url: string }[] >();
useEffect(() => {
const defaultSources = Object.entries( PREFERRED_SOURCES_VIEW_ONLY).map(([key, value]) => ({ name: key, url: value }));
Expand All @@ -92,6 +93,9 @@ const ViewConceptsHeader: React.FC<Props> = ({
setPreferredSources(allSources);
} else setPreferredSources(defaultSources);
}, [showSources, sources, dictionaries]);
// const handleSearch = (event) => {
// setSearch(event.target.value)
// }

const classes = useStyles();
const isSourceContainer = containerType === SOURCE_CONTAINER;
Expand Down Expand Up @@ -138,29 +142,35 @@ const ViewConceptsHeader: React.FC<Props> = ({
container
// eslint-disable-next-line react/jsx-no-comment-textnodes
direction="column">
<Button
variant="text"
onClick={() => setShowSources(!showSources)}
>
{/* {showSources ? "Select a recommended source" : "Select an alternative source"} */}
</Button>
<Input
color="secondary"
{showSources?
<Input
color="primary"
type="search"
fullWidth
placeholder= {"Select an alternative source"}
//data-testid="switch-source"
value={search}
onChange = {event => setSearch(event.target.value)}
data-testid="switch-source"
endAdornment={
<InputAdornment position="end">
<IconButton
onClick={() => setShowSources(!showSources)}
onClick={() => setShowSources(!showSources)}
data-testid="searchButton"
>
<SearchIcon />
</IconButton>
</InputAdornment>
}
/>
/> :
<Button
variant="text"
onClick={() => setShowSources(!showSources)}
>
Select a recommended source
{/* {showSources ? "Select a recommended source" : "Select an alternative source"} */}
</Button>
}

{/* <FormControlLabel
control={
<Switch
Expand Down

0 comments on commit 7bb2a77

Please sign in to comment.