added skill translation. Skills now pull from the actual resource object they are representing
This commit is contained in:
parent
1ab77619ab
commit
53237fc22e
@ -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}) => {
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
const skillsComponents = skills.map((skill, index) => {
|
||||
return <Skill key={index} label={translateEnumSkill(skill)}/>
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="m-2 flex space-y-4 flex-col">
|
||||
<div className='rounded-lg bg-gray-100 drop-shadow border border-neutral-900'>
|
||||
<ul className="divide-y-2">
|
||||
<Skill label="Word Recognition" />
|
||||
<Skill label="Sentences" />
|
||||
<Skill label="Music" />
|
||||
{skillsComponents}
|
||||
</ul>
|
||||
</div>
|
||||
<SkillRanking skillLevels={skillLevels} />
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user