Skip to content

Commit ffca3a1

Browse files
authored
Revert "PODCAT-884: Search Catalog - Implement usable links parity in Card view. (#234)" (#240)
This reverts commit 00ee398.
1 parent 5f15330 commit ffca3a1

File tree

1 file changed

+1
-80
lines changed

1 file changed

+1
-80
lines changed

src/pages/searchCatalogPage/SearchResult/SearchResult.js

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,6 @@ const SearchResultContainer = styled.div`
167167
color: #004187;
168168
}
169169
170-
.descLink {
171-
margin: 0 3px 0 3px;
172-
padding: 1px 5px 1px 5px;
173-
border: 1px solid #9EC1DB;
174-
border-radius: 5px;
175-
font-weight: bold;
176-
background-color: #DFEEF9;
177-
color: #004187;
178-
line-height: 2.5em;
179-
}
180-
181170
a[target="_blank"] {
182171
color: #004187;
183172
background: url(${externalIcon}) right center no-repeat #DFEEF9;
@@ -608,43 +597,6 @@ const SearchResult = ({
608597
} else {
609598
desc = desc.replace(/<(?![b/])/g, "&lt;");
610599
}
611-
const arr = desc.split("http");
612-
let descArr = [];
613-
if (arr.length > 1) {
614-
if (arr[0].endsWith("<b>")) {
615-
descArr.push(arr[0].substring(0, arr[0].length - 3));
616-
} else {
617-
descArr.push(arr[0]);
618-
}
619-
for (let i = 1; i < arr.length; i += 1) {
620-
const urlArr = arr[i].split(" ");
621-
const url = urlArr[0].replace("</b>", "");
622-
const urlLastChar = url[url.length - 1];
623-
if (",;.()<>{}".includes(urlLastChar)) {
624-
const newUrl = "http".concat(url.substring(0, url.length - 1));
625-
descArr.push(newUrl);
626-
const restText = arr[i].split(url.substring(0, url.length - 1))[1];
627-
if (restText.endsWith("<b>")) {
628-
descArr.push(restText.substring(0, restText.length - 3));
629-
} else {
630-
descArr.push(restText);
631-
}
632-
} else {
633-
const newUrl = "http".concat(url);
634-
descArr.push(newUrl);
635-
if (urlArr.length !== 1) {
636-
const restText = arr[i].split(url)[1];
637-
if (restText.endsWith("<b>")) {
638-
descArr.push(restText.substring(0, restText.length - 3));
639-
} else {
640-
descArr.push(restText);
641-
}
642-
}
643-
}
644-
}
645-
} else {
646-
descArr = arr;
647-
}
648600
const otherMatches = [];
649601
if (rst.highlight) {
650602
Object.keys(rst.highlight).forEach((hl) => {
@@ -773,20 +725,7 @@ const SearchResult = ({
773725
<div className="col">
774726
<label>Description:</label>
775727
<span className="textSpan">
776-
{
777-
descArr.map((item, desidx) => {
778-
const deskey = `des_${desidx}`;
779-
return (
780-
item.includes("http")
781-
? (
782-
<span key={deskey} className="descLink">
783-
<a href={item} target="_blank" rel="noreferrer noopener">{item}</a>
784-
</span>
785-
)
786-
: <span key={deskey}>{ReactHtmlParser(item)}</span>
787-
);
788-
})
789-
}
728+
{ReactHtmlParser(desc)}
790729
</span>
791730
</div>
792731
</div>
@@ -905,24 +844,6 @@ const SearchResult = ({
905844
</span>
906845
);
907846
}
908-
if (am.name === "GEO Study Identifier") {
909-
const geoId = m.replace(/<b>/g, "").replace(/<\/b>/g, "");
910-
const geoLink = ''.concat('https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=', geoId);
911-
return (
912-
<span className="itemSpan">
913-
<a href={geoLink} target="_blank" rel="noreferrer noopener">{geoId}</a>
914-
</span>
915-
);
916-
}
917-
if (am.name === "dbGaP Study Identifier") {
918-
const dbId = m.replace(/<b>/g, "").replace(/<\/b>/g, "");
919-
const dbLink = ''.concat('https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=', dbId);
920-
return (
921-
<span className="itemSpan">
922-
<a href={dbLink} target="_blank" rel="noreferrer noopener">{dbId}</a>
923-
</span>
924-
);
925-
}
926847
return (
927848
<span className="itemSpan additionalItemSpan">{ReactHtmlParser(m)}</span>
928849
);

0 commit comments

Comments
 (0)