# Make the runs and jobs switch semantic

Written against: ba9dbd7cba8097928f9939579eb39779dc0dfc49

## Evidence chain

- Surface: dashboard and project headers, e.g. `https://ci.nply.org/cgi-bin/minci.cgi/index.html` and `?view=jobs`.
- Problem: the switch is rendered as inline breadcrumb text plus a lone alternate link (`Dashboard › Runs jobs`, `Dashboard › Jobs runs`). The relationship between current view and alternate view is understandable only by inference.
- Design evidence: `README.md` frames minci as a minimal web interface; current `main.c` already uses simple structural HTML (`header`, heading, links, tables). The user explicitly asked to maintain semantic HTML while improving spacing and flow.
- Owner: `main.c` header rendering and `minci.css` header/link spacing.
- Scope and affected surfaces: dashboard runs/jobs and project runs/jobs.
- Uncertainty: none.

## Design decision

Separate breadcrumb identity from view switching. Keep the existing heading for location, then add a small semantic navigation block for the local view switch: `view: runs | jobs`. Use plain links/spans, not buttons, because this is navigation between URLs.

## Reuse

- Existing `body > header`, `h1`, `a`, `span` pattern.
- Existing URLs: `index.html`, `index.html?view=jobs`, `index.html?project-name=<name>`, and `index.html?project-name=<name>&view=jobs`.
- Exemplar: current fixed header and text-first table navigation.

## Changes

1. `main.c`
   - Change: after the breadcrumb text, emit a semantic navigation element if kcgi supports it; otherwise emit a small labelled span group with class `view-switch`.
   - Preserve: current view remains visible as text; alternate view remains a normal anchor.
   - Verify: dashboard header reads like `Dashboard › Runs    view: runs | jobs`, not `Runs jobs`.

2. `main.c`
   - Change: apply the same switch to project pages, preserving the selected project in generated links.
   - Preserve: project name remains the primary breadcrumb item.
   - Verify: `?project-name=kidang` links to `?project-name=kidang&view=jobs`, and the jobs page links back to `?project-name=kidang`.

3. `minci.css`
   - Change: add small spacing for `.view-switch` and `.view-switch-current` using existing header typography. Avoid colour changes except inherited link/text colour.
   - Preserve: fixed compact header, no tabs, no button chrome.
   - Verify: the switch is readable in the fixed header without wrapping awkwardly at common widths.

## Scope

- Inherit: dashboard and project list pages only.
- Verify: run detail and job detail breadcrumbs remain unchanged unless adding a separate back-link is requested.
- Exclude: route changes, JavaScript, active-tab components, icons, and colour changes.

## Validation

- Product: switch dashboard runs ↔ jobs and project runs ↔ jobs; confirm the current view and alternate view are clear.
- Interface: inspect rendered header text at narrow and wide widths.
- System: confirm no duplicate route-building helper or new frontend abstraction is introduced.
- Repository: `make` on the target build host → expected successful `minci.cgi` build.

## Stop conditions

- Stop if adding semantic navigation requires unsupported kcgi enum changes; fall back to a labelled inline span group.

## Design documentation

- After acceptance and validation: none required.
