diff --git a/components/ProjectModal.tsx b/components/ProjectModal.tsx index f8ca0c5..bc58a81 100644 --- a/components/ProjectModal.tsx +++ b/components/ProjectModal.tsx @@ -19,16 +19,26 @@ const ProjectModal: NextPage = ({ project, visible, setVisible }) => const projectNotFoundHtml = `
Sorry! There is no data for this project. Please check back later to see if that changed!
`; const projectServerErrorHtml = `
Sorry! A server error happend when the project data was fetched!
`; + const generateFooter = (project: string, lastUpdate: string) => `
+ + `; + useEffect(() => { if (project && project !== "") { // TODO // set Spinner + setProjectData("Loading..."); fetch(`/api/projects/${project}`).then((res) => { if (res.status === 404) setProjectData(projectNotFoundHtml); if (res.status !== 200) setProjectData(projectServerErrorHtml); res.text().then(data => { try { - setProjectData(ad.convert(data).toString()); + const adDoc = ad.load(data, {attributes: {showtitle: true}}); + setProjectData(adDoc.convert(adDoc).toString() + generateFooter(project, adDoc.getAttribute("docdatetime"))); } catch { setProjectData(projectServerErrorHtml); } @@ -54,7 +64,7 @@ const ProjectModal: NextPage = ({ project, visible, setVisible }) => if (!visible) return <>; return
-
+
; };