From 80ba2387133bc0dbcee43c58c410023bee2d6f7e Mon Sep 17 00:00:00 2001 From: Mohammad Sajad Pourajam Date: Sat, 18 Apr 2026 01:23:37 +0330 Subject: [PATCH] UPDATE --- .../(private)/pest-detection/page.tsx | 8 ------ .../(dashboard)/(private)/pest-risk/page.tsx | 6 ++--- .../(private)/plant-simulator/page.tsx | 7 ------ .../(private)/yield-harvest/page.tsx | 6 ++--- src/components/card-statistics/Vertical.tsx | 6 ++--- .../layout/vertical/VerticalMenu.tsx | 8 ------ src/data/navigation/horizontalMenuData.tsx | 10 -------- src/data/navigation/verticalMenuData.tsx | 5 ---- .../dashboards/farm/FarmOverviewKPIs.tsx | 15 ++++++++--- .../dashboards/farm/HarvestPredictionCard.tsx | 12 ++++----- .../dashboards/farm/PestManagementPage.tsx | 24 ++++++++++++++++++ .../dashboards/farm/PestRiskPageWrapper.tsx | 25 ++++++++++++++----- .../dashboards/farm/PlantProductionPage.tsx | 22 ++++++++++++++++ .../farm/YieldHarvestPageWrapper.tsx | 6 ++--- .../dashboards/farm/YieldPredictionChart.tsx | 6 ++--- .../farm/pestDetection/PlantPestDetection.tsx | 2 +- 16 files changed, 98 insertions(+), 70 deletions(-) delete mode 100644 src/app/(dashboard)/(private)/pest-detection/page.tsx delete mode 100644 src/app/(dashboard)/(private)/plant-simulator/page.tsx create mode 100644 src/views/dashboards/farm/PestManagementPage.tsx create mode 100644 src/views/dashboards/farm/PlantProductionPage.tsx diff --git a/src/app/(dashboard)/(private)/pest-detection/page.tsx b/src/app/(dashboard)/(private)/pest-detection/page.tsx deleted file mode 100644 index 18fe776..0000000 --- a/src/app/(dashboard)/(private)/pest-detection/page.tsx +++ /dev/null @@ -1,8 +0,0 @@ -// Components Imports -import PlantPestDetection from '@views/dashboards/farm/pestDetection/PlantPestDetection' - -const PestDetectionPage = async () => { - return -} - -export default PestDetectionPage diff --git a/src/app/(dashboard)/(private)/pest-risk/page.tsx b/src/app/(dashboard)/(private)/pest-risk/page.tsx index 61db928..ffe9a0f 100644 --- a/src/app/(dashboard)/(private)/pest-risk/page.tsx +++ b/src/app/(dashboard)/(private)/pest-risk/page.tsx @@ -1,7 +1,7 @@ -import PestRiskPageWrapper from '@views/dashboards/farm/PestRiskPageWrapper' +import PestManagementPage from '@views/dashboards/farm/PestManagementPage' -const PestRiskPage = async () => { - return +const PestRiskPage = () => { + return } export default PestRiskPage diff --git a/src/app/(dashboard)/(private)/plant-simulator/page.tsx b/src/app/(dashboard)/(private)/plant-simulator/page.tsx deleted file mode 100644 index bae4823..0000000 --- a/src/app/(dashboard)/(private)/plant-simulator/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import PlantSimulator from '@views/dashboards/farm/plantSimulator/PlantSimulator' - -const PlantSimulatorPage = () => { - return -} - -export default PlantSimulatorPage diff --git a/src/app/(dashboard)/(private)/yield-harvest/page.tsx b/src/app/(dashboard)/(private)/yield-harvest/page.tsx index 5aac408..1461ffe 100644 --- a/src/app/(dashboard)/(private)/yield-harvest/page.tsx +++ b/src/app/(dashboard)/(private)/yield-harvest/page.tsx @@ -1,7 +1,7 @@ -import YieldHarvestPageWrapper from '@views/dashboards/farm/YieldHarvestPageWrapper' +import PlantProductionPage from '@views/dashboards/farm/PlantProductionPage' -const YieldHarvestPage = async () => { - return +const YieldHarvestPage = () => { + return } export default YieldHarvestPage diff --git a/src/components/card-statistics/Vertical.tsx b/src/components/card-statistics/Vertical.tsx index 4daa13c..3cfd292 100644 --- a/src/components/card-statistics/Vertical.tsx +++ b/src/components/card-statistics/Vertical.tsx @@ -19,8 +19,8 @@ const CardStatsVertical = (props: CardStatsVerticalProps) => { props return ( - - + + @@ -29,7 +29,7 @@ const CardStatsVertical = (props: CardStatsVerticalProps) => { {subtitle} {stats} - + ) diff --git a/src/components/layout/vertical/VerticalMenu.tsx b/src/components/layout/vertical/VerticalMenu.tsx index 3762ec5..7566237 100644 --- a/src/components/layout/vertical/VerticalMenu.tsx +++ b/src/components/layout/vertical/VerticalMenu.tsx @@ -128,11 +128,6 @@ const VerticalMenu = ({ scrollMenu }: Props) => { - - }> - {t('plantSimulator')} - - }> {t('irrigationRecommendation')} @@ -145,9 +140,6 @@ const VerticalMenu = ({ scrollMenu }: Props) => { }> {t('farmAiAssistant')} - }> - {t('pestDetection')} - diff --git a/src/data/navigation/horizontalMenuData.tsx b/src/data/navigation/horizontalMenuData.tsx index 5c28d9c..d5e73f7 100644 --- a/src/data/navigation/horizontalMenuData.tsx +++ b/src/data/navigation/horizontalMenuData.tsx @@ -65,11 +65,6 @@ const horizontalMenuData = (): HorizontalMenuDataType[] => [ icon: 'tabler-chart-line', href: '/yield-harvest' }, - { - label: 'plantSimulator', - icon: 'tabler-seeding', - href: '/plant-simulator' - }, { label: 'farmAlerts', icon: 'tabler-alert-triangle', @@ -126,11 +121,6 @@ const horizontalMenuData = (): HorizontalMenuDataType[] => [ icon: 'tabler-chart-line', href: '/yield-harvest' }, - { - label: 'plantSimulator', - icon: 'tabler-seeding', - href: '/plant-simulator' - }, { label: 'farmAlerts', icon: 'tabler-alert-triangle', diff --git a/src/data/navigation/verticalMenuData.tsx b/src/data/navigation/verticalMenuData.tsx index 1ba196b..40110cd 100644 --- a/src/data/navigation/verticalMenuData.tsx +++ b/src/data/navigation/verticalMenuData.tsx @@ -69,11 +69,6 @@ const verticalMenuData = (): VerticalMenuDataType[] => [ icon: 'tabler-chart-line', href: '/yield-harvest' }, - { - label: 'plantSimulator', - icon: 'tabler-seeding', - href: '/plant-simulator' - }, { label: 'farmAlerts', icon: 'tabler-alert-triangle', diff --git a/src/views/dashboards/farm/FarmOverviewKPIs.tsx b/src/views/dashboards/farm/FarmOverviewKPIs.tsx index 2a16c21..542251e 100644 --- a/src/views/dashboards/farm/FarmOverviewKPIs.tsx +++ b/src/views/dashboards/farm/FarmOverviewKPIs.tsx @@ -25,12 +25,21 @@ const FarmOverviewKPIs = ({ data }: FarmOverviewKPIsProps) => { const kpis = (data?.kpis as KpiItem[] | undefined) ?? [] if (kpis.length === 0) return null - + const getGridSize = (count) => { + if (count === 1) return { xs: 12 }; + if (count === 2) return { xs: 12, md: 6 }; + if (count === 3) return { xs: 12, sm: 6, md: 4 }; + if (count === 4) return { xs: 12, sm: 6, md: 3 }; + return { xs: 12, sm: 6, md: 4, lg: 2 }; + }; return ( <> {kpis.map((kpi) => ( - - { const description = (data?.description as string) ?? '' return ( - + @@ -37,18 +37,16 @@ const HarvestPredictionCard = ({ data }: HarvestPredictionCardProps) => { subheader={t('subheaders.aiEstimatedDate')} action={} /> - +
{harvestDate} {daysLeftFormatted && ( )}
- {description && ( - - {description} - - )} + + {description} +
) diff --git a/src/views/dashboards/farm/PestManagementPage.tsx b/src/views/dashboards/farm/PestManagementPage.tsx new file mode 100644 index 0000000..b1be6a7 --- /dev/null +++ b/src/views/dashboards/farm/PestManagementPage.tsx @@ -0,0 +1,24 @@ + 'use client' + + import Grid from '@mui/material/Grid2' + + import PestRiskPageWrapper from '@views/dashboards/farm/PestRiskPageWrapper' + import PlantPestDetection from '@views/dashboards/farm/pestDetection/PlantPestDetection' + + const PestManagementPage = () => { + return ( + + + + + + + + + + ) + } + + export default PestManagementPage diff --git a/src/views/dashboards/farm/PestRiskPageWrapper.tsx b/src/views/dashboards/farm/PestRiskPageWrapper.tsx index 3d41210..f2c1f71 100644 --- a/src/views/dashboards/farm/PestRiskPageWrapper.tsx +++ b/src/views/dashboards/farm/PestRiskPageWrapper.tsx @@ -6,12 +6,20 @@ import { useFarmHub } from '@/hooks/useFarmHub' import Grid from '@mui/material/Grid2' import Box from '@mui/material/Box' import CircularProgress from '@mui/material/CircularProgress' +import Typography from '@mui/material/Typography' import FarmOverviewKPIs from '@views/dashboards/farm/FarmOverviewKPIs' import { pestDetectionDomainService } from '@/libs/api/services/pestDetectionDomainService' import type { PestRiskSummary } from '@/libs/api/services/pestDetectionDomainService' +const sectionSx = { + display: 'flex', + flexDirection: 'column', + gap: 3, + minHeight: '100%' +} + const PestRiskPageWrapper = () => { const { farmHub } = useFarmHub() const farmUuid = farmHub?.farm_uuid @@ -42,16 +50,21 @@ const PestRiskPageWrapper = () => { } return ( - - + + {data.disease_risk && ( - - } /> + + + } /> + )} + {data.pest_risk && ( - - } /> + + + } /> + )} diff --git a/src/views/dashboards/farm/PlantProductionPage.tsx b/src/views/dashboards/farm/PlantProductionPage.tsx new file mode 100644 index 0000000..e43b85b --- /dev/null +++ b/src/views/dashboards/farm/PlantProductionPage.tsx @@ -0,0 +1,22 @@ +'use client' + +import Grid from '@mui/material/Grid2' + +import YieldHarvestPageWrapper from '@views/dashboards/farm/YieldHarvestPageWrapper' +import PlantSimulator from '@views/dashboards/farm/plantSimulator/PlantSimulator' + +const PlantProductionPage = () => { + return ( + + + + + + + + + + ) +} + +export default PlantProductionPage diff --git a/src/views/dashboards/farm/YieldHarvestPageWrapper.tsx b/src/views/dashboards/farm/YieldHarvestPageWrapper.tsx index 2ba74cb..2440cb0 100644 --- a/src/views/dashboards/farm/YieldHarvestPageWrapper.tsx +++ b/src/views/dashboards/farm/YieldHarvestPageWrapper.tsx @@ -51,10 +51,10 @@ const YieldHarvestPageWrapper = () => { } return ( - - + + {data.yield_prediction && ( - + } /> )} diff --git a/src/views/dashboards/farm/YieldPredictionChart.tsx b/src/views/dashboards/farm/YieldPredictionChart.tsx index 71be045..54c0bce 100644 --- a/src/views/dashboards/farm/YieldPredictionChart.tsx +++ b/src/views/dashboards/farm/YieldPredictionChart.tsx @@ -90,16 +90,16 @@ const YieldPredictionChart = ({ data }: YieldPredictionChartProps) => { } return ( - + } /> - + {summary.length > 0 && ( -
+
{summary.map((item, index) => (
diff --git a/src/views/dashboards/farm/pestDetection/PlantPestDetection.tsx b/src/views/dashboards/farm/pestDetection/PlantPestDetection.tsx index 2e204fb..48c6e41 100644 --- a/src/views/dashboards/farm/pestDetection/PlantPestDetection.tsx +++ b/src/views/dashboards/farm/pestDetection/PlantPestDetection.tsx @@ -75,7 +75,7 @@ export default function PlantPestDetection() { return ( {/* Header */}