Skip to content

refactor(ui): group top-right canvas buttons in a flex row#17

Open
Gruku wants to merge 6 commits intoTheAlexPG:mainfrom
Gruku:feat/diagram-export
Open

refactor(ui): group top-right canvas buttons in a flex row#17
Gruku wants to merge 6 commits intoTheAlexPG:mainfrom
Gruku:feat/diagram-export

Conversation

@Gruku
Copy link
Copy Markdown
Contributor

@Gruku Gruku commented May 7, 2026

Summary

  • Export and Flows buttons previously used hardcoded right/top pixel offsets and overlapped each other in the canvas top-right corner.
  • Wrapped both in a single absolute right-4 top-4 flex items-center gap-2 container in DiagramPage so layout flows naturally; each component now only owns its own size.
  • ExportToolbar and FlowsPanel outer wrappers became position: relative so their dropdowns/popovers still anchor correctly.

Test plan

  • Open a diagram — Export sits to the left of Flows with a visible gap, neither overlaps the other.
  • Click Export — dropdown opens anchored to the Export button's right edge.
  • Click Flows — panel opens to the left of the Flows button, same as before.
  • Toggle the object tree sidebar — top-right cluster stays glued to the canvas top-right corner.
  • Open a forked (draft) diagram — coral inset border still renders cleanly behind the cluster.

Gruku and others added 6 commits May 5, 2026 21:46
Adds GET /api/v1/diagrams/{id}/export?format=... so AI agents and
external tools can pull a single diagram as text instead of scraping the
whole-workspace JSON dump. The C4 macro vocabulary is shared between
Mermaid and PlantUML via app/services/c4_common.py and is diagram-type
aware (STORE -> SystemDb on context views, ContainerDb on container
views, etc.) so the output is legal under each renderer's stdlib.

Auth requires an authenticated workspace member with can_read_diagram
access for workspace-scoped diagrams (anonymous + non-members get 401 /
403). GROUP objects render as nested System_Boundary blocks with their
placed children inside; Structurizr DSL emits matching brace blocks so
import_dsl rebuilds parent_id on round-trip. Mermaid flowchart output
for `custom` diagrams is restricted to the subset that round-trips
through mermaid_service.parse(). Format-aware escaping covers quotes,
brackets, pipes, and backslashes per format.

Tests: 27 service-level unit tests + 10 e2e API tests, all green.
get_diagram_payload built the connection set only from endpoint object
IDs, ignoring Connection.draft_id. A draft-scoped Connection wired
between two live objects on the diagram would leak into the live
export. Live diagrams now only see Connection.draft_id IS NULL;
forked diagrams see live + their own draft's overlay, matching
connection_service.get_connections() semantics.

Adds a regression test that creates a draft-scoped connection between
two live objects and asserts it is absent from both the mermaid and
JSON exports of the live diagram.

Codex M1.
ExportToolbar adds a top-right "Export" button on the diagram canvas
with a popover offering Copy + Save for each of the four backend
formats (Mermaid, PlantUML, Structurizr DSL, JSON). Hits
GET /api/v1/diagrams/{id}/export from PR TheAlexPG#15.

- fetchDiagramExport() in use-api.ts uses responseType:'text' +
  transformResponse override so axios doesn't JSON-parse the
  text/plain payload (Mermaid/PlantUML/DSL).
- Filenames use a slugified diagram name + format-specific extension
  (.mmd / .puml / .dsl / .json).
- Errors surface inline in the popover (401/403/404 mapped to short
  labels) instead of console-only.
- Styling mirrors the existing inline-style toolbar pattern; no
  hover-motion, no colored left rails, no elevation shadows on the
  popover per the project UI rules.
Export and Flows used hardcoded `right`/`top` offsets and could overlap.
Wrap them in a single `absolute right-4 top-4 flex` container in
DiagramPage so each button only owns its own width — adding more buttons
later no longer requires recalculating offsets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants