HRV balanced dots, dashed gap lines, dashboard widgets + drag-to-edit layout
- Green dots for balanced HRV (joining orange unbalanced / red low) on the trend - Trend charts bridge data gaps with a dashed line instead of a blank break - Dashboard: drop Health today; add VO2 max, small sleep, and HRV status widgets - Dashboard: editable widget grid (react-grid-layout) with drag/resize, saved per-user Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -35,11 +35,16 @@ class ProfileOut(BaseModel):
|
||||
goal_weight_kg: Optional[float]
|
||||
estimated_max_hr: Optional[int]
|
||||
is_admin: bool
|
||||
dashboard_layout: Optional[list] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class DashboardLayoutIn(BaseModel):
|
||||
layout: Optional[list] = None # react-grid-layout array of {i,x,y,w,h}
|
||||
|
||||
|
||||
def _estimated_max_hr(user: User) -> Optional[int]:
|
||||
if user.birth_year:
|
||||
return 220 - (datetime.now().year - user.birth_year)
|
||||
@@ -53,6 +58,18 @@ async def get_profile(current_user: User = Depends(get_current_user)):
|
||||
"estimated_max_hr": _estimated_max_hr(current_user)}
|
||||
|
||||
|
||||
@router.put("/dashboard-layout")
|
||||
async def save_dashboard_layout(
|
||||
body: DashboardLayoutIn,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Persist the user's customised dashboard widget layout."""
|
||||
current_user.dashboard_layout = body.layout
|
||||
await db.commit()
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@router.patch("/", response_model=ProfileOut)
|
||||
async def update_profile(
|
||||
body: ProfileUpdate,
|
||||
|
||||
Reference in New Issue
Block a user