From 53237fc22ed15902e20a2c20872bd8af1a5e5ea6 Mon Sep 17 00:00:00 2001 From: Brandon Egger Date: Thu, 16 Mar 2023 22:02:34 -0500 Subject: [PATCH] added skill translation. Skills now pull from the actual resource object they are representing --- src/components/ResourceTable.tsx | 10 ++++++---- src/utils/enumWordLut.ts | 32 +++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/components/ResourceTable.tsx b/src/components/ResourceTable.tsx index 1e1b4ff..6ed4650 100644 --- a/src/components/ResourceTable.tsx +++ b/src/components/ResourceTable.tsx @@ -3,7 +3,7 @@ import { CurrencyDollarIcon, ArrowPathRoundedSquareIcon } from '@heroicons/react import { ClipboardDocumentListIcon } from '@heroicons/react/24/outline'; import Image from 'next/image'; import Link from 'next/link'; -import { translateEnumPlatform } from '~/utils/enumWordLut'; +import { translateEnumPlatform, translateEnumSkill } from '~/utils/enumWordLut'; import { type ChangeEvent, type Dispatch, type SetStateAction, useState } from 'react'; import { ChevronDownIcon } from '@heroicons/react/24/outline'; @@ -95,14 +95,16 @@ const ResourceEntry = ({resource}: {resource: AuditoryResource}) => { ) } + + const skillsComponents = skills.map((skill, index) => { + return + }); return (
    - - - + {skillsComponents}
diff --git a/src/utils/enumWordLut.ts b/src/utils/enumWordLut.ts index 29cb8b9..9a9ce43 100644 --- a/src/utils/enumWordLut.ts +++ b/src/utils/enumWordLut.ts @@ -1,4 +1,4 @@ -import { type Platform } from "@prisma/client"; +import { Skill, type Platform } from "@prisma/client"; /** * Takes a platform enum and translates it to readable form. @@ -18,4 +18,34 @@ export const translateEnumPlatform = (value: Platform) => { return "Website" } } +} + +/** + * Takes a skill enum value and translates it to human text + * @param value + */ +export const translateEnumSkill = (value: Skill) => { + switch(value) { + case "ENVIRONMENT": { + return "not done"; + } + case "BACKGROUND": { + return "not done"; + } + case "DISCOURSE": { + return "not done"; + } + case "MUSIC": { + return "Music" + } + case "PHONEMES": { + return "not done"; + } + case "SENTENCES": { + return "Sentences" + } + case "WORDS": { + return "Word Recognition" + } + } } \ No newline at end of file