Improve the dahboard with the weather info

This commit is contained in:
Urtzi Alfaro
2025-08-18 13:36:37 +02:00
parent 355c0080cc
commit afca94dadd
12 changed files with 747 additions and 302 deletions

View File

@@ -10,6 +10,7 @@ import TodayProduction from '../../components/simple/TodayProduction';
import QuickActions from '../../components/simple/QuickActions';
import QuickOverview from '../../components/simple/QuickOverview';
import OrderSuggestions from '../../components/simple/OrderSuggestions';
import WeatherContext from '../../components/simple/WeatherContext';
interface DashboardPageProps {
onNavigateToOrders?: () => void;
@@ -133,9 +134,12 @@ const DashboardPage: React.FC<DashboardPageProps> = ({
{weather && (
<div className="flex items-center text-sm text-gray-600 bg-gray-50 rounded-lg px-4 py-2">
<span className="text-lg mr-2">
{weather.precipitation > 0 ? '🌧️' : weather.temperature > 20 ? '☀️' : '⛅'}
{weather.precipitation && weather.precipitation > 0 ? '🌧️' : weather.temperature && weather.temperature > 20 ? '☀️' : '⛅'}
</span>
<span>{weather.temperature}°C</span>
<div className="flex flex-col">
<span>{weather.temperature?.toFixed(1) || '--'}°C</span>
<span className="text-xs text-gray-500">AEMET</span>
</div>
</div>
)}
@@ -217,6 +221,9 @@ const DashboardPage: React.FC<DashboardPageProps> = ({
/>
)}
{/* Weather & Context - Comprehensive AEMET Data */}
<WeatherContext />
{/* Production Section - Core Operations */}
<TodayProduction
items={mockProduction}
@@ -234,25 +241,6 @@ const DashboardPage: React.FC<DashboardPageProps> = ({
onNavigateToReports={onNavigateToReports}
/>
{/* Weather Impact Alert - Context Aware */}
{weather && weather.precipitation > 0 && (
<div className="bg-blue-50 border border-blue-200 rounded-xl p-4">
<div className="flex items-start">
<span className="text-2xl mr-3">🌧</span>
<div>
<h4 className="font-medium text-blue-900">Impacto del Clima Detectado</h4>
<p className="text-blue-800 text-sm mt-1">
Se esperan precipitaciones ({weather.precipitation}mm). Las predicciones se han ajustado
automáticamente considerando una reducción del 15% en el tráfico.
</p>
<div className="mt-2 flex items-center text-xs text-blue-700">
<div className="w-2 h-2 bg-blue-500 rounded-full mr-2"></div>
Producción y pedidos ya optimizados
</div>
</div>
</div>
</div>
)}
{/* Success Message - When Everything is Good */}
{realAlerts.length === 0 && (

View File

@@ -0,0 +1,45 @@
import React from 'react';
import { POSManagementPage } from '../../components/pos';
interface POSPageProps {
view?: 'integrations' | 'sync-status' | 'transactions';
}
const POSPage: React.FC<POSPageProps> = ({ view = 'integrations' }) => {
// For now, all views route to the main POS management page
// In the future, you can create separate components for different views
switch (view) {
case 'integrations':
return (
<div className="p-6">
<POSManagementPage />
</div>
);
case 'sync-status':
return (
<div className="p-6">
{/* Future: Create dedicated sync status view */}
<POSManagementPage />
</div>
);
case 'transactions':
return (
<div className="p-6">
{/* Future: Create dedicated transactions view */}
<POSManagementPage />
</div>
);
default:
return (
<div className="p-6">
<POSManagementPage />
</div>
);
}
};
export default POSPage;

View File

@@ -0,0 +1 @@
export { default as POSPage } from './POSPage';