diff --git a/src/components/DashboardStat.svelte b/src/components/DashboardStat.svelte
index 9a963797..ee90fc85 100644
--- a/src/components/DashboardStat.svelte
+++ b/src/components/DashboardStat.svelte
@@ -12,16 +12,15 @@
{title}
- {#if title === 'Number of communities'}
-
- {/if}
{#if loading}
{/if}
{#if stat !== undefined}
- {stat}
+
+ {stat}{title === 'Up-To-Date Percent' ? '%' : ''}
+
{#if percent}
import { browser } from '$app/environment';
import { DashboardStat, Footer, Header, HeaderPlaceholder } from '$lib/comp';
- import {
- areaError,
- areas,
- eventError,
- events,
- reportError,
- reports,
- syncStatus,
- theme
- } from '$lib/store';
+ import { eventError, events, reportError, reports, syncStatus, theme } from '$lib/store';
import type { ChartHistory, EventType, Report } from '$lib/types';
import { detectTheme, errToast, updateChartThemes } from '$lib/utils';
import Chart from 'chart.js/auto';
@@ -20,9 +11,6 @@
// alert for event errors
$: $eventError && errToast($eventError);
- // alert for area errors
- $: $areaError && errToast($areaError);
-
// alert for report errors
$: $reportError && errToast($reportError);
@@ -80,20 +68,6 @@
})
: [];
- $: communities =
- $areas && $areas.length && $reports && $reports.length
- ? $areas.filter(
- (area) =>
- area.tags.type === 'community' &&
- area.tags.geo_json &&
- area.tags.name &&
- area.tags['icon:square'] &&
- area.tags.continent &&
- Object.keys(area.tags).find((key) => key.includes('contact')) &&
- $reports.find((report) => report.area_id === area.id)
- )
- : undefined;
-
const getStatPeriod = () => {
return new Date(new Date().getTime() - 24 * 60 * 60 * 1000).getTime();
};
@@ -140,6 +114,8 @@
$: lightning = stats && stats[0].tags.total_elements_lightning;
$: nfc = stats && stats[0].tags.total_elements_lightning_contactless;
+ $: upToDatePercent = stats && stats[0].tags.up_to_date_percent;
+
$: totalChange =
stats && total
? new Intl.NumberFormat('en-US', { signDisplay: 'always' }).format(
@@ -207,6 +183,13 @@
)
: '';
+ $: upToDatePercentChange =
+ stats && upToDatePercent
+ ? new Intl.NumberFormat('en-US', { signDisplay: 'always' }).format(
+ upToDatePercent - stats[1].tags.up_to_date_percent
+ )
+ : undefined;
+
let upToDateChartCanvas: HTMLCanvasElement;
let upToDateChart: Chart<'line', number[] | undefined, string>;
let totalChartCanvas: HTMLCanvasElement;
@@ -703,8 +686,9 @@
loading={$syncStatus && chartsRendered}
/>