diff --git a/frontend/src/app.tsx b/frontend/src/app.tsx
index 9b61723..58d0fcf 100644
--- a/frontend/src/app.tsx
+++ b/frontend/src/app.tsx
@@ -1,15 +1,17 @@
import Header from 'src/components/Header'
import Router from 'src/components/Router'
import Welcome from 'src/components/Welcome'
+import Footer from './components/Footer'
export function App() {
return (
-
+
-
+
+
)
}
diff --git a/frontend/src/components/Footer.tsx b/frontend/src/components/Footer.tsx
new file mode 100644
index 0000000..022717c
--- /dev/null
+++ b/frontend/src/components/Footer.tsx
@@ -0,0 +1,33 @@
+import useSWR from 'swr'
+
+import type { FunctionalComponent } from 'preact'
+
+const fetcher = (url: string) => fetch(url).then(r => r.json())
+
+const BuildInfo: FunctionalComponent = () => {
+ const { data, error } = useSWR<{
+ version: string
+ date: string
+ commit: string
+ }>('/api/version', fetcher)
+
+ if (error) return null
+ if (!data) return null
+
+ return
+
{data.version}
+
Build date: {data.date}
+
Commit: {data.commit}
+
+}
+
+const Footer: FunctionalComponent = () => {
+ return
+}
+
+export default Footer
\ No newline at end of file
diff --git a/frontend/src/components/Welcome.tsx b/frontend/src/components/Welcome.tsx
index 58df772..d130fb4 100644
--- a/frontend/src/components/Welcome.tsx
+++ b/frontend/src/components/Welcome.tsx
@@ -10,7 +10,7 @@ const Welcome: FunctionalComponent = () => {
return
Welcome to tiny-todo!
A simple todo app that's: tiny 🐜, lightweight 🔦🏋️♀️, and performant ⚡. Built using Go & Preact!
-
+
}
diff --git a/internal/routes/version.go b/internal/routes/version.go
index fdb7240..2d48b9e 100644
--- a/internal/routes/version.go
+++ b/internal/routes/version.go
@@ -10,6 +10,8 @@ func Version(e *env.Env, r fiber.Router) {
r.Get("/", func(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"version": info.Version,
+ "date": info.Date,
+ "commit": info.Commit,
})
})
}