'use client'; import React from 'react'; import { useScopedI18n } from '@/locales/client'; import { calculateGDResults } from '../../test/private/GDCalculator'; function useLabels() { const t = useScopedI18n('components.gdResult'); return { totalScore: t('totalScore'), scorePercentage: t('scorePercentage'), elevatedItems: t('elevatedItems'), genderIdentity: t('genderIdentity'), socialRole: t('socialRole'), physicalDysphoria: t('physicalDysphoria'), genderExpression: t('genderExpression'), overallAssessment: t('overallAssessment'), recommendations: t('recommendations'), importantNotes: t('importantNotes'), understandingResults: t('understandingResults'), factorScores: t('factorScores'), interpretationLevels: { low: t('interpretationLevels.low'), mild: t('interpretationLevels.mild'), moderate: t('interpretationLevels.moderate'), high: t('interpretationLevels.high'), }, factorDescriptions: { genderIdentity: t('factorDescriptions.genderIdentity'), socialRole: t('factorDescriptions.socialRole'), physicalDysphoria: t('factorDescriptions.physicalDysphoria'), genderExpression: t('factorDescriptions.genderExpression'), }, notes: { purpose: t('notes.purpose'), substitute: t('notes.substitute'), complexity: t('notes.complexity'), professional: t('notes.professional'), }, recommendationTexts: { high: t('recommendationTexts.high'), low: t('recommendationTexts.low'), }, }; } export function GDResult({ answers, }: { answers: string[]; }) { const labels = useLabels(); // Convert answers array to object format expected by calculator const answersObj: { [key: number]: string } = {}; answers.forEach((answer, index) => { answersObj[index + 1] = answer; }); const results = calculateGDResults({ answers: answersObj, questions: [] }); const getInterpretationColor = (interpretation: string) => { switch (interpretation) { case 'low': return 'text-green-600'; case 'mild': return 'text-yellow-600'; case 'moderate': return 'text-orange-600'; case 'high': return 'text-red-600'; default: return 'text-gray-600'; } }; const getInterpretationLabel = (interpretation: string) => { return labels.interpretationLevels[interpretation as keyof typeof labels.interpretationLevels] || 'Unknown'; }; return (
Score: {results.totalScore}/189 ({results.scorePercentage}%)
{results.scorePercentage >= 50 ? labels.recommendationTexts.high : labels.recommendationTexts.low}
{labels.factorScores}: