initial full commit

This commit is contained in:
2026-05-22 11:58:57 +01:00
parent 4d62b02ad1
commit 2ef55753f7
15 changed files with 416 additions and 1 deletions

40
src/App.tsx Normal file
View File

@@ -0,0 +1,40 @@
import { useEffect, useState } from 'react'
function App() {
const [container, setContainer] = useState<string>('unknown')
const [time, setTime] = useState<Date>(new Date())
useEffect(() => {
fetch('/api/container')
.then((res) => res.json())
.then((data) => setContainer(data.container))
.catch(() => setContainer('localhost'))
const interval = setInterval(() => setTime(new Date()), 1000)
return () => clearInterval(interval)
}, [])
return (
<div className="min-h-screen flex flex-col items-center justify-center bg-zinc-950 text-zinc-100">
<div className="text-center space-y-4">
<h1 className="text-4xl font-bold tracking-tight">Swarm Demo</h1>
<div className="text-xl text-zinc-400">
Container: <span className="text-emerald-400 font-mono">{container}</span>
</div>
<div className="text-2xl font-mono tabular-nums text-zinc-200">
{time.toLocaleString(undefined, {
weekday: 'short',
year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
})}
</div>
</div>
</div>
)
}
export default App

10
src/main.tsx Normal file
View File

@@ -0,0 +1,10 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)

20
src/server.ts Normal file
View File

@@ -0,0 +1,20 @@
import { Hono } from 'hono'
import { serveStatic } from 'hono/bun'
const app = new Hono()
app.get('/api/container', (c) => {
return c.json({ container: process.env.HOSTNAME || 'localhost' })
})
app.use('/*', serveStatic({ root: './dist' }))
app.get('*', serveStatic({ path: './dist/index.html' }))
const port = parseInt(process.env.PORT || '5786', 10)
console.log(`Server running on port ${port}`)
export default {
port,
fetch: app.fetch,
}

3
src/styles.css Normal file
View File

@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;