Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 31 additions & 21 deletions frontend/src/components/BootContextPill.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -31,7 +34,9 @@ function SectionRow({ section, dimmed }: { section: SectionMeta; dimmed?: boolea
<span className="boot-context-pill-section-tokens">{section.tokens}t</span>
</button>
{open && section.content && (
<pre className="boot-context-pill-section-content">{section.content}</pre>
<div className="boot-context-pill-section-content boot-context-md">
<ReactMarkdown remarkPlugins={[remarkGfm]}>{section.content}</ReactMarkdown>
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 style: MessageBubble uses rehypeHighlight for syntax-highlighted code blocks. BootContextPill renders CLAUDE.md content which contains fenced code blocks (bash commands, TS snippets), but omits rehypeHighlight — code blocks will render as plain monospace text without highlighting. Consider adding it for visual consistency. [fixable]

</div>
)}
</div>
);
Expand Down Expand Up @@ -133,29 +138,34 @@ export function BootContextPill({ context }: Props) {
)}
</div>

{showModal && context.fullMarkdown && (
<div
className="boot-context-modal-overlay"
onClick={() => setShowModal(false)}
onTouchStart={(e) => e.stopPropagation()}
>
{showModal &&
context.fullMarkdown &&
createPortal(
<div
className="boot-context-modal"
onClick={(e) => 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()}
>
<div className="boot-context-modal-header">
<h3>Boot Context (Full Markdown)</h3>
<button onClick={() => setShowModal(false)} className="boot-context-modal-close">
</button>
<div
className="boot-context-modal"
onClick={(e) => e.stopPropagation()}
role="dialog"
aria-modal="true"
aria-label="Boot context full markdown"
>
<div className="boot-context-modal-header">
<h3>Boot Context (Full Markdown)</h3>
<button onClick={() => setShowModal(false)} className="boot-context-modal-close">
</button>
</div>
<div className="boot-context-modal-content boot-context-md">
<ReactMarkdown remarkPlugins={[remarkGfm]}>{context.fullMarkdown}</ReactMarkdown>
</div>
</div>
<pre className="boot-context-modal-content">{context.fullMarkdown}</pre>
</div>
</div>
)}
</div>,
document.body,
)}
</>
);
}
107 changes: 102 additions & 5 deletions frontend/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
Loading