'use client'; import React from 'react'; import { calculateSDSResults } from '../../test/private/SDSCalculator'; import { useScopedI18n } from '@/locales/client'; interface SDSResultProps { answers: string[]; } export function SDSResult({ answers }: SDSResultProps) { const t = useScopedI18n('components.sdsResult'); // Convert answer format to the format required by calculator const answersMap: { [key: number]: string } = {}; answers.forEach((answer, index) => { answersMap[index + 1] = answer; }); const results = calculateSDSResults({ answers: answersMap, questions: [] }); const severityNames = { normal: t('severity.normal'), mild: t('severity.mild'), moderate: t('severity.moderate'), severe: t('severity.severe') }; const severityDescriptions = { normal: t('severityDescriptions.normal'), mild: t('severityDescriptions.mild'), moderate: t('severityDescriptions.moderate'), severe: t('severityDescriptions.severe') }; const getSeverityColor = (severity: string) => { switch (severity) { case "normal": return "text-green-600 bg-green-50 border-green-200"; case "mild": return "text-yellow-600 bg-yellow-50 border-yellow-200"; case "moderate": return "text-orange-600 bg-orange-50 border-orange-200"; case "severe": return "text-red-600 bg-red-50 border-red-200"; default: return "text-gray-600 bg-gray-50 border-gray-200"; } }; // Get raw score (not multiplied by 1.25) const rawScore = Math.round(results.totalScore / 1.25); return (
{/* Overall score */}

{t('title')}

{/* Severity level description */}

{t('labels.result_interpretation')}

{severityDescriptions[results.severity as keyof typeof severityDescriptions]}

{t('labels.scoring_criteria')}:
  • • {t('scoring.range_0_52')}
  • • {t('scoring.range_53_62')}
  • • {t('scoring.range_63_72')}
  • • {t('scoring.range_73_plus')}
{/* Item analysis */}

{t('labels.detailed_analysis')}

{/* High score items reminder */}

{t('labels.scale_description')}

• {t('scaleInfo.description_1')}

• {t('scaleInfo.description_2')}

• {t('scaleInfo.description_3')}

{/* Scoring method description */}

{t('labels.scoring_method')}

正向计分项目:{t('scaleInfo.positive_items')}

反向计分项目:{t('scaleInfo.reverse_items')}

选项计分:{t('scaleInfo.option_scoring')}

反向计分:{t('scaleInfo.reverse_scoring')}

{(results.severity === "severe" || results.severity === "moderate") && (
{t('labels.important_reminder')}:{t('warnings.depression_reminder')}
)}
{/* Professional advice */}

{t('labels.professional_advice')}

{t('advice.high_score_title')}
  • • {t('advice.seek_professional')}
  • • {t('advice.share_feelings')}
  • • {t('advice.maintain_routine')}
  • • {t('advice.avoid_substances')}
  • • {t('advice.suicide_help')}

{t('labels.note')}:{t('disclaimer')}

); } interface MetricCardProps { title: string; value: React.ReactNode; className?: string; } function MetricCard({ title, value, className = '' }: MetricCardProps) { return (
{title} {value}
); }