diff --git a/data/at_resources.csv b/data/at_resources.csv index ab4fadb..2ba2c64 100644 --- a/data/at_resources.csv +++ b/data/at_resources.csv @@ -1,5 +1,5 @@ Name,Icon,Platforms,Ages,Skills,Skill Level,Manufacturer,Payment Type,Download Link,Description -Word Success,/resource_logos/word_success.png,APP_IOS;APP_ANDROID,10-100,WORDS;SENTENCES;MUSIC,BEGINNER;INTERMEDIATE,"Advanced Bionics, LLC",SUBSCRIPTION_WEEKLY,,"App with four different exercises that range from selecting the spoken word alone, in a senter (either in first, medial, or last position), and with or without background noise." +Word Success,/resource_logos/word_success.png,APP_IOS;APP_ANDROID,10-100,WORDS;SENTENCES;MUSIC,BEGINNER;INTERMEDIATE,Advanced Bionics LLC,SUBSCRIPTION_WEEKLY,,App with four different exercises that range from selecting the spoken word alone, in a senter (either in first, medial, or last position), and with or without background noise." AB Listening Adventures,,APP_IOS,0-10,WORDS;SENTENCES;DISCOURSE,BEGINNER;INTERMEDIATE,n/a,FREE,,N/A Adult CI Home-Based AT,,PDF,10-100,PHONEMES;WORDS,BEGINNER;INTERMEDIATE;ADVANCED,n/a,FREE,,N/A Amptify,,WEBSITE,10-100,PHONEMES;WORDS,BEGINNER;INTERMEDIATE;ADVANCED,n/a,SUBSCRIPTION_WEEKLY,,testing diff --git a/src/components/ResourceTable.tsx b/src/components/ResourceTable.tsx index aa1b349..2382e73 100644 --- a/src/components/ResourceTable.tsx +++ b/src/components/ResourceTable.tsx @@ -1,108 +1,133 @@ -import { type PaymentType } from '@prisma/client'; +import { type Platform, type PaymentType, type AuditoryResource, type Skill, type SkillLevel } from '@prisma/client'; import { CurrencyDollarIcon, ArrowPathRoundedSquareIcon } from '@heroicons/react/24/solid'; -import { ClipboardDocumentListIcon, ChevronDownIcon } from '@heroicons/react/24/outline'; +import { ClipboardDocumentListIcon } from '@heroicons/react/24/outline'; import Image from 'next/image'; import Link from 'next/link'; +import { translateEnumPlatform } from '~/utils/enumWordLut'; -const ResourceInfo = () => { - const PriceIcons = ({type}: {type: PaymentType}) => { - +const ResourceEntry = ({resource}: {resource: AuditoryResource}) => { + const ResourceInfo = ({resource}: {resource: AuditoryResource}) => { + const PriceIcons = ({type}: {type: PaymentType}) => { + + return ( +
+ + +
+ ) + } + + const PlatformInfo = ({platforms}: {platforms: Platform[]}) => { + const platformsStr = platforms.map((platform) => { + return translateEnumPlatform(platform); + }).join(', '); + + return ( +

{platformsStr}

+ ) + } + return ( -
- - +
+
+ +
+ Word Success logo + + more info + +
+ +
+
+
+

{resource.manufacturer}

+

{resource.name}

+ + +
+
) } - return ( -
-
- -
- Word Success logo - - more info - + const ResourceDescription = ({description}: {description: string}) => { + return ( +
+

{description}

+
+ ) + } + + const ResourceSkills = ({skills, skillLevels}: {skills: Skill[], skillLevels: SkillLevel[]}) => { + const SkillRanking = ({skillLevels}: {skillLevels: SkillLevel[]}) => { + return ( +
+ {skillLevels.includes('BEGINNER') ? +
+

Beginner

+
: undefined + } + {skillLevels.includes('INTERMEDIATE') ? +
+

Intermediate

+
: undefined + } + {skillLevels.includes('ADVANCED') ? +
+

Advanced

+
: undefined + } +
+ ) + } + + const Skill = ({label}: {label:string}) => { + return ( +
  • + +
    +

    {label}

    - -
  • -
    -
    -

    Advanced Bionics, LLC

    -

    Word Success

    -

    Apple and Android

    - -
    -
    -
    - ) -} - -const ResourceDescription = () => { - return ( -
    -

    App with four different exercises that range from selecting the spoken word alone, in a senter (either in first, medial, or last position), and with or without background noise.

    -
    - ) -} - -const ResourceSkills = () => { - const SkillRanking = () => { + + ) + } + return ( -
    -
    -

    Beginner

    -
    -
    -

    Intermediate

    +
    +
    +
      + + + +
    +
    ) } - const Skill = ({label}: {label:string}) => { - return ( -
  • - -
    -

    {label}

    -
    -
  • - ) - } - return ( -
    -
    -
      - - - -
    -
    - -
    + + + + + + + + + + + ) } -const ResourceTable = () => { - const ResourceEntry = () => { - return ( - - - - - - - - - - - - ) - } +const ResourceTable = ({resources}: {resources?: AuditoryResource[]}) => { + + const resourceElements = resources?.map((resource, index) => { + return (); + }) ?? []; return(
    @@ -128,7 +153,7 @@ const ResourceTable = () => { - + {resourceElements}
    diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 4efb5ce..2d1e798 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -5,8 +5,7 @@ import { api } from "~/utils/api"; const Home: NextPage = () => { - //const query = api.auditoryResource.getAll.useQuery(); - //console.log(query.data); + const query = api.auditoryResource.getAll.useQuery(); return ( <> @@ -17,7 +16,7 @@ const Home: NextPage = () => {
    - +
    diff --git a/src/utils/enumWordLut.ts b/src/utils/enumWordLut.ts new file mode 100644 index 0000000..29cb8b9 --- /dev/null +++ b/src/utils/enumWordLut.ts @@ -0,0 +1,21 @@ +import { type Platform } from "@prisma/client"; + +/** + * Takes a platform enum and translates it to readable form. + */ +export const translateEnumPlatform = (value: Platform) => { + switch(value) { + case "APP_ANDROID": { + return "Android"; + } + case "APP_IOS": { + return "Apple"; + } + case "PDF": { + return "PDF Document"; + } + case "WEBSITE": { + return "Website" + } + } +} \ No newline at end of file