Skip to content

Commit

Permalink
OKRF23-87 Set default date to the last date we have data for.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrotsko committed Jan 10, 2024
1 parent 8255f7a commit 12ae3b5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/blocks/OldDateIndicatorWarning.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script>
import { formatDateYearDayOfWeekAbbr } from '../formats';
/**
* @type {import('../stores/params').SensorParam}
*/
export let sensor;
/**
* @type {import("../stores/params").DateParam}
*/
export let date;
const currDate = new Date();
function datesEqual(date) {
return date.value == currDate;
}
</script>

{#if !datesEqual(date)}
<div data-uk-alert class="uk-alert-warning">
The indicator "{sensor.name}" is not available for {formatDateYearDayOfWeekAbbr(currDate)}, yet. The latest known
data is available on {formatDateYearDayOfWeekAbbr(date.value)}.
</div>
{/if}
6 changes: 6 additions & 0 deletions src/blocks/RegionMapWrapper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import RegionHexMap from './RegionHexMap.svelte';
import RegionMap from './RegionMap.svelte';
import Toggle from '../components/Toggle.svelte';
import OldDateIndicatorWarning from './OldDateIndicatorWarning.svelte';
/**
* @type {import("../../stores/params").DateParam}
Expand All @@ -26,8 +27,13 @@
$: hasCounties = sensor.value.levels.includes('county');
let showChoropleth = false;
$: if (sensor.timeFrame.max < date.value) {
date.set(sensor.timeFrame.max);
}
</script>

<OldDateIndicatorWarning {sensor} {date} />
{#if region.level === 'nation'}
<p class="uk-text-center uk-text-italic ux-hint">
<span class="inline-svg-icon">
Expand Down

0 comments on commit 12ae3b5

Please sign in to comment.