diff --git a/database.types.ts b/database.types.ts index 75e21336..333ca958 100644 --- a/database.types.ts +++ b/database.types.ts @@ -579,6 +579,7 @@ export type Database = { Row: { ai_provider: string | null; battery_changed_at: string | null; + battery_level: number | null; dev_eui: string; installed_at: string | null; lat: number | null; @@ -595,6 +596,7 @@ export type Database = { Insert: { ai_provider?: string | null; battery_changed_at?: string | null; + battery_level?: number | null; dev_eui: string; installed_at?: string | null; lat?: number | null; @@ -611,6 +613,7 @@ export type Database = { Update: { ai_provider?: string | null; battery_changed_at?: string | null; + battery_level?: number | null; dev_eui?: string; installed_at?: string | null; lat?: number | null; @@ -1057,6 +1060,7 @@ export type Database = { created_at: string; dev_eui: string; id: number; + line_number: number | null; people_count: number; traffic_hour: string | null; truck_count: number; @@ -1068,6 +1072,7 @@ export type Database = { created_at?: string; dev_eui: string; id?: number; + line_number?: number | null; people_count?: number; traffic_hour?: string | null; truck_count?: number; @@ -1079,6 +1084,7 @@ export type Database = { created_at?: string; dev_eui?: string; id?: number; + line_number?: number | null; people_count?: number; traffic_hour?: string | null; truck_count?: number; diff --git a/src/lib/components/BatteryLevel.svelte b/src/lib/components/BatteryLevel.svelte new file mode 100644 index 00000000..3aba1de1 --- /dev/null +++ b/src/lib/components/BatteryLevel.svelte @@ -0,0 +1,64 @@ + + + +
+ + + + + {value}% + + +
+

Battery Level

+

+ The current battery level of the device is at {value}%. +

+
+
+
+
+
diff --git a/src/lib/components/StatsCard/StatsCard.svelte b/src/lib/components/StatsCard/StatsCard.svelte index 1319ba38..280ea77a 100644 --- a/src/lib/components/StatsCard/StatsCard.svelte +++ b/src/lib/components/StatsCard/StatsCard.svelte @@ -11,9 +11,10 @@ key: string; stats?: DeviceStats; expandable?: boolean; + class: string; }; - let { key, stats = {}, expandable = true }: Props = $props(); + let { key, stats = {}, expandable = true, class: className }: Props = $props(); let { min, max, avg, median, stdDev, count, lastReading, trend } = $derived(stats[key]); let title = $derived($_(key)); let notation = $derived(nameToNotation(key)); @@ -51,7 +52,7 @@
-import { enhance } from '$app/forms'; -import { success } from '$lib/stores/toast.svelte.js'; -import { formValidation } from '$lib/actions/formValidation'; + import { enhance } from '$app/forms'; + import { success } from '$lib/stores/toast.svelte.js'; + import { formValidation } from '$lib/actions/formValidation'; let { data } = $props(); let form = $derived(data.form); @@ -27,7 +27,7 @@ import { formValidation } from '$lib/actions/formValidation'; return () => { loading = true; - // Client-side validation + // クライアント側バリデーション if (!validatePasswords()) { loading = false; return; @@ -38,11 +38,11 @@ import { formValidation } from '$lib/actions/formValidation'; await update(); if (result.type === 'success') { - // Clear the form fields on success + // 成功時にフォームをクリア currentPassword = ''; newPassword = ''; confirmPassword = ''; - success('Password updated successfully.'); + success('パスワードが正常に更新されました。'); } }; }; @@ -50,31 +50,26 @@ import { formValidation } from '$lib/actions/formValidation'; - Update Password | CropWatch + パスワードを更新 | CropWatch
-

Update Password

+

パスワードを更新

{#if form?.success}
-

Your password has been successfully updated.

+

パスワードが正常に更新されました。

{/if} -
+
- + validatePasswords()} class="text-text-light dark:text-text-dark focus:ring-primary w-full rounded-md border border-gray-300 @@ -92,14 +87,14 @@ import { formValidation } from '$lib/actions/formValidation'; /> {#if !isStrongPassword && newPassword.length > 0}

- Password must be at least 8 characters long + パスワードは8文字以上である必要があります

{/if}
新しいパスワード(確認用) validatePasswords()} class="text-text-light dark:text-text-dark focus:ring-primary w-full rounded-md border border-gray-300 @@ -116,7 +111,7 @@ import { formValidation } from '$lib/actions/formValidation'; focus:ring-2 focus:outline-none dark:border-gray-700 dark:bg-gray-800" /> {#if !passwordsMatch && confirmPassword.length > 0} -

Passwords don't match

+

パスワードが一致しません

{/if}
@@ -131,13 +126,10 @@ import { formValidation } from '$lib/actions/formValidation';
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 831bc694..4b5135bd 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 @@ -96,14 +96,14 @@ let renderingVisualization = $state(false); // Local rendering state for visualization // Derived properties - const { - deviceTypeName, - temperatureChartVisible, - humidityChartVisible, - moistureChartVisible, - co2ChartVisible, - phChartVisible - } = $derived(getDeviceDetailDerived(device, dataType, latestData)); + // const { + // deviceTypeName, + // temperatureChartVisible, + // humidityChartVisible, + // moistureChartVisible, + // co2ChartVisible, + // phChartVisible + // } = $derived(getDeviceDetailDerived(device, dataType, latestData)); let channel: RealtimeChannel | undefined = $state(undefined); // Channel for realtime updates // Track last realtime update timestamp for stale detection let lastRealtimeUpdate = $state(Date.now()); @@ -409,6 +409,7 @@ // Cleanup on destroy import { onDestroy } from 'svelte'; + import BatteryLevel from '$lib/components/BatteryLevel.svelte'; onDestroy(() => { teardownRealtime(); if (staleCheckIntervalId) clearInterval(staleCheckIntervalId); @@ -422,6 +423,10 @@
+ {#if device.battery_level !== null} + + {/if} +