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

User interface adjustments #68

Merged
merged 5 commits into from
Mar 6, 2024
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v0.18.0 (2024-03-06)

* Prevent sub-region collection selector options from line breaking.
* Display uniform titles for maps and plots.
* Update citation text for maps and plots.


# v0.17.0 (2024-03-06)

* Display sensor/platform/algorithm in variable selectors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if (selectedCollectionId === undefined) {
setSelectedRegionId(props.parentRegionId);
}
}, [selectedCollectionId]);

Check warning on line 31 in src/components/ControlPanel/RegionSelector/SubRegionExplorer/SubRegionCollectionSelector/index.tsx

View workflow job for this annotation

GitHub Actions / Run tests

React Hook useEffect has missing dependencies: 'props.parentRegionId' and 'setSelectedRegionId'. Either include them or remove the dependency array

const handleSelectedCollectionId = (e: React.ChangeEvent<HTMLInputElement>) => {
// The "undefined" selection will come through as an empty string:
Expand Down Expand Up @@ -69,7 +69,7 @@

return (
<>
<div className={'SubRegionCollectionSelector'}>
<div id={'SubRegionCollectionSelector'}>
{subRegionCollectionOptions}
</div>
{
Expand Down
12 changes: 2 additions & 10 deletions src/components/MainWindow/LinePlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const LinePlot: React.FC<ILinePlotProps> = (props) => {
);
}

const chartTitle = `${regionLongname} - ${varLongname}`;
const yAxisTitle = props.selectedSatelliteVariable.labelPlotYaxis;

// WARNING: It is _critical_ that the data is copied before passing to
Expand Down Expand Up @@ -137,24 +136,17 @@ const LinePlot: React.FC<ILinePlotProps> = (props) => {
},
];

const ytdSeriesLastNonNullPoint = ytdSeries.filter(p => p[1] !== null).slice(-1)[0];
const ytdSeriesLastDate = new Date(ytdSeriesLastNonNullPoint[0]);
const chartOptions: Highcharts.Options = {
chart: {
height: '95%',
height: '88%',
type: 'line',
},
accessibility: {
// TODO: Add units text
description: `${varLongname} plotted over the current water year.`,
},
title: {
text: chartTitle,
style: {fontSize: '20px'},
},
subtitle: {
text: `As of ${ytdSeriesLastDate.toISOString().split('T')[0]}`,
style: {fontSize: '16px'},
text: undefined,
},
tooltip: {
shared: true,
Expand Down
14 changes: 14 additions & 0 deletions src/components/MainWindow/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,25 @@ const Tile: React.FC<ITileProps> = (props) => {
FallbackComponent={ErrorFallbackTileComponent}
resetKeys={[selectedTileType, selectedRegion, selectedSatelliteVariableId]}
>
<div className='tile-title'>
<h1><b>{selectedTileType === "map" ? selectedSatelliteVariable.longName : selectedSatelliteVariable.longNamePlot}</b></h1>
<h2><b>{selectedRegion.longName}</b> as of <b>{selectedSatelliteVariable.lastDateWithData}</b></h2>
<h3>
Climatology calculated over{' '}
<b>{selectedSatelliteVariable.historicWaterYearRange[0]}</b>
{' '}to{' '}
<b>{selectedSatelliteVariable.historicWaterYearRange[1]}</b>
</h3>
</div>

<Suspense fallback={<LoadingIcon size={200} />}>
{content}
</Suspense>

<div className='tile-citation'>
{CITATION}
<br/>
{`Data source: ${selectedSatelliteVariable.sensor}/${selectedSatelliteVariable.platform}/${selectedSatelliteVariable.algorithm}`}
</div>
</ErrorBoundary>
</div>
Expand Down
12 changes: 7 additions & 5 deletions src/constants/citation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const CITATION = (
'Rittger, K., Brodzik, M.J., & Raleigh, M. (2022).'
+ ' Snow Today. Boulder, Colorado USA.'
+ ' National Snow and Ice Data Center.'
);
const authors = "Rittger, K., Lenard, S.J.P., Palomaki, R.T.";
const year = (new Date()).getFullYear();
const projectText = "Snow Today"
const locationText = "Boulder, Colorado USA";
const orgText = "National Snow and Ice Data Center";

export const CITATION = `${authors} (${year}). ${projectText}. ${locationText}. ${orgText}.`;
1 change: 1 addition & 0 deletions src/style/SubRegionCollectionSelector.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#SubRegionCollectionSelector {
white-space: nowrap;
width: min-content;
}
.sub-region-collection-option {
display: inline-block;
Expand Down
19 changes: 18 additions & 1 deletion src/style/Tile.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,28 @@
flex-direction: column;
}

.tile-title h1, .tile-title h2, .tile-title h3 {
text-align: center;
line-height: 1em;
margin: 0;
}
.tile-title h1 {
font-size: 1.5em;
}
.tile-title h2 {
font-size: 1.3em;
}
.tile-title h3 {
font-size: 1em;
}

.tile-citation {
font-size: 14px;
background: white;
line-height: 1em;
text-align: center;
}

/* TODO: Remove? */
.tile-message {
margin: 20px;
}
Loading