import { type PlatformLink, type PaymentType, type AuditoryResource, type Skill, type SkillLevel } from '@prisma/client';
import { CurrencyDollarIcon, ArrowPathRoundedSquareIcon } from '@heroicons/react/24/solid';
import { ClipboardDocumentListIcon } from '@heroicons/react/24/outline';
import Image from 'next/image';
import Link from 'next/link';
import { translateEnumPlatform } from '~/utils/enumWordLut';
const ResourceEntry = ({resource}: {resource: AuditoryResource}) => {
const ResourceInfo = ({resource}: {resource: AuditoryResource}) => {
const PriceIcons = ({type}: {type: PaymentType}) => {
return (
)
}
const PlatformInfo = ({platformLinks}: {platformLinks: PlatformLink[]}) => {
const platformsStr = platformLinks.map((platformLink) => {
return translateEnumPlatform(platformLink.platform);
}).join(', ');
return (
{platformsStr}
)
}
return (
{resource.manufacturer}
{resource.name}
)
}
const ResourceDescription = ({description}: {description: string}) => {
return (
)
}
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}
)
}
return (
)
}
return (
|
|
|
)
}
const PagesNavigation = ({currentPage, pageCount}: {currentPage: number, pageCount: number}) => {
const PageButton = ({number}: {number: number}) => {
return (
{number}
)
}
const pages = Array.from(Array(pageCount).keys()).map((pageNumber) => {
return (
)
});
return (
)
}
const ResourceTable = ({resources, currentPage}: {resources?: AuditoryResource[], currentPage: number}) => {
const resourcesPerPage = 10;
const totalPages = Math.ceil((resources?.length ?? 0) / resourcesPerPage);
const pageResources = resources?.slice(resourcesPerPage*(currentPage-1), (resourcesPerPage*currentPage)) ?? [];
const resourceElements = pageResources?.map((resource, index) => {
return ();
}) ?? [];
return(
Resource
|
Skills
|
Description
|
{resourceElements}
);
};
export default ResourceTable;