diff --git a/frontend/src/components/BootContextPill.tsx b/frontend/src/components/BootContextPill.tsx index c09989c5..57af42ac 100644 --- a/frontend/src/components/BootContextPill.tsx +++ b/frontend/src/components/BootContextPill.tsx @@ -1,4 +1,7 @@ import { useState, useEffect } from 'react'; +import { createPortal } from 'react-dom'; +import ReactMarkdown from 'react-markdown'; +import remarkGfm from 'remark-gfm'; import type { BootContextMeta, SectionMeta } from '@mitzo/client'; interface Props { @@ -31,7 +34,9 @@ function SectionRow({ section, dimmed }: { section: SectionMeta; dimmed?: boolea {section.tokens}t {open && section.content && ( -
{section.content}
+
+ {section.content} +
)} ); @@ -133,29 +138,34 @@ export function BootContextPill({ context }: Props) { )} - {showModal && context.fullMarkdown && ( -
setShowModal(false)} - onTouchStart={(e) => e.stopPropagation()} - > + {showModal && + context.fullMarkdown && + createPortal(
e.stopPropagation()} - role="dialog" - aria-modal="true" - aria-label="Boot context full markdown" + className="boot-context-modal-overlay" + onClick={() => setShowModal(false)} + onTouchStart={(e) => e.stopPropagation()} > -
-

Boot Context (Full Markdown)

- +
e.stopPropagation()} + role="dialog" + aria-modal="true" + aria-label="Boot context full markdown" + > +
+

Boot Context (Full Markdown)

+ +
+
+ {context.fullMarkdown} +
-
{context.fullMarkdown}
-
-
- )} +
, + document.body, + )} ); } diff --git a/frontend/src/styles/global.css b/frontend/src/styles/global.css index 0a1941c2..f5731e4b 100644 --- a/frontend/src/styles/global.css +++ b/frontend/src/styles/global.css @@ -2638,17 +2638,96 @@ textarea:focus { background: rgba(255, 255, 255, 0.03); border-left: 2px solid rgba(255, 255, 255, 0.1); border-radius: 0 4px 4px 0; - font-family: var(--code-font); font-size: 0.65rem; - line-height: 1.4; + line-height: 1.5; color: var(--text-dim); - white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow-y: auto; -webkit-overflow-scrolling: touch; } +/* Shared markdown styles for boot context (section + modal) */ + +.boot-context-md h1, +.boot-context-md h2, +.boot-context-md h3 { + margin: 0.4rem 0 0.2rem; + color: var(--text-secondary); +} + +.boot-context-md p { + margin: 0.3rem 0; +} + +.boot-context-md ul, +.boot-context-md ol { + margin: 0.3rem 0; + padding-left: 1.3rem; +} + +.boot-context-md li { + margin: 0.15rem 0; +} + +.boot-context-md code { + font-family: var(--code-font); + font-size: 0.85em; + background: rgba(255, 255, 255, 0.06); + padding: 0.1rem 0.25rem; + border-radius: 3px; +} + +.boot-context-md pre { + font-family: var(--code-font); + font-size: 0.85em; + background: rgba(255, 255, 255, 0.04); + padding: 0.4rem 0.6rem; + border-radius: 4px; + overflow-x: auto; + margin: 0.3rem 0; +} + +.boot-context-md pre code { + background: none; + padding: 0; +} + +.boot-context-md table { + border-collapse: collapse; + width: 100%; + margin: 0.3rem 0; +} + +.boot-context-md th, +.boot-context-md td { + border: 1px solid rgba(255, 255, 255, 0.1); + padding: 0.2rem 0.4rem; + text-align: left; +} + +.boot-context-md th { + background: rgba(255, 255, 255, 0.04); + font-weight: 500; +} + +.boot-context-md strong { + color: var(--text-primary); +} + +.boot-context-md hr { + border: none; + border-top: 1px solid rgba(255, 255, 255, 0.1); + margin: 0.6rem 0; +} + +/* Section-specific size overrides (compact) */ +.boot-context-pill-section-content h1, +.boot-context-pill-section-content h2, +.boot-context-pill-section-content h3 { + font-size: 0.7rem; +} + .boot-context-pill-trimmed-toggle { display: flex; align-items: center; @@ -2752,15 +2831,33 @@ textarea:focus { overflow-y: auto; padding: 1.5rem; margin: 0; - font-family: var(--code-font); font-size: var(--text-xs); line-height: 1.6; color: var(--text-secondary); - white-space: pre-wrap; word-break: break-word; -webkit-overflow-scrolling: touch; } +/* Modal-specific size overrides (larger) */ +.boot-context-modal-content h1 { + font-size: var(--text-lg); + margin: 1rem 0 0.5rem; + color: var(--text-primary); + border-bottom: 1px solid rgba(255, 255, 255, 0.1); + padding-bottom: 0.3rem; +} + +.boot-context-modal-content h2 { + font-size: var(--text-base); + margin: 0.8rem 0 0.4rem; + color: var(--text-primary); +} + +.boot-context-modal-content h3 { + font-size: var(--text-sm); + margin: 0.6rem 0 0.3rem; +} + /* ===== Markdown Preview Card ===== */ .md-preview-card {