File tree Expand file tree Collapse file tree 6 files changed +441
-421
lines changed
Expand file tree Collapse file tree 6 files changed +441
-421
lines changed Original file line number Diff line number Diff line change 1- import * as z from "zod/mini" ;
2-
3- import { Project , ProjectSchema } from "../types" ;
1+ import { Project , ProjectSchema , gracefulParse } from "../types" ;
42import projectJSON from "../content/text/projects.json" ;
53
64const ProjectComponent = ( { projectData } : { projectData : Project } ) => {
@@ -28,7 +26,7 @@ const ProjectComponent = ({ projectData }: { projectData: Project }) => {
2826} ;
2927
3028export const Projects = ( ) => {
31- const projects : Project [ ] = z . array ( ProjectSchema ) . parse ( projectJSON ) ;
29+ const projects : Project [ ] = gracefulParse ( ProjectSchema , projectJSON ) ;
3230
3331 return (
3432 < div className = "projects-grid" >
Original file line number Diff line number Diff line change 1- import * as z from "zod/mini" ;
2-
3- import { Publication , PublicationSchema } from "../types" ;
1+ import { Publication , PublicationSchema , gracefulParse } from "../types" ;
42
53// this imports the json from `content` such that we can use it as a variable
64import publicationsJSON from "../content/text/publications.json" ;
@@ -45,7 +43,7 @@ const PublicationComponent = ({ publicationData }: { publicationData: Publicatio
4543// a simple unorderd list of publications which links to the paper with minor styling
4644export const Publications = ( ) => {
4745 // zod is library for parsing json data according to schema (think type / class in other languages). We parse data
48- const publications : Publication [ ] = z . array ( PublicationSchema ) . parse ( publicationsJSON ) ;
46+ const publications : Publication [ ] = gracefulParse ( PublicationSchema , publicationsJSON ) ;
4947
5048 // 'map' takes each element in array and applies function to it, in our case this function returns a <li> element with publication component inside
5149 return (
Original file line number Diff line number Diff line change 1- import * as z from "zod/mini" ;
21import { useState } from "react" ;
32
4- import { Person , PersonSchema } from "../types" ;
3+ import { Person , PersonSchema , gracefulParse } from "../types" ;
54
65import teamJSON from "../content/text/team.json" ;
76
@@ -63,7 +62,7 @@ const PersonComponent = ({ personData }: { personData: Person }) => {
6362} ;
6463
6564export const Team = ( ) => {
66- const people : Person [ ] = z . array ( PersonSchema ) . parse ( teamJSON ) ;
65+ const people : Person [ ] = gracefulParse ( PersonSchema , teamJSON ) ;
6766
6867 // filter takes an array & returns new array with elements that match the boolean expression
6968 // in the first section, this is filtering for current members
Original file line number Diff line number Diff line change 1- import * as z from "zod/mini" ;
2-
3- import { Video , VideoSchema } from "../types" ;
1+ import { Video , VideoSchema , gracefulParse } from "../types" ;
42
53import videoJSON from "../content/text/videos.json" ;
64
@@ -16,7 +14,7 @@ const VideoComponent = ({ videoData }: { videoData: Video }) => {
1614} ;
1715
1816export const Videos = ( ) => {
19- const videos : Video [ ] = z . array ( VideoSchema ) . parse ( videoJSON ) ;
17+ const videos : Video [ ] = gracefulParse ( VideoSchema , videoJSON ) ;
2018 return (
2119 < div className = "projects-grid" >
2220 { videos . map ( ( v , i ) => (
You can’t perform that action at this time.
0 commit comments