'use client'; import Link from 'next/link'; import { InfoTooltip } from '@/components/ui/info-tooltip'; import { BlendingModeIcon, RulerHorizontalIcon } from '@radix-ui/react-icons'; import { Activity, ChevronRight, Clock9, Droplets, LineChart, Pill, Scale, TrendingUp, User, } from 'lucide-react'; import Isikukood from 'isikukood'; import { Button } from '@kit/ui/button'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardProps, } from '@kit/ui/card'; import { Trans } from '@kit/ui/trans'; import { cn } from '@kit/ui/utils'; import type { AccountWithParams } from '@/packages/features/accounts/src/server/api'; const cards = ({ gender, age, height, weight, }: { gender?: string; age?: number; height?: number | null; weight?: number | null; }) => [ { title: 'dashboard:gender', description: gender ?? 'dashboard:male', icon: , iconBg: 'bg-success', }, { title: 'dashboard:age', description: age ? `${age}` : '-', icon: , iconBg: 'bg-success', }, { title: 'dashboard:height', description: height ? `${height}cm` : '-', icon: , iconBg: 'bg-success', }, { title: 'dashboard:weight', description: weight ? `${weight}kg` : '-', icon: , iconBg: 'bg-warning', }, { title: 'dashboard:bmi', description: '27.5', icon: , iconBg: 'bg-warning', }, { title: 'dashboard:bloodPressure', description: '160/98', icon: , iconBg: 'bg-warning', }, { title: 'dashboard:cholesterol', description: '5', icon: , iconBg: 'bg-destructive', }, { title: 'dashboard:ldlCholesterol', description: '3,6', icon: , iconBg: 'bg-warning', }, { title: 'Score 2', description: 'Normis', icon: , iconBg: 'bg-success', }, { title: 'dashboard:smoking', description: 'dashboard:respondToQuestion', descriptionColor: 'text-primary', icon: ( ), cardVariant: 'gradient-success' as CardProps['variant'], }, ]; const dummyRecommendations = [ { icon: , color: 'bg-cyan/10 text-cyan', title: 'Kolesterooli kontroll', description: 'HDL-kolestrool', tooltipContent: 'Selgitus', price: '20,00 €', buttonText: 'Telli', href: '/home/booking', }, { icon: , color: 'bg-primary/10 text-primary', title: 'Kolesterooli kontroll', tooltipContent: 'Selgitus', description: 'LDL-Kolesterool', buttonText: 'Broneeri', href: '/home/booking', }, { icon: , color: 'bg-destructive/10 text-destructive', title: 'Vererõhu kontroll', tooltipContent: 'Selgitus', description: 'Score-Risk 2', price: '20,00 €', buttonText: 'Telli', href: '/home/booking', }, ]; const getPersonParameters = (personalCode: string) => { try { const person = new Isikukood(personalCode); return { gender: person.getGender(), age: person.getAge(), }; } catch (error) { console.error(error); return null; } }; export default function Dashboard({ account }: { account: AccountWithParams }) { const params = getPersonParameters(account.personal_code!); return ( <>
{cards({ gender: params?.gender, age: params?.age, height: account.account_params?.height, weight: account.account_params?.weight, }).map( ({ title, description, icon, iconBg, cardVariant, descriptionColor, }) => (
{icon}
), )}

{dummyRecommendations.map( ( { icon, color, title, description, tooltipContent, price, buttonText, href, }, index, ) => { return (
{icon}
{title}

{description}

{price}

{href ? ( ) : ( )}
); }, )}
); }