Spaces:
Paused

dushyantsingh0 commited on
Commit
7de9344
·
1 Parent(s): c73e23d

Initial commit

Browse files
frontend/packages/shared/src/components/NexusMermaid.tsx CHANGED
@@ -205,7 +205,12 @@ export const NexusMermaid: React.FC<MermaidProps> = ({ chart, theme: propTheme }
205
  if (!renderedSvg || renderedSvg.includes('Syntax error')) {
206
  throw new Error("Internal rendering error: Syntax is incompatible.");
207
  }
208
- setSvg(renderedSvg);
 
 
 
 
 
209
  setError(null);
210
  }
211
  } catch (err: any) {
@@ -337,7 +342,8 @@ export const NexusMermaid: React.FC<MermaidProps> = ({ chart, theme: propTheme }
337
  width: 100% !important;
338
  height: auto !important;
339
  max-width: 100% !important;
340
- overflow: visible !important;
 
341
  }
342
  .mermaid .actor {
343
  stroke-width: 0 !important;
@@ -395,8 +401,8 @@ export const NexusMermaid: React.FC<MermaidProps> = ({ chart, theme: propTheme }
395
  width: '100%',
396
  minWidth: '0',
397
  margin: '24px 0',
398
- display: 'block',
399
- textAlign: 'left',
400
  background: activeTheme === 'dark' ? 'rgba(255,255,255,0.03)' : 'var(--bg-panel)',
401
  borderRadius: '24px',
402
  border: `1px solid ${activeTheme === 'dark' ? 'rgba(255,255,255,0.08)' : 'var(--border-subtle)'}`,
 
205
  if (!renderedSvg || renderedSvg.includes('Syntax error')) {
206
  throw new Error("Internal rendering error: Syntax is incompatible.");
207
  }
208
+ // Aggressive Clean: Remove hardcoded width/height to let CSS handle scaling properly
209
+ const cleanSvg = renderedSvg
210
+ .replace(/width="[^"]*"/, 'width="100%"')
211
+ .replace(/height="[^"]*"/, 'height="auto"')
212
+ .replace(/style="max-width:[^"]*"/, 'style="max-width:100%"');
213
+ setSvg(cleanSvg);
214
  setError(null);
215
  }
216
  } catch (err: any) {
 
342
  width: 100% !important;
343
  height: auto !important;
344
  max-width: 100% !important;
345
+ display: block;
346
+ margin: 0 auto;
347
  }
348
  .mermaid .actor {
349
  stroke-width: 0 !important;
 
401
  width: '100%',
402
  minWidth: '0',
403
  margin: '24px 0',
404
+ display: 'flex',
405
+ justifyContent: 'center',
406
  background: activeTheme === 'dark' ? 'rgba(255,255,255,0.03)' : 'var(--bg-panel)',
407
  borderRadius: '24px',
408
  border: `1px solid ${activeTheme === 'dark' ? 'rgba(255,255,255,0.08)' : 'var(--border-subtle)'}`,