ui

package
v1.36.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ui exposes the built Vite bundle as an embedded filesystem.

The bundle is produced by `pnpm --prefix ui build` (CI: the Dockerfile runs it in a node:22 stage, then the final image stage compiles tasksd with this embed). The resulting ui/dist is baked into the tasksd binary — no external static-assets directory, no sidecar, no separate deploy.

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

import tasksui "github.com/hanzoai/tasks/ui"
router.PathPrefix("/").Handler(tasksui.Handler())

The Temporal gRPC-Gateway routes under /api/v1/* take precedence via earlier route registration; everything else falls through to the SPA, which supports client-side routing (react-router) 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 the build step has not run (dev workflow uses the Vite dev server instead — see ui/vite.config.ts).

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