Skip to content

armgit / cogit

Public Imported from GitHub
0

Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.

feat(map): the Shape preview leads with the diagram

Erenb95b072c2023
diff --git a/docs/images/demo.gif b/docs/images/demo.gif
deleted file mode 100644
index 9202473..0000000
Binary files a/docs/images/demo.gif and /dev/null differ
diff --git a/docs/images/map-dark.png b/docs/images/map-dark.png
deleted file mode 100644
index 8aaa86e..0000000
Binary files a/docs/images/map-dark.png and /dev/null differ
diff --git a/docs/images/map-light.png b/docs/images/map-light.png
deleted file mode 100644
index 41e09f4..0000000
Binary files a/docs/images/map-light.png and /dev/null differ
diff --git a/packages/template/src/ShapeModal.tsx b/packages/template/src/ShapeModal.tsx
index a18832a..33383a0 100644
--- a/packages/template/src/ShapeModal.tsx
+++ b/packages/template/src/ShapeModal.tsx
@@ -513,11 +513,14 @@ export function ShapeSection({
<section className="shape-section">
<h3>Intent, Shape and Code</h3>
{state === "ready" ? (
- preview ? (
- <pre className="shape-preview">{preview}</pre>
- ) : diagramSource !== undefined ? (
- <MermaidDiagram source={diagramSource} className="shape-preview-diagram" fit />
- ) : null
+ // The diagram leads: a drawn Shape says more at a glance than three
+ // lines of steps, so it comes first and the steps follow it.
+ <>
+ {diagramSource === undefined ? null : (
+ <MermaidDiagram source={diagramSource} className="shape-preview-diagram" fit />
+ )}
+ {preview === undefined ? null : <pre className="shape-preview">{preview}</pre>}
+ </>
) : state === "off" ? (
<p className="muted">Shapes are off.</p>
) : state === "empty" ? (
diff --git a/packages/template/src/styles.css b/packages/template/src/styles.css
index 0de214f..f858df4 100644
--- a/packages/template/src/styles.css
+++ b/packages/template/src/styles.css
@@ -2692,11 +2692,19 @@ time {
}
.shape-preview-diagram {
- max-height: 180px;
+ height: 240px;
margin: 6px 0;
overflow: hidden;
}
+/* A diagram drawn inside the preview is scaled down to the box, never cropped
+ mid-shape: Mermaid writes width="100%" and a max-width, so both are reset. */
+.shape-preview-diagram svg {
+ width: 100% !important;
+ max-width: none !important;
+ height: 100% !important;
+}
+
.shape-open {
padding: 4px 12px;
color: var(--text);