Skip to content

Commit 4c2d982

Browse files
author
Bouwmeester, Kevin
committed
updated knowledgehub/ECS (tested)
1 parent 7f7092d commit 4c2d982

46 files changed

Lines changed: 6371 additions & 4371 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/knowledge-hub/ECS/page.tsx

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,23 @@ import Image from 'next/image';
44
import Navbar from '../../components/Navbar';
55
import Footer from '../../components/Footer';
66

7-
import { useEffect, useMemo, useRef } from 'react';
7+
import { useEffect, useMemo, useRef, useState } from 'react';
88

99
import { KevinContact } from '@/app/person-constants';
1010

1111
import ECSImage from '../../../public/knowledge-hub/ECS/ECS.jpg';
1212

1313
export default function Home() {
14-
const iframeRef = useRef<HTMLIFrameElement | null>(null);
15-
// Auto-resize iframe height after it loads (same-origin, so allowed)
16-
1714
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
18-
19-
const SRC = `${basePath}/knowledge-hub/ECS/paper.html`;
15+
const SRC = `${basePath}/knowledge-hub/ECS/ECSPattern - old.html`;
16+
const [htmlContent, setHtmlContent] = useState<string>("");
2017

2118
useEffect(() => {
22-
const ifr = iframeRef.current;
23-
if (!ifr) return;
24-
25-
const handleLoad = () => {
26-
try {
27-
const doc = ifr.contentDocument || ifr.contentWindow?.document;
28-
if (!doc) return;
29-
// compute height using scrollHeight of the page
30-
const height = Math.max(
31-
doc.documentElement?.scrollHeight || 0,
32-
doc.body?.scrollHeight || 0
33-
);
34-
ifr.style.height = `${height}px`;
35-
} catch (e) {
36-
// If cross-origin (shouldn't be for /public), skip
37-
console.warn('Could not auto-resize iframe:', e);
38-
}
39-
};
40-
41-
ifr.addEventListener('load', handleLoad);
42-
return () => ifr.removeEventListener('load', handleLoad);
43-
}, []);
44-
19+
fetch(SRC)
20+
.then((res) => res.text())
21+
.then((data) => setHtmlContent(data))
22+
.catch((err) => console.error("Error loading HTML:", err));
23+
}, [])
4524

4625
return (
4726
<div>
@@ -61,19 +40,12 @@ export default function Home() {
6140
/>
6241
<a href="https://doi.org/10.1016/j.simpat.2020.102243">
6342
Vico: An entity-component-system based co-simulation framework
64-
</a>
65-
66-
<iframe
67-
ref={iframeRef}
68-
src={SRC}
69-
title="Paper"
70-
style={{
71-
width: '100%',
72-
height: '80vh', // initial height; will auto-resize
73-
border: 'none',
74-
background: 'transparent',
75-
}}
76-
/>
43+
</a>
44+
45+
<div>
46+
{/* Inject HTML */}
47+
<div dangerouslySetInnerHTML={{ __html: htmlContent }} />
48+
</div>
7749

7850
{/* Contact Section */}
7951
<div className="border-t mt-4 pt-4">

0 commit comments

Comments
 (0)