feat: Adds dashboard style links to home page.
Some checks failed
CI / release (push) Has been cancelled

This commit is contained in:
2025-04-08 09:52:54 -04:00
parent 522fac7b01
commit f05b96e0bf
5 changed files with 130 additions and 12 deletions

View File

@@ -48,18 +48,18 @@ private func siteHeader(_ section: Section) -> Node {
}
}
nav(class: "menu flex justify-between") {
div(class: "pt-6") {
ul(class: "flex flex-wrap gap-x-2 lg:gap-x-5") {
li {
a(class: section == .articles ? "active" : "", href: "/articles/") { "Articles" }
}
li {
a(href: "https://uptime.housh.dev/status/housh-dev", rel: "nofollow", target: "_blank") { "Server-Monitor" }
if section != .home {
div(class: "pt-6") {
ul(class: "flex flex-wrap gap-x-2 lg:gap-x-5") {
li {
a(class: section == .articles ? "active" : "", href: "/articles/") { "Articles" }
}
}
}
}
div(class: "font-avenir w-2/3", id: "search") {}
// if section == .home {
div(class: "font-avenir w-full pt-4", id: "search") {}
// }
}
}
}

View File

@@ -0,0 +1,69 @@
import HTML
struct HomeLink {
let icon: String
let title: String
let description: String
let href: String
let linkType: LinkType
enum LinkType {
case `internal`
case external
}
}
extension HomeLink {
static func `internal`(
_ title: String,
icon: String,
href: String,
description: String
) -> Self {
self.init(icon: icon, title: title, description: description, href: href, linkType: .internal)
}
static func external(
_ title: String,
icon: String,
href: String,
description: String
) -> Self {
self.init(icon: icon, title: title, description: description, href: href, linkType: .external)
}
}
extension HomeLink: NodeConvertible {
func asNode() -> Node {
switch linkType {
case .internal: return internalLink()
case .external: return externalLink()
}
}
private func internalLink() -> Node {
a(class: "bg-orange-400 border-2 border-green-600 p-4 rounded-lg", href: href) {
div(class: "flex text-3xl") {
i(class: "mt-1", customAttributes: ["data-lucide": icon])
p(class: "ps-2") { title }
}
p(class: "text-sm") { description }
}
}
private func externalLink() -> Node {
a(
class: "bg-orange-400 border-2 border-green-600 p-4 rounded-lg",
href: href,
rel: "nofollow",
target: "_blank'"
) {
div(class: "flex text-3xl") {
i(class: "mt-1", customAttributes: ["data-lucide": icon])
p(class: "ps-2") { title }
}
p(class: "text-sm") { description }
}
}
}

View File

@@ -30,6 +30,55 @@ func renderHome(body: String) -> Node {
div(class: "my-24 font-avenir leading-[1.25] font-thin text-center [&>h1>strong]:font-bold") {
Node.raw(body)
}
div(class: "grid lg:grid-cols-2 gap-6") {
HomeLink.internal(
"Articles",
icon: "newspaper",
href: "/articles/",
description: "Click here to view articles."
)
HomeLink.external(
"Service Monitor",
icon: "heart-pulse",
href: "https://uptime.housh.dev/status/housh-dev",
description: "Click here to view the service status."
)
HomeLink.external(
"Purchase Orders",
icon: "calculator",
href: "https://po.housh.dev",
description: "Purchase orders application."
)
HomeLink.external(
"Excalidraw",
icon: "pen-tool",
href: "https://draw.housh.dev",
description: "A drawing utility."
)
HomeLink.external(
"Gitea",
icon: "git-branch",
href: "https://git.housh.dev/explore/repos",
description: "Source code."
)
HomeLink.external(
"Unifi Console",
icon: "earth",
href: "https://unifi.ui.com",
description: "Network management."
)
}
script(src: "https://unpkg.com/lucide@latest")
Node.raw("""
<script>
lucide.createIcons();
</script>
""")
}
}

View File

@@ -4,7 +4,7 @@ section: home
# Home
## Internal Documentation Site
## Documentation Site / Dashboard
Click on one of the links up above or search for an article using the search
Click on one of the links below or search for an article using the search
feature.

File diff suppressed because one or more lines are too long