Skip to content

Commit

Permalink
Merge branch 'fix_total_svg'
Browse files Browse the repository at this point in the history
* fix_total_svg:
  fix: update the year when change by Title & City, otherwise the `SVG` will be displayed and the table will not be shown if the previous status is 'Total'
  • Loading branch information
ben-29 committed Dec 10, 2023
2 parents f57f4bc + f9c529b commit 51853fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ const Index = () => {
func: (_run: Activity, _value: string) => boolean
) => {
scrollToMap();
if(name != 'Year'){
setYear(thisYear)
}
setActivity(filterAndSortRuns(activities, item, func, sortDateFunc));
setRunIndex(-1);
setTitle(`${item} ${name} Heatmap`);
Expand Down Expand Up @@ -84,9 +87,11 @@ const Index = () => {
scrollToMap();
// type in year, filter year first, then type
if(year != 'Total'){
setYear(year);
setActivity(filterAndSortRuns(activities, year, filterYearRuns, sortDateFunc, type, filterTypeRuns));
}
else {
setYear(thisYear);
setActivity(filterAndSortRuns(activities, type, filterTypeRuns, sortDateFunc));
}
setRunIndex(-1);
Expand Down

0 comments on commit 51853fc

Please sign in to comment.