import { useEffect, useState } from 'react'; import { apiClient, errorMessage, RatingBasis } from '../services/api'; import Screen from '../components/Screen'; import Skeleton from '../components/Skeleton'; import './BodyAge.css'; /** * Where every rating in the app comes from. * * A band that paints a number 偏低 is making a claim about the user's health. * This screen is the receipt for that claim — one row per metric, with the * source named, including the ones whose honest source is "general guidance, * no authoritative standard". */ function RatingBasisPage() { const [basis, setBasis] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(''); useEffect(() => { apiClient .getRatingBasis() .then(setBasis) .catch((err) => setError(errorMessage(err, '加载失败'))) .finally(() => setLoading(false)); }, []); if (loading) return ; if (error || !basis) { return (
{error || '加载失败'}
); } return (

{basis.note}

各指标参考区间

{basis.bands.map((b) => (
{b.metric}
{b.bands}
来源:{b.source}
))}

{basis.fitnessAge.title}

{basis.fitnessAge.summary}

{basis.fitnessAge.steps.map((s) => (
{s.name}
{s.detail}
来源:{s.source}
))}

{basis.fitnessAge.caveat}

); } export default RatingBasisPage;