feat: Enhance Dashboard layout with responsive greeting and metrics display
This commit is contained in:
1 parent
7e8422cbd7
commit
c2b2c71ccd
3 files changed
+90
-13
No files matched your search
@@ -148,11 +148,10 @@ function StatCard({ icon, label, value, unit, delta, deltaGoodWhenNeg=false, sub
|
||||
const deltaColor = delta==null ? null
|
||||
: (deltaGoodWhenNeg ? delta<0 : delta>0) ? 'var(--accent)' : 'var(--warn)'
|
||||
return (
|
||||
<div onClick={onClick} style={{
|
||||
flex:1, minWidth:80, background:'var(--surface)', borderRadius:12,
|
||||
padding:'12px 10px', cursor:onClick?'pointer':'default',
|
||||
border:'1px solid var(--border)', transition:'border-color 0.15s',
|
||||
}}
|
||||
<div
|
||||
className="dashboard-stat-card"
|
||||
onClick={onClick}
|
||||
style={{ cursor: onClick ? 'pointer' : 'default' }}
|
||||
onMouseEnter={e=>onClick&&(e.currentTarget.style.borderColor='var(--accent)')}
|
||||
onMouseLeave={e=>onClick&&(e.currentTarget.style.borderColor='var(--border)')}>
|
||||
<div style={{fontSize:18,marginBottom:4}}>{icon}</div>
|
||||
@@ -321,13 +320,13 @@ export default function Dashboard() {
|
||||
console.log('[Dashboard] hasAnyData=', hasAnyData, 'latestW=', !!latestW, 'latestCal=', !!latestCal, 'nutrition.length=', nutrition.length)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="dashboard-page">
|
||||
{/* Header greeting */}
|
||||
<div style={{marginBottom:16}}>
|
||||
<div className="dashboard-greeting">
|
||||
<h1 style={{fontSize:22,fontWeight:800,margin:0,color:'var(--text1)'}}>
|
||||
Hallo, {activeProfile?.name||'Nutzer'} 👋
|
||||
</h1>
|
||||
<div style={{fontSize:12,color:'var(--text3)',marginTop:2}}>
|
||||
<div className="dashboard-greeting__meta" style={{fontSize:12,color:'var(--text3)',marginTop:2}}>
|
||||
{dayjs().format('dddd, DD. MMMM YYYY')}
|
||||
{latestW && ` · Letztes Update ${dayjs(latestW.date).format('DD.MM.')}`}
|
||||
</div>
|
||||
@@ -362,8 +361,8 @@ export default function Dashboard() {
|
||||
<QuickWeight onSaved={load}/>
|
||||
</div>
|
||||
|
||||
{/* Key metrics */}
|
||||
<div style={{display:'flex',gap:8,marginBottom:16,flexWrap:'wrap'}}>
|
||||
{/* Key metrics — Mobile: flex-wrap; Desktop: 4-spaltig (RESPONSIVE_UI P3) */}
|
||||
<div className="dashboard-stat-grid">
|
||||
<StatCard icon="⚖️" label="Gewicht" value={latestW?.weight??'–'} unit="kg"
|
||||
delta={wDelta} deltaGoodWhenNeg={true}
|
||||
sub={latestW ? dayjs(latestW.date).format('DD.MM.') : '–'}
|
||||
@@ -451,7 +450,7 @@ export default function Dashboard() {
|
||||
)}
|
||||
|
||||
{/* Activity + Nutrition summary row */}
|
||||
<div style={{display:'flex',gap:8,marginBottom:16}}>
|
||||
<div className="dashboard-summary-row">
|
||||
{(avgKcal||avgProtein) && (
|
||||
<div className="card" style={{flex:1,cursor:'pointer'}} onClick={()=>nav('/history',{state:{tab:'nutrition'}})}>
|
||||
<div style={{fontWeight:600,fontSize:12,marginBottom:8,color:'var(--text3)'}}>🍽️ ERNÄHRUNG (Ø 7T)</div>
|
||||
|
||||
Reference in new issue
Block a user