Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rerun prettier for #1087 #1089

Merged
merged 1 commit into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/dropzone/dropzone.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ const Dropzone = ({
// dropzone's built-in dragging status doesn't seem to work if there's anything rendered over the root div
const [dragging, setDragging] = useState(false);

const { getRootProps, getInputProps, open: openUploader } = useDropzone({
const {
getRootProps,
getInputProps,
open: openUploader,
} = useDropzone({
// Disable native files selection dialog - we'll handle this manually
noClick: true,
// Disable space/enter to open native files selection dialog
Expand All @@ -41,7 +45,7 @@ const Dropzone = ({
setDragging(false);
onDragLeave && onDragLeave(...args);
},
...props
...props,
});

return (
Expand Down
28 changes: 14 additions & 14 deletions src/components/explore/exploreControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let organTermList = [
"pancreas",
"heart",
"immune system",
"skin of body"
"skin of body",
];

class ExploreControls extends React.Component {
Expand Down Expand Up @@ -86,7 +86,7 @@ class ExploreControls extends React.Component {
}
};

getOrganDisplayLabel = organ => {
getOrganDisplayLabel = (organ) => {
const displayLabel = this.translateOrganNameToDisplayLabel(organ); // Converts any organ to corresponding display label (if specified)

return stringFormatter.convertSentenceCaseToTitleCase(displayLabel);
Expand All @@ -96,45 +96,45 @@ class ExploreControls extends React.Component {
return document.querySelectorAll("[id^=organ]");
};

getOrganFilter = organ => {
getOrganFilter = (organ) => {
const { cellCountSummaries } = this.props;

if (!cellCountSummaries || cellCountSummaries.length === 0) {
return []; // For when cell count summary is being fetched, or empty
}

return cellCountSummaries.filter(
cellCountSummary => cellCountSummary.label === organ
(cellCountSummary) => cellCountSummary.label === organ
);
};

getOrganId = organ => {
getOrganId = (organ) => {
const idStem = stringFormatter
.convertSentenceCaseToTitleCase(organ)
.replace(/\s/g, "");

return `organ${idStem}`;
};

getOrganIdStem = organId => {
getOrganIdStem = (organId) => {
return organId.split("organ")[1]; // Reverts organ id to organ id stem
};

isOrganSummarized = organ => {
isOrganSummarized = (organ) => {
return this.getOrganFilter(organ).length > 0; // Returns true when the specified organ is listed in the summary
};

removeOrganInteractions = () => {
const organEls = this.getOrganEls();

// Remove event listener for mouse over and mouse out and click event of organ elements
organEls.forEach(organEl => {
organEls.forEach((organEl) => {
organEl.removeEventListener("mouseenter", this.setOrganActive(organEl));
organEl.removeEventListener("mouseleave", this.clearOrganActive());
});
};

setOrganActive = organEl => {
setOrganActive = (organEl) => {
return () => {
const organId = this.getOrganIdStem(organEl.getAttribute("id"));
const organLabel = stringFormatter
Expand All @@ -151,17 +151,17 @@ class ExploreControls extends React.Component {
const organEls = this.getOrganEls();

// Add event listener for mouse over and mouse out and click event of organ elements
organEls.forEach(organEl => {
organEls.forEach((organEl) => {
organEl.addEventListener("mouseenter", this.setOrganActive(organEl));
organEl.addEventListener("mouseleave", this.clearOrganActive());
});
};

stringifyOrganFilter = term => {
stringifyOrganFilter = (term) => {
return JSON.stringify([{ facetName: "specimenOrgan", terms: [term] }]);
};

translateOrganNameToDisplayLabel = organName => {
translateOrganNameToDisplayLabel = (organName) => {
switch (organName) {
case "bone tissue":
return "bone";
Expand All @@ -176,7 +176,7 @@ class ExploreControls extends React.Component {
}
};

visitExploreLink = organ => {
visitExploreLink = (organ) => {
if (!this.isOrganSummarized(organ)) {
return; // Corresponding organ is not summarised by cell count summary
}
Expand Down Expand Up @@ -208,7 +208,7 @@ class ExploreControls extends React.Component {
? organTermList.map((organ, i) => (
<ClickHandler
className={classNames(compStyles.organ, {
[compStyles.unspecified]: !this.isOrganSummarized(organ)
[compStyles.unspecified]: !this.isOrganSummarized(organ),
})}
clickAction={() => this.visitExploreLink(organ)}
id={this.getOrganId(organ)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/explore/exploreDiagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ExploreDiagram extends React.Component {
this.setOrganAttributes();
}

getOrganEl = organ => {
getOrganEl = (organ) => {
// Note, svg organ element id stem should correspond with browser cell count summary label
return organ ? document.querySelector(`[id^=path${organ}]`) : null; // Returns corresponding organ element when organ is specified
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/figure-styles/figure-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import React, { useCallback, useEffect, useRef } from "react";
function FigureStyles(props) {
const { children, shadowless, width } = props;
const refFigure = useRef(null);
const figureEl = children?.filter(child => child?.type); // Filter for React Elements.
const figureEl = children?.filter((child) => child?.type); // Filter for React Elements.
const figureExists = figureEl && figureEl.length > 0;

const getComponentStyles = useCallback(() => {
Expand Down Expand Up @@ -73,7 +73,7 @@ function FigureStyles(props) {
};

const getGatsbyRespImageWrapperStyles = useCallback(
el => {
(el) => {
const wrapperStyles = el.getAttribute("style");
const componentStyles = getComponentStyles();

Expand All @@ -99,7 +99,7 @@ function FigureStyles(props) {
}, [mergeStyles]);

return figureExists ? (
React.Children.map(figureEl, figEl =>
React.Children.map(figureEl, (figEl) =>
React.cloneElement(figEl, { ref: refFigure })
)
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer-link/footer-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

// Core dependencies
import {Link} from "gatsby";
import { Link } from "gatsby";
import React from "react";

// Class name helper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as compStyles from "./footer-links-lungmap.module.css";
function FooterLinksLungMAP() {
const link = {
name: "Privacy",
path: "/lungmap-privacy"
path: "/lungmap-privacy",
};
return (
<div className={compStyles.links}>
Expand Down
28 changes: 15 additions & 13 deletions src/components/hcaAutosuggest/hcaAutosuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ class HCAAutosuggest extends React.Component {
suggestions: [],
suggestionsFound: false,
touched: false,
value: ""
value: "",
};
}

escapeRegexCharacters = str => {
escapeRegexCharacters = (str) => {
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
};

getSectionSuggestions = section => {
getSectionSuggestions = (section) => {
return section.terms;
};

findMatchingSuggestions = value => {
findMatchingSuggestions = (value) => {
const escapedValue = this.escapeRegexCharacters(value.trim());
const regex = new RegExp(escapedValue, "i");

Expand All @@ -47,13 +47,15 @@ class HCAAutosuggest extends React.Component {
return {
facetName: section.facetName,
facetDisplayName: section.facetDisplayName,
terms: section.terms.filter(term => regex.test(term.termDisplayName))
terms: section.terms.filter((term) =>
regex.test(term.termDisplayName)
),
};
})
.filter(section => section.terms.length > 0);
.filter((section) => section.terms.length > 0);
};

getSuggestionValue = suggestion => suggestion.termDisplayName;
getSuggestionValue = (suggestion) => suggestion.termDisplayName;

onChange = (event, { newValue, method }) => {
this.props.onSelected();
Expand All @@ -67,7 +69,7 @@ class HCAAutosuggest extends React.Component {

onSuggestionsClearRequested = () => {
this.setState({
suggestions: []
suggestions: [],
});
};

Expand All @@ -83,7 +85,7 @@ class HCAAutosuggest extends React.Component {
suggestions: suggestions.length
? suggestions
: this.props.autosuggestData,
touched: true
touched: true,
});

if (touched) {
Expand All @@ -106,9 +108,9 @@ class HCAAutosuggest extends React.Component {
this.props.onEnter();
};

renderSectionTitle = section => section.facetDisplayName;
renderSectionTitle = (section) => section.facetDisplayName;

renderSuggestion = suggestion => {
renderSuggestion = (suggestion) => {
const { showCounts } = this.props;
return (
<div className={compStyles.hcaOption}>
Expand All @@ -129,13 +131,13 @@ class HCAAutosuggest extends React.Component {
onBlur: this.props.onBlur,
onChange: this.onChange,
placeholder: this.props.placeholder,
value
value,
};

return (
<div
className={classNames(compStyles.search, {
[compStyles.error]: !suggestionsFound
[compStyles.error]: !suggestionsFound,
})}
>
<Autosuggest
Expand Down
6 changes: 3 additions & 3 deletions src/components/hcaContent/hcaContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HCAContent extends React.Component {
return showTOC;
};

onHandleUseTOC = event => {
onHandleUseTOC = (event) => {
this.setState({ showTOC: event });
};

Expand All @@ -50,12 +50,12 @@ class HCAContent extends React.Component {
label,
links,
metadataContent,
tabKey
tabKey,
} = this.props;
const useToc = this.isUseToc();
const useNav = this.isUseNav();
const classNamesContent = classNames(compStyles.hcaContent, {
[compStyles.metadataContent]: metadataContent
[compStyles.metadataContent]: metadataContent,
});

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/hcaMain/hcaMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function HCAMain(props) {
metadataContent,
nav,
onHandleSiteScroll,
sectionTitle
sectionTitle,
} = props,
{ label, links, secondaryTabs, section, tabKey, tabs } = nav || {};
const showMetadataSearch = docPath ? docPath.startsWith("/metadata") : false;
Expand Down
4 changes: 2 additions & 2 deletions src/components/headerNavDropDown/headerNavDropDown.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HeaderNavDropDown extends React.Component {
window.removeEventListener("mousedown", this.handleClick, false);
}

addDropDownClass = child => {
addDropDownClass = (child) => {
const { stack } = this.props,
{ openDropDown } = this.state;

Expand All @@ -44,7 +44,7 @@ class HeaderNavDropDown extends React.Component {
return React.cloneElement(child, props);
};

handleClick = e => {
handleClick = (e) => {
if (this.dropDown.current && !this.dropDown.current.contains(e.target)) {
this.setState({ openDropDown: false });
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/highlight/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Highlight(props) {
const regex = MetadataSearchService.onHandleSpecialChars(term)
.trim()
.split(/[.|_\s]/g)
.filter(term => !!term)
.filter((term) => !!term)
.join("|");

setTermRegex(new RegExp(`(${regex})`, "gi"));
Expand Down
4 changes: 2 additions & 2 deletions src/components/internal-link/internalLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import * as compStyles from "./internalLink.module.css";
function InternalLink(props) {
const { anchor, relative } = props;

const onAnchorClicked = anchor => {
const onAnchorClicked = (anchor) => {
navigate(`#${anchor}`);
};

return (
<button
className={classNames(compStyles.anchor, {
[compStyles.anchorRelative]: relative
[compStyles.anchorRelative]: relative,
})}
onClick={() => onAnchorClicked(anchor)}
aria-label={anchor}
Expand Down
4 changes: 2 additions & 2 deletions src/components/linkToBrowser/linkToBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import React from "react";

// App dependencies
import {Relationship} from "../../utils/anchor/relationship.model";
import {Target} from "../../utils/anchor/target.model";
import { Relationship } from "../../utils/anchor/relationship.model";
import { Target } from "../../utils/anchor/target.model";

class LinkToBrowser extends React.Component {
trimRelativeLink = () => {
Expand Down
Loading