diff --git a/src/lib/components/DataTable.svelte b/src/lib/components/DataTable.svelte new file mode 100644 index 00000000..a92eedf1 --- /dev/null +++ b/src/lib/components/DataTable.svelte @@ -0,0 +1,111 @@ + + +
+
+
+ +
+

{$_('Sensor Data - Today')}

+
+ + +
+ {#if filteredData.length === 0} +
+

{$_('No data available for today')}

+
+ {:else} + + + + {#each visibleColumns as column} + + {/each} + + + + + {#each filteredData as row, rowIndex} + + {#each visibleColumns as column} + + {/each} + + {/each} + +
+ {$_(column)} +
+ {formatCellValue(column, row[column])} +
+ {/if} +
+
+
+
diff --git a/src/lib/i18n/locales/en.ts b/src/lib/i18n/locales/en.ts index 27c1cc26..82d3a3c3 100644 --- a/src/lib/i18n/locales/en.ts +++ b/src/lib/i18n/locales/en.ts @@ -1,4 +1,5 @@ export const strings = { + 'Sensor Data - Today': 'Sensor Data - Today', soil_moisture: 'Volumetric Water Content', moisture: 'Volumetric Water Content', Moisture: 'Volumetric Water Content', diff --git a/src/lib/i18n/locales/ja.ts b/src/lib/i18n/locales/ja.ts index 99eda771..86766738 100644 --- a/src/lib/i18n/locales/ja.ts +++ b/src/lib/i18n/locales/ja.ts @@ -1,4 +1,5 @@ export const strings = { + 'Sensor Data - Today': 'センサーデータ - 本日', soil_moisture: '土壌水分量', moisture: '土壌水分量', Moisture: '土壌水分量', diff --git a/src/lib/utilities/stats.ts b/src/lib/utilities/stats.ts index a95b4c5d..3e81f039 100644 --- a/src/lib/utilities/stats.ts +++ b/src/lib/utilities/stats.ts @@ -93,9 +93,9 @@ export const getTextColorByKey = (key: string, isMetadata: boolean = false): str }; /** - * Default options for number formatting. This sets the maximum number of fraction digits to 1. + * Default options for number formatting. This sets the maximum number of fraction digits to 2. */ -const defaultNumberFormatOptions: Intl.NumberFormatOptions = { maximumFractionDigits: 1 }; +const defaultNumberFormatOptions: Intl.NumberFormatOptions = { maximumFractionDigits: 2 }; /** * Custom format options for various statistics keys. diff --git a/src/routes/app/dashboard/location/[location_id]/devices/[devEui]/+page.svelte b/src/routes/app/dashboard/location/[location_id]/devices/[devEui]/+page.svelte index 4b5135bd..3e3aa5cf 100644 --- a/src/routes/app/dashboard/location/[location_id]/devices/[devEui]/+page.svelte +++ b/src/routes/app/dashboard/location/[location_id]/devices/[devEui]/+page.svelte @@ -410,6 +410,7 @@ // Cleanup on destroy import { onDestroy } from 'svelte'; import BatteryLevel from '$lib/components/BatteryLevel.svelte'; + import DataTable from '$lib/components/DataTable.svelte'; onDestroy(() => { teardownRealtime(); if (staleCheckIntervalId) clearInterval(staleCheckIntervalId); @@ -599,8 +600,12 @@
-

{$_('Weather & Data')}

- + {#if device.cw_device_type?.data_table_v2 === 'cw_air_data'} + + {:else} +

{$_('Weather & Data')}

+ + {/if}