import data from './data' ; import { ChildrenType } from '@/utils/globalTypes' ; type TechnoTypes = { react : { doc : ChildrenType ; name : string ; } ; next : { doc : ChildrenType ; name : string ; } ; vue : { doc : ChildrenType ; name : string ; } ; nuxt : { doc : ChildrenType ; name : string ; } ; } ; interface IProps { id : number ; name : string ; slug : string ; image : StaticImageData ; techno : any ; demo : string ; } function parseData ( data ) { return JSON . parse ( JSON . stringify ( data ) ) ; } function getDashboardsByTechnologie ( name ) { const dashboards = data . map ( ( data ) => ( { id : data . id , name : data . name , slug : data . slug , image : data . image , demo : data . demo , techno : data . techno [ name ] , } ) ) ; return dashboards ; } function getDashboardByTechnologie ( name , slug ) { const dashboards = data . filter ( ( dash ) => dash . slug === slug ) ; return { name : dashboards [ 0 ] ?. name , slug : dashboards [ 0 ] ?. slug , image : dashboards [ 0 ] ?. image , demo : dashboards [ 0 ] ?. demo , techno : dashboards [ 0 ] ?. techno [ name ] , } ; } async function getDashboard ( slug ) { const dashboards = data . filter ( ( dash ) => dash . slug === slug ) ; const dashboard = dashboards [ 0 ] ; return parseData ( dashboard ) ; } function getTechno ( slug ) { const dashboards = data . filter ( ( dash ) => dash . slug === slug ) ; return dashboards [ 0 ] ?. techno ; } function isTechno ( name ) { switch ( name ) { case 'react' : return 'React' ; case 'next' : return 'Next.js' ; case 'vue' : return 'Vue' ; case 'nuxt' : return 'Nuxt.js' ; default : return null ; } } export { isTechno , getTechno , parseData , getDashboard , getDashboardByTechnologie , getDashboardsByTechnologie , } ;