diff --git a/src/components/Changelog.tsx b/src/components/Changelog.tsx new file mode 100644 index 0000000..6470346 --- /dev/null +++ b/src/components/Changelog.tsx @@ -0,0 +1,57 @@ +import { useEffect, useState } from "react"; +import { ChangelogEntry } from "~/components/ChangelogEntry"; + +export interface LogEntry { + content: string; + data: { + title: string; + date: string; + }; + isEmpty: boolean; + excerpt: string; +} + +export const Changelog = () => { + const [entries, setEntries] = useState([] as LogEntry[]); + const [loaded, setLoaded] = useState(false); + + const getEmployees = () => { + fetch("https://xnl.hri7566.info/api/changelog?n=5", { + next: { + revalidate: 60, + }, + }) + .then((res) => { + res + .json() + .then((j) => { + setEntries((j as any).logs as LogEntry[]); + setLoaded(true); + }) + .catch((err) => console.error(err)); + }) + .catch((err) => console.error(err)); + }; + + useEffect(() => { + getEmployees(); + }, []); + + return ( + <> + {/* */} + {loaded ? ( + entries.map((entry, index) => ( + + )) + ) : ( +

Loading...

+ )} + + ); +}; diff --git a/src/components/ChangelogEntry.tsx b/src/components/ChangelogEntry.tsx new file mode 100644 index 0000000..bcf0211 --- /dev/null +++ b/src/components/ChangelogEntry.tsx @@ -0,0 +1,18 @@ +export const ChangelogEntry = ( + props: { + title: string; + date: string; + content: string; + } = { + title: "Title", + date: "Date", + content: "Content", + } +) => { + return ( +
+

{props.date}

+
{props.content}
+
+ ); +}; diff --git a/src/components/NavigationBar.tsx b/src/components/NavigationBar.tsx index bbb5cf6..04753ed 100644 --- a/src/components/NavigationBar.tsx +++ b/src/components/NavigationBar.tsx @@ -6,6 +6,7 @@ export const NavigationBar = () => { + ); }; diff --git a/src/components/NavigationLink.tsx b/src/components/NavigationLink.tsx index f9e7596..9820916 100644 --- a/src/components/NavigationLink.tsx +++ b/src/components/NavigationLink.tsx @@ -4,7 +4,7 @@ export const NavigationLink = (props: { href: string; text: string }) => { return (

{props.text}

diff --git a/src/pages/changelog.tsx b/src/pages/changelog.tsx new file mode 100644 index 0000000..716be7a --- /dev/null +++ b/src/pages/changelog.tsx @@ -0,0 +1,25 @@ +import { NavigationBar } from "../components/NavigationBar"; +import { PageContentBox } from "~/components/PageContentBox"; +import { CornerLogo } from "~/components/CornerLogo"; +import { Changelog as ChangelogComponent } from "~/components/Changelog"; + +export default function Changelog() { + return ( +
+
+ +
+ +
+
+
+ + + +
+
+
+
+
+ ); +}