Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/scifi-clean. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// StatusBarBlockMeta defines metadata for the persistent status-bar rail.
|
|
var StatusBarBlockMeta = blocks.BlockMeta{
|
|
Key: "status_bar",
|
|
Title: "Status Bar",
|
|
Description: "Persistent top rail with optional UTC clock, build hash, and callsign.",
|
|
Source: "scifi-clean",
|
|
Category: blocks.CategoryNavigation,
|
|
}
|
|
|
|
// StatusBarData drives the templ render.
|
|
type StatusBarData struct {
|
|
ShowClock bool
|
|
ShowBuild bool
|
|
Callsign string
|
|
}
|
|
|
|
// StatusBarBlock renders the persistent top rail.
|
|
// Content shape: {"showClock": true, "showBuild": true, "callsign": "SCF-CLN"}
|
|
func StatusBarBlock(ctx context.Context, content map[string]any) string {
|
|
data := StatusBarData{
|
|
ShowClock: getBool(content, "showClock", true),
|
|
ShowBuild: getBool(content, "showBuild", true),
|
|
Callsign: getStringDefault(content, "callsign", "SCF-CLN"),
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = statusBarComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|