Skip to content

Commit

Permalink
Merge branch 'main' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
katiestahl authored Jun 7, 2024
2 parents 646e808 + 518bea1 commit 015d112
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 4 deletions.
67 changes: 67 additions & 0 deletions client/src/components/Shared/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,73 @@ const SearchBar: React.FC<SearchBarProps> = ({ handleSubmit }) => {
setPastedSearchDelimiter(event.target.value as string);
};

const pasteAlert =
searchWasPasted && pastedSearchDelimiter === '' ? (
<Box width="100%" pb={2}>
<Alert severity="info">
<AlertTitle>Verify your search terms</AlertTitle>
<p>
It looks like you pasted search terms. We have defaulted the
delimiter to comma-separated terms.
</p>
<p style={{ marginTop: '10px' }}>
If this is incorrect or you would like to use a different delimiter,
make sure to check the “Bulk search” option below and select a
delimiter from the drop down.
</p>
</Alert>
</Box>
) : (
<></>
);

const convertToDropdownOptions = (options: string[]) => {
return options.map((item: string) => {
return { suggestion: item.trim() };
});
};

const handlePaste = (event: any) => {
let pastedText = event.clipboardData.getData('text');
let pastedOptions: any[] = convertToDropdownOptions([pastedText]);

const commaSepOptions = pastedText.split(',');

if (pastedSearchDelimiter === DelimiterTypes.Comma) {
pastedOptions = convertToDropdownOptions(commaSepOptions);
} else if (pastedSearchDelimiter === DelimiterTypes.CommaSpace) {
const commaSpaceSepOptions = pastedText.split(', ');
pastedOptions = convertToDropdownOptions(commaSpaceSepOptions);
} else if (pastedSearchDelimiter === DelimiterTypes.TabNewline) {
const whitespaceRegex = /[\t\n\r\f\v]/;
const whitespaceSepOptions = pastedText.split(whitespaceRegex);
pastedOptions = convertToDropdownOptions(whitespaceSepOptions);
} else {
pastedOptions = convertToDropdownOptions(commaSepOptions);
}
setSearchWasPasted(true);
// make sure we persist the search terms already entered, combine any pre-existing search terms with the new pasted options
const newSearchOptions = selectedOptions.concat(pastedOptions);
// remove any duplicated terms (need to iterate through only the terms since objects are never equivalent in js, even if the contents are the same)
const uniqueSearchTerms = [
...new Set(newSearchOptions.map((option) => option.suggestion)),
];
setSelectedOptions(convertToDropdownOptions(uniqueSearchTerms));
// we don't want the code to also run what's in onInputChange for the Autocomplete since everything is handled here
event.preventDefault();
};

const handleCheckboxSelect = (event: any) => {
setPastingFromDocument(event.target.checked);
// reset the selected delimiter and searchWasPasted, to avoid potential weird behaviors if a user deselects the checkbox
setPastedSearchDelimiter('');
setSearchWasPasted(false);
};

const handleDelimiterChange = (event: any) => {
setPastedSearchDelimiter(event.target.value as string);
};

const pasteAlert =
searchWasPasted && pastedSearchDelimiter === '' ? (
<Box width="100%" pb={2}>
Expand Down
6 changes: 3 additions & 3 deletions server/public/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.090445a8.css",
"main.js": "/static/js/main.c80660af.js",
"main.js": "/static/js/main.2d27fea7.js",
"static/js/461.86214142.chunk.js": "/static/js/461.86214142.chunk.js",
"static/js/80.a852d8b5.chunk.js": "/static/js/80.a852d8b5.chunk.js",
"static/js/990.d59bee53.chunk.js": "/static/js/990.d59bee53.chunk.js",
Expand All @@ -28,7 +28,7 @@
"static/js/925.a41f4405.chunk.js": "/static/js/925.a41f4405.chunk.js",
"index.html": "/index.html",
"main.090445a8.css.map": "/static/css/main.090445a8.css.map",
"main.c80660af.js.map": "/static/js/main.c80660af.js.map",
"main.2d27fea7.js.map": "/static/js/main.2d27fea7.js.map",
"461.86214142.chunk.js.map": "/static/js/461.86214142.chunk.js.map",
"80.a852d8b5.chunk.js.map": "/static/js/80.a852d8b5.chunk.js.map",
"990.d59bee53.chunk.js.map": "/static/js/990.d59bee53.chunk.js.map",
Expand Down Expand Up @@ -56,6 +56,6 @@
},
"entrypoints": [
"static/css/main.090445a8.css",
"static/js/main.c80660af.js"
"static/js/main.2d27fea7.js"
]
}
2 changes: 1 addition & 1 deletion server/public/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="DGIdb, The Drug Gene Interaction Database, is a research resource that can be used to search candidate genes or drugs against the known and potentially druggable genome."/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;350;400;500;700;800&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Lato:wght@100;300;350;400;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@200;300;350;400;500;600&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/dgidb-icon_48.png"/><link rel="manifest" href="/manifest.json"/><title>DGIdb</title><script defer="defer" src="/static/js/main.c80660af.js"></script><link href="/static/css/main.090445a8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="DGIdb, The Drug Gene Interaction Database, is a research resource that can be used to search candidate genes or drugs against the known and potentially druggable genome."/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;350;400;500;700;800&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Lato:wght@100;300;350;400;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@200;300;350;400;500;600&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/dgidb-icon_48.png"/><link rel="manifest" href="/manifest.json"/><title>DGIdb</title><script defer="defer" src="/static/js/main.2d27fea7.js"></script><link href="/static/css/main.090445a8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
3 changes: 3 additions & 0 deletions server/public/static/js/main.2d27fea7.js

Large diffs are not rendered by default.

123 changes: 123 additions & 0 deletions server/public/static/js/main.2d27fea7.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*!
* Chart.js v3.7.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
*/

/*!
* is-primitive <https://github.com/jonschlinkert/is-primitive>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*/

/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/

/*!
* set-value <https://github.com/jonschlinkert/set-value>
*
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
* Released under the MIT License.
*/

/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/**
* React Router DOM v6.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

/**
* React Router v6.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/

/** @license MUI v5.11.0
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v17.0.2
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
1 change: 1 addition & 0 deletions server/public/static/js/main.2d27fea7.js.map

Large diffs are not rendered by default.

0 comments on commit 015d112

Please sign in to comment.