fix build bugs
Some checks failed
Deploy MyApp on Same Server / build-and-deploy (push) Failing after 1s
Some checks failed
Deploy MyApp on Same Server / build-and-deploy (push) Failing after 1s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"use client"
|
||||
import { useEffect, useMemo, useState, useCallback } from 'react'
|
||||
import { useEffect, useMemo, useState, useCallback, Suspense } from 'react'
|
||||
import { useRouter, useSearchParams } from 'next/navigation'
|
||||
import { api, TelemetryDto, DailyReportDto } from '@/lib/api'
|
||||
import { persianToGregorian, getCurrentPersianDay, getCurrentPersianYear, getCurrentPersianMonth, getPreviousPersianDay, getNextPersianDay } from '@/lib/persian-date'
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
DataGap
|
||||
} from '@/components/daily-report'
|
||||
|
||||
export default function DailyReportPage() {
|
||||
function DailyReportContent() {
|
||||
const router = useRouter()
|
||||
const searchParams = useSearchParams()
|
||||
const [telemetry, setTelemetry] = useState<TelemetryDto[]>([])
|
||||
@@ -269,23 +269,23 @@ export default function DailyReportPage() {
|
||||
const gas = useMemo(() => sortedTelemetry.map(t => Number(t.gasPPM ?? 0)), [sortedTelemetry])
|
||||
const lux = useMemo(() => sortedTelemetry.map(t => Number(t.lux ?? 0)), [sortedTelemetry])
|
||||
|
||||
// Min/Max calculations
|
||||
const tempMinMax = useMemo(() => {
|
||||
const min = Math.min(...temp)
|
||||
const max = Math.max(...temp)
|
||||
return {
|
||||
min: min < 0 ? Math.floor(min / 10) * 10 : 0,
|
||||
max: max > 40 ? Math.floor(max / 10) * 10 : 40
|
||||
}
|
||||
}, [temp])
|
||||
// Min/Max calculations (not currently used but kept for potential future use)
|
||||
// const tempMinMax = useMemo(() => {
|
||||
// const min = Math.min(...temp)
|
||||
// const max = Math.max(...temp)
|
||||
// return {
|
||||
// min: min < 0 ? Math.floor(min / 10) * 10 : 0,
|
||||
// max: max > 40 ? Math.floor(max / 10) * 10 : 40
|
||||
// }
|
||||
// }, [temp])
|
||||
|
||||
const luxMinMax = useMemo(() => {
|
||||
const max = Math.max(...lux)
|
||||
return {
|
||||
min: 0,
|
||||
max: max > 2000 ? Math.floor(max / 1000) * 1000 : 2000
|
||||
}
|
||||
}, [lux])
|
||||
// const luxMinMax = useMemo(() => {
|
||||
// const max = Math.max(...lux)
|
||||
// return {
|
||||
// min: 0,
|
||||
// max: max > 2000 ? Math.floor(max / 1000) * 1000 : 2000
|
||||
// }
|
||||
// }, [lux])
|
||||
|
||||
// Detect data gaps in the full day data
|
||||
const dataGaps = useMemo(() => {
|
||||
@@ -591,3 +591,18 @@ export default function DailyReportPage() {
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function DailyReportPage() {
|
||||
return (
|
||||
<Suspense fallback={
|
||||
<div className="min-h-screen flex items-center justify-center p-4">
|
||||
<div className="text-center">
|
||||
<div className="w-16 h-16 border-4 border-indigo-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"></div>
|
||||
<p className="text-gray-600">در حال بارگذاری گزارش...</p>
|
||||
</div>
|
||||
</div>
|
||||
}>
|
||||
<DailyReportContent />
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user