Files
medreport_mrb2b/app/home/[account]/_components/team-account-health-details.tsx
Danel Kungla 2b79a9e401 Refactor team account statistics and health details
- Simplified the TeamAccountStatistics component by removing unused code and integrating translation for health details.
- Updated the load-team-account-health-details to calculate average BMI based on member parameters.
- Adjusted the billing page to correctly reference the number of team members.
- Enhanced the main account page to pass member parameters to the Dashboard component.
- Modified the admin account page to destructure member data from the API response.
- Updated the TeamAccountsApi to return member parameters alongside member data.
- Added new translations for health details in Estonian locale.
2025-08-18 16:50:26 +03:00

44 lines
1.4 KiB
TypeScript

import React from 'react';
import { Card } from '@kit/ui/card';
import { Trans } from '@kit/ui/trans';
import { cn } from '@kit/ui/utils';
import {
NormStatus,
getAccountHealthDetailsFields,
} from '../_lib/server/load-team-account-health-details';
import { TeamAccountStatisticsProps } from './team-account-statistics';
const TeamAccountHealthDetails = ({
memberParams,
}: {
memberParams: TeamAccountStatisticsProps['memberParams'];
}) => {
const accountHealthDetailsFields =
getAccountHealthDetailsFields(memberParams);
return (
<div className="grid flex-1 grid-cols-2 gap-4 md:grid-cols-3">
{accountHealthDetailsFields.map(({ title, Icon, value, normStatus }) => (
<Card className="relative p-4" key={title}>
<div
className={cn('absolute top-2 right-2 rounded-2xl p-2', {
'bg-success': normStatus === NormStatus.NORMAL,
'bg-warning': normStatus === NormStatus.WARNING,
'bg-destructive': normStatus === NormStatus.CRITICAL,
})}
>
<Icon color="white" className="stroke-2" />
</div>
<h5 className="mt-8 leading-none">
<Trans i18nKey={title} />
</h5>
<span className="text-muted-foreground text-xs">{value}</span>
</Card>
))}
</div>
);
};
export default TeamAccountHealthDetails;