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 ¶
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 ¶
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.