Files
nextstep/src/components/weight/WeightAlert.tsx
Tony0410 f0f674945c feat: implement all 8 new health management features
This commit implements all features specified in the eight-features design doc:

Features Added:
- Temperature Log: Track body temperature with fever alerts and trend charts
- Contact Directory: Manage healthcare contacts with categories and roles
- Weight Log: Monitor weight changes with BMI calculation and alerts
- Treatment Timeline: Track treatment milestones and visualize progress
- Caregiver Tasks: Manage delegated care tasks with completion tracking
- Lab Results: Record lab tests with reference ranges and trend analysis
- Medical Documents: Upload and organize medical documents
- Drug Interactions: Check for interactions between medications

Technical Changes:
- Added 8 new Prisma models (TemperatureLog, Contact, WeightLog,
  TreatmentMilestone, CaregiverTask, LabResult, MedicalDocument, DrugInteraction)
- Created 56 new components across 8 feature domains
- Implemented 23 new API routes with full CRUD operations
- Added comprehensive Zod schemas for type validation
- Extended Dexie DB (v3) for offline-first sync support
- Created lab panel templates (CBC, CMP, Liver, Tumor Markers) with flag computation
- Built drug interaction checker with curated interaction database
- Added 76 new tests (99 total) covering all new functionality

Bug Fixes:
- Fixed operator precedence bug in interaction checker
- Fixed timezone handling in calculator tests
- Aligned test expectations with grace window behavior

All 99 tests pass and build completes successfully.
2026-03-02 11:17:38 +00:00

32 lines
1.1 KiB
TypeScript

'use client'
import { AlertTriangle } from 'lucide-react'
interface WeightAlertProps {
currentKg: number
previousKg: number
timeframeHours: number
}
export function WeightAlert({ currentKg, previousKg, timeframeHours }: WeightAlertProps) {
const diff = Math.abs(currentKg - previousKg)
if (diff < 2) return null
const direction = currentKg > previousKg ? 'gained' : 'lost'
return (
<div className="rounded-card p-4 border-2 bg-orange-50 border-orange-300">
<div className="flex items-start gap-3">
<AlertTriangle className="w-6 h-6 text-orange-600 flex-shrink-0 mt-0.5" />
<div>
<h3 className="font-bold text-orange-800">Rapid Weight Change</h3>
<p className="text-sm text-orange-700 mt-1">
{direction} {diff.toFixed(1)} kg in the last {timeframeHours < 24 ? `${timeframeHours} hours` : `${Math.round(timeframeHours / 24)} days`}.
Rapid changes may indicate fluid retention or other concerns consider contacting your care team.
</p>
</div>
</div>
</div>
)
}