aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAutumn <git@autumnfo.rest>2026-05-11 20:56:57 +0100
committerAutumn <git@autumnfo.rest>2026-05-11 20:56:57 +0100
commitca556370259f100b3f21dd10344741fcf4d48597 (patch)
tree9b38f199e6e8c246367b1e54ac386db7b7e2c85c /src
parent377441a9a8ea65009661569177f5266704818207 (diff)
[pages] added basic devices route
Diffstat (limited to 'src')
-rw-r--r--src/routes/dashboard.ts8
-rw-r--r--src/views/components/dashboard/sidebar.pug9
-rw-r--r--src/views/components/head.pug2
-rw-r--r--src/views/pages/dashboard/devices.pug27
-rw-r--r--src/views/pages/dashboard/home.pug8
5 files changed, 53 insertions, 1 deletions
diff --git a/src/routes/dashboard.ts b/src/routes/dashboard.ts
index b617c4f..ee49a12 100644
--- a/src/routes/dashboard.ts
+++ b/src/routes/dashboard.ts
@@ -4,6 +4,7 @@
// imports
import { Router } from "express"
+import allDevices from "@lib/config/devices.ts"
// setup router
const router = Router()
@@ -13,5 +14,12 @@ router.get("/", (_, res) => {
res.render("pages/dashboard/home")
})
+// all devices
+router.get("/devices", (_, res) => {
+ res.render("pages/dashboard/devices", {
+ devices: allDevices
+ })
+})
+
// export router
export default router
diff --git a/src/views/components/dashboard/sidebar.pug b/src/views/components/dashboard/sidebar.pug
new file mode 100644
index 0000000..6107002
--- /dev/null
+++ b/src/views/components/dashboard/sidebar.pug
@@ -0,0 +1,9 @@
+aside
+
+ ul
+
+ li
+ a(href="/") Home
+
+ li
+ a(href="/devices") Devices
diff --git a/src/views/components/head.pug b/src/views/components/head.pug
new file mode 100644
index 0000000..d28b9d5
--- /dev/null
+++ b/src/views/components/head.pug
@@ -0,0 +1,2 @@
+meta(charset="utf-8")
+meta(name="viewport" content="width=device-width,initial-scale=1.0")
diff --git a/src/views/pages/dashboard/devices.pug b/src/views/pages/dashboard/devices.pug
new file mode 100644
index 0000000..1175136
--- /dev/null
+++ b/src/views/pages/dashboard/devices.pug
@@ -0,0 +1,27 @@
+doctype html
+
+html
+
+ head
+
+ include ../../components/head.pug
+
+ title Devices | Home Control
+
+ body
+
+ include ../../components/dashboard/sidebar.pug
+
+ main
+
+ h1 Devices
+
+ if !devices || devices.length < 1
+
+ p No devices :(
+
+ else
+
+ each device in devices
+
+ p= JSON.stringify(device)
diff --git a/src/views/pages/dashboard/home.pug b/src/views/pages/dashboard/home.pug
index 1faf2df..c5267bf 100644
--- a/src/views/pages/dashboard/home.pug
+++ b/src/views/pages/dashboard/home.pug
@@ -4,8 +4,14 @@ html
head
+ include ../../components/head.pug
+
title Dashboard | Home Control
body
- p Home Control
+ include ../../components/dashboard/sidebar.pug
+
+ main
+
+ h1 Home Control