feat: Dashboard improvements and configuration updates
Dashboard: - Enhanced terminal components (ClaudeTerminal, GlobalClaudeTerminal) - Improved MarkdownRenderer for better documentation display - Updated convergence plots (ConvergencePlot, PlotlyConvergencePlot) - Refined Home, Analysis, Dashboard, Setup, Results pages - Added StudyContext improvements - Updated vite.config for better dev experience Configuration: - Updated CLAUDE.md with latest instructions - Enhanced launch_dashboard.py - Updated config.py settings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,13 +10,34 @@ import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
||||
interface MarkdownRendererProps {
|
||||
content: string;
|
||||
className?: string;
|
||||
studyId?: string; // Optional study ID for resolving relative image paths
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared markdown renderer with syntax highlighting, GFM, and LaTeX support.
|
||||
* Used by both the Home page (README display) and Results page (reports).
|
||||
*/
|
||||
export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({ content, className = '' }) => {
|
||||
export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({ content, className = '', studyId }) => {
|
||||
// Helper to resolve image URLs - converts relative paths to API endpoints
|
||||
const resolveImageSrc = (src: string | undefined): string => {
|
||||
if (!src) return '';
|
||||
|
||||
// If it's already an absolute URL or data URL, return as-is
|
||||
if (src.startsWith('http://') || src.startsWith('https://') || src.startsWith('data:')) {
|
||||
return src;
|
||||
}
|
||||
|
||||
// If we have a studyId, route through the API
|
||||
if (studyId) {
|
||||
// Remove leading ./ or / from the path
|
||||
const cleanPath = src.replace(/^\.?\//, '');
|
||||
return `/api/optimization/studies/${studyId}/image/${cleanPath}`;
|
||||
}
|
||||
|
||||
// Fallback: return original src
|
||||
return src;
|
||||
};
|
||||
|
||||
return (
|
||||
<article className={`markdown-body max-w-none ${className}`}>
|
||||
<ReactMarkdown
|
||||
@@ -165,12 +186,17 @@ export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({ content, cla
|
||||
hr: () => (
|
||||
<hr className="my-8 border-dark-600" />
|
||||
),
|
||||
// Images
|
||||
// Images - resolve relative paths through API
|
||||
img: ({ src, alt }) => (
|
||||
<img
|
||||
src={src}
|
||||
alt={alt}
|
||||
src={resolveImageSrc(src)}
|
||||
alt={alt || ''}
|
||||
className="my-4 rounded-lg max-w-full h-auto border border-dark-600"
|
||||
loading="lazy"
|
||||
onError={(e) => {
|
||||
// Hide broken images
|
||||
(e.target as HTMLImageElement).style.display = 'none';
|
||||
}}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user