ui

package
v1.53.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

tasks/ui — embedded SPA bundle

Compiled assets only. There is no source in this directory.

Where the source lives

~/work/hanzo/gui/code/admin-tasks/ — Vite + @hanzo/gui app in the @hanzo/gui workspace. Build it from there:

cd ~/work/hanzo/gui/code/admin-tasks
bun install
bun run build

That produces admin-tasks/dist/ with index.html and hashed assets/*.{js,css}.

How the bundle gets here

scripts/sync-admin-ui.sh (top of this repo) rsyncs admin-tasks/dist/ into ui/dist/ and writes dist/.sync-stamp for provenance. Run it after every admin-tasks build before invoking go build:

scripts/sync-admin-ui.sh
go build -trimpath -ldflags="-s -w" -o tasksd ./cmd/tasksd

Override the source location with ADMIN_TASKS_DIR=/abs/path if the gui repo is checked out elsewhere.

How tasksd serves it

embed.go declares //go:embed all:dist. The tasksd binary carries the SPA — no sidecar container, no static volume, no nginx. The HTTP router mounts the SPA at /_/tasks/ (see pkg/tasks/server_http.go). API routes (/v1/*) take precedence; anything else falls through to index.html so the SPA router handles deep links.

Hashed assets under /_/tasks/assets/ are served with Cache-Control: public, max-age=31536000, immutable. The shell (index.html) is always no-cache.

Documentation

Overview

Package ui exposes the built admin-tasks (@hanzo/gui) bundle as an embedded filesystem.

The bundle is produced externally in the @hanzo/gui workspace at ~/work/hanzo/gui/code/admin-tasks (Vite + @hanzo/gui) and synced into ui/dist by scripts/sync-admin-ui.sh. The synced dist/ is baked into the tasksd binary at compile time — no external static-assets directory, no sidecar, no separate deploy. See ui/README.md.

Mount the returned handler at /_/tasks/ in the tasksd HTTP router so it serves the SPA shell for every non-API request:

import tasksui "github.com/hanzoai/tasks/ui"
router.PathPrefix("/_/tasks/").Handler(http.StripPrefix("/_/tasks", tasksui.Handler()))

API routes under /v1/* take precedence via earlier route registration; anything else falls through to the SPA, which uses client-side routing so deep links survive reload.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FS

func FS() fs.FS

FS returns the embedded built-UI filesystem rooted at dist/. Empty when scripts/sync-admin-ui.sh has not been run (dev workflow: run the Vite dev server inside ~/work/hanzo/gui/code/admin-tasks).

func Handler

func Handler() http.Handler

Handler returns an http.Handler that serves the embedded SPA.

Behaviour:

  • Exact-match static assets (JS/CSS/images) ship with immutable cache hints because Vite hashes filenames.
  • Anything else rewrites to /index.html so the React router handles the route client-side. This is the standard SPA fallback and is the only way react-router's BrowserRouter survives a page reload on a deep link.
  • If the build hasn't run and index.html is missing, every request returns 503 so operators notice in staging before shipping a blank image to production.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL