Expand description
Admin UI generator for Gize (ADR-006).
gize make admin generates a separate Vite + React + TypeScript SPA under admin/,
driven by the manifest. The app is data-driven: resources_ts emits one descriptor
(fields, relationships and a Zod schema) per resource from gize.toml, and generic
components render List/Create/Edit/Delete for any of them. It talks to the backend through
a Vite dev proxy (/api → the API), so no CORS or backend changes are needed.
The UI is a token-based design system (light + dark theme) with a Django-inspired layout: an app shell, a changelist with search/filters/pagination/bulk actions, and a slide-over drawer form. Templates are Rust functions returning file contents.
Functions§
- api_ts
admin/src/api.ts— a tiny typed fetch client that attaches the JWT and hits/api.- app_tsx
admin/src/App.tsx— the app shell (topbar, sidebar, drawer, toasts, theme toggle).- auth_
tsx admin/src/auth.tsx— token storage hook and the branded login screen.- env_
example admin/.env.example.- gitignore
admin/.gitignore.- icons_
tsx admin/src/icons.tsx— a small inline SVG icon set.- index_
html admin/index.html. Sets the theme before first paint to avoid a flash.- main_
tsx admin/src/main.tsx.- package_
json admin/package.json— the SPA’s dependencies and scripts.- resource_
form_ tsx admin/src/ResourceForm.tsx— the drawer form (fieldsets, typed inputs, FK selects).- resource_
tsx admin/src/Resource.tsx— the changelist (search, filters, pagination, bulk actions).- resources_
ts admin/src/resources.ts— the descriptors generated from the manifest (ADR-006): one entry per resource with its editable fields (each field carrying its kind, and areftarget for foreign keys) and a Zod schema mirroring the backend validation.- styles_
css admin/src/styles.css— the token-based design system (light + dark).- theme_
ts admin/src/theme.ts— light/dark theme helpers (persisted, system-aware).- toast_
tsx admin/src/toast.tsx— a lightweight toast (event-based, no context wiring).- tsconfig
admin/tsconfig.json.- vite_
config admin/vite.config.ts— React, and a dev proxy so/api/*reaches the backend.