import React, { useState } from 'react'; import { IonContent, IonPage, IonIcon, IonText, useIonViewWillEnter, } from '@ionic/react'; import { useHistory } from 'react-router-dom'; import { heartCircleOutline, medkitOutline, restaurantOutline, moonOutline, chevronForwardOutline, } from 'ionicons/icons'; import WellbeingScoreCard from '../components/health/WellbeingScoreCard'; import MetricMiniCard from '../components/health/MetricMiniCard'; import RecentActivityList from '../components/health/RecentActivityList'; import { getWellbeingSummary, getRecentActivity, } from '../services/localHealthStore'; import { WellbeingSummary, ActivityEntry } from '../types/health'; const Home: React.FC = () => { const history = useHistory(); const [summary, setSummary] = useState( getWellbeingSummary() ); const [recentEntries, setRecentEntries] = useState(getRecentActivity()); const refreshData = () => { setSummary(getWellbeingSummary()); setRecentEntries(getRecentActivity()); }; useIonViewWillEnter(() => { refreshData(); }); return ( {/* Top Content Row */}
Wellbeing
Good morning
Local
{/* Score Widget */} {/* Metric Row */}
{/* Action Strip */}
{[ { label: 'Checkup', icon: medkitOutline, path: '/checkups' }, { label: 'Diet', icon: restaurantOutline, path: '/diet' }, { label: 'Sleep', icon: moonOutline, path: '/sleep' }, ].map((action) => (
history.push(action.path)} style={{ flexShrink: 0, background: '#ffffff', borderRadius: '999px', padding: '10px 18px', display: 'flex', alignItems: 'center', gap: '8px', minHeight: '44px', cursor: 'pointer', }} > {action.label}
))}
{/* Section Header */}
Recent Activity
history.push('/insights')} style={{ display: 'flex', alignItems: 'center', gap: '2px', cursor: 'pointer', }} > See insights
{/* Recent Activity List */} history.push('/checkups')} onSeeInsights={() => history.push('/insights')} />
); }; export default Home;