Skip to content

Commit

Permalink
Streamline display with onlyPanels
Browse files Browse the repository at this point in the history
When controls.showOnlyPanels is active via the URL param "&onlyPanels" switch each primary panel to be an "infoPanel". This removes the title and the line above the title in the display card giving the panel a more streamlined appearance. This results in a more pleasant embedding into slide decks.
  • Loading branch information
trvrb committed Jun 12, 2024
1 parent 87c1920 commit 39d6f17
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/components/entropy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ const getStyles = (width) => {
zoomMax: state.controls.zoomMax,
defaultColorBy: state.controls.defaults.colorBy,
panelLayout: state.controls.panelLayout,
narrativeMode: state.narrative.display
narrativeMode: state.narrative.display,
showOnlyPanels: state.controls.showOnlyPanels
};
})
class Entropy extends React.Component {
Expand Down Expand Up @@ -258,7 +259,7 @@ class Entropy extends React.Component {
render() {
const styles = getStyles(this.props.width);
return (
<Card title={this.title()}>
<Card infocard={this.props.showOnlyPanels} title={this.title()}>
<InfoPanel d3event={this.state.hovered.d3event} width={this.props.width} height={this.props.height}>
{this.state.hovered ? this.state.hovered.tooltip(this.props.t) : null}
</InfoPanel>
Expand Down
5 changes: 3 additions & 2 deletions src/components/frequencies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import "../../css/entropy.css";
colorBy: state.controls.colorBy,
colorScale: state.controls.colorScale,
colorOptions: state.metadata.colorings,
normalizeFrequencies: state.controls.normalizeFrequencies
normalizeFrequencies: state.controls.normalizeFrequencies,
showOnlyPanels: state.controls.showOnlyPanels
};
})

Expand Down Expand Up @@ -102,7 +103,7 @@ class Frequencies extends React.Component {
const { t } = this.props;
const {tipCount, fullTipCount} = this.props.nodes[0];
return (
<Card title={`${t("Frequencies")} (${t("colored by")} ${parseColorBy(this.props.colorBy, this.props.colorOptions)} ${t(normString(this.props.normalizeFrequencies, tipCount, fullTipCount))})`}>
<Card infocard={this.props.showOnlyPanels} title={`${t("Frequencies")} (${t("colored by")} ${parseColorBy(this.props.colorBy, this.props.colorOptions)} ${t(normString(this.props.normalizeFrequencies, tipCount, fullTipCount))})`}>
<div
id="freqinfo"
style={{
Expand Down
5 changes: 3 additions & 2 deletions src/components/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ import "../../css/mapbox.css";
state.controls.geoResolution !== state.controls.colorScale.colorBy // geo circles match colorby == no pie chart
),
legendValues: state.controls.colorScale.legendValues,
showTransmissionLines: state.controls.showTransmissionLines
showTransmissionLines: state.controls.showTransmissionLines,
showOnlyPanels: state.controls.showOnlyPanels
};
})

Expand Down Expand Up @@ -614,7 +615,7 @@ class Map extends React.Component {
const transmissionsExist = this.state.transmissionData && this.state.transmissionData.length;
// clear layers - store all markers in map state https://github.com/Leaflet/Leaflet/issues/3238#issuecomment-77061011
return (
<Card center title={transmissionsExist ? t("Transmissions") : t("Geography")}>
<Card center infocard={this.props.showOnlyPanels} title={transmissionsExist ? t("Transmissions") : t("Geography")}>
{this.props.legend && <ErrorBoundary>
<Legend right width={this.props.width} />
</ErrorBoundary>}
Expand Down
3 changes: 2 additions & 1 deletion src/components/tree/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const Tree = connect((state) => ({
showAllBranchLabels: state.controls.showAllBranchLabels,
tipLabelKey: state.controls.tipLabelKey,
narrativeMode: state.narrative.display,
animationPlayPauseButton: state.controls.animationPlayPauseButton
animationPlayPauseButton: state.controls.animationPlayPauseButton,
showOnlyPanels: state.controls.showOnlyPanels
}))(UnconnectedTree);

export default Tree;
2 changes: 1 addition & 1 deletion src/components/tree/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class Tree extends React.Component {
const styles = this.getStyles();
const widthPerTree = this.props.showTreeToo ? (this.props.width - spaceBetweenTrees) / 2 : this.props.width;
return (
<Card center title={t("Phylogeny")}>
<Card center infocard={this.props.showOnlyPanels} title={t("Phylogeny")}>
<ErrorBoundary>
<Legend width={this.props.width}/>
</ErrorBoundary>
Expand Down

0 comments on commit 39d6f17

Please sign in to comment.