// the deskbar: what belongs to the site rather than a page. hydrant elsewhere in its leaf
// menu, and a tray with the theme switch and the version these docs describe.
import fs from "node:fs";
import path from "node:path";
import { THEMES } from "./themes";
export interface Link {
label: string;
hint: string;
href: string;
icon: string;
}
export const LINKS: Link[] = [
{ label: "source", hint: "tangled.org", href: "https://tangled.org/ptr.pet/hydrant", icon: "sheets" },
{ label: "statusphere example", hint: "as a library", href: "https://tangled.org/ptr.pet/hydrant/blob/main/examples/statusphere.rs", icon: "doc" },
{ label: "random.wisp.place", hint: "on its http api", href: "https://tangled.org/did:plc:dfl62fgb7wtjj3fcbb72naae/random.wisp.place", icon: "globe" },
{ label: "@ptr.pet", hint: "bluesky", href: "https://bsky.app/profile/ptr.pet", icon: "card" },
];
export const DESKBAR_ICONS = ["globe", "info", ...LINKS.map((l) => l.icon), ...THEMES.map((t) => t.icon)];
/** the crate's version, from the Cargo.toml next to site/ */
export function version(): string {
const toml = fs.readFileSync(path.join(process.cwd(), "../Cargo.toml"), "utf8");
const v = /^\[package\][^[]*?^version\s*=\s*"([^"]+)"/m.exec(toml)?.[1];
if (!v) throw new Error("the docs couldn't find hydrant's version in Cargo.toml's [package]");
return v;
}