feat: dashboard rest days widget + today highlighting
- Add RestDaysWidget component showing today's rest days with icons & colors - Integrate widget into Dashboard (above training distribution) - Highlight current day in RestDaysPage (accent border + HEUTE badge) - Fix: Improve error handling in api.js (parse JSON detail field) Part of v9d Phase 2 (Vitals & Recovery)
This commit is contained in:
1 parent
f87b93ce2f
commit
7a0b2097ae
4 files changed
+158
-4
No files matched your search
@@ -12,6 +12,7 @@ import TrialBanner from '../components/TrialBanner'
|
||||
import EmailVerificationBanner from '../components/EmailVerificationBanner'
|
||||
import TrainingTypeDistribution from '../components/TrainingTypeDistribution'
|
||||
import SleepWidget from '../components/SleepWidget'
|
||||
import RestDaysWidget from '../components/RestDaysWidget'
|
||||
import { getInterpretation, getStatusColor, getStatusBg } from '../utils/interpret'
|
||||
import Markdown from '../utils/Markdown'
|
||||
import dayjs from 'dayjs'
|
||||
@@ -477,6 +478,11 @@ export default function Dashboard() {
|
||||
<SleepWidget/>
|
||||
</div>
|
||||
|
||||
{/* Rest Days Widget */}
|
||||
<div style={{marginBottom:16}}>
|
||||
<RestDaysWidget/>
|
||||
</div>
|
||||
|
||||
{/* Training Type Distribution */}
|
||||
{activities.length > 0 && (
|
||||
<div className="card section-gap" style={{marginBottom:16}}>
|
||||
|
||||
@@ -356,9 +356,14 @@ export default function RestDaysPage() {
|
||||
const isEditing = editing?.id === day.id
|
||||
const focus = day.rest_config?.focus || 'mental_rest'
|
||||
const preset = PRESETS.find(p => p.id === focus)
|
||||
const isToday = day.date === dayjs().format('YYYY-MM-DD')
|
||||
|
||||
return (
|
||||
<div key={day.id} className="card" style={{ marginBottom: 8 }}>
|
||||
<div key={day.id} className="card" style={{
|
||||
marginBottom: 8,
|
||||
border: isToday ? '2px solid var(--accent)' : undefined,
|
||||
background: isToday ? 'var(--accent)08' : undefined,
|
||||
}}>
|
||||
{isEditing ? (
|
||||
<div>
|
||||
<div style={{ fontWeight: 600, fontSize: 14, marginBottom: 8 }}>
|
||||
@@ -399,8 +404,22 @@ export default function RestDaysPage() {
|
||||
alignItems: 'center',
|
||||
marginBottom: 8,
|
||||
}}>
|
||||
<div style={{ fontWeight: 600, fontSize: 14 }}>
|
||||
{dayjs(day.date).format('DD. MMMM YYYY')}
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<div style={{ fontWeight: 600, fontSize: 14 }}>
|
||||
{dayjs(day.date).format('DD. MMMM YYYY')}
|
||||
</div>
|
||||
{isToday && (
|
||||
<span style={{
|
||||
padding: '2px 8px',
|
||||
borderRadius: 4,
|
||||
background: 'var(--accent)',
|
||||
color: 'white',
|
||||
fontSize: 11,
|
||||
fontWeight: 600,
|
||||
}}>
|
||||
HEUTE
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 6 }}>
|
||||
<button
|
||||
|
||||
Reference in new issue
Block a user