diff --git a/resources/views/proposals/show.blade.php b/resources/views/proposals/show.blade.php index c6b2ee6..ccb0e3a 100644 --- a/resources/views/proposals/show.blade.php +++ b/resources/views/proposals/show.blade.php @@ -174,13 +174,11 @@ .mermaid-container { background: #ffffff; border-radius: 16px; - padding: 1.5rem; margin: 2rem 0; border: 1px solid rgba(0, 0, 0, 0.05); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05); - display: flex; - justify-content: center; - overflow-x: auto; + overflow: hidden; + position: relative; } .dark .mermaid-container { background: #0f172a; @@ -188,6 +186,131 @@ box-shadow: none; } + /* Mermaid zoom toolbar */ + .mermaid-toolbar { + display: flex; + align-items: center; + gap: 4px; + padding: 8px 12px; + background: rgba(248, 250, 252, 0.9); + backdrop-filter: blur(8px); + border-bottom: 1px solid rgba(0, 0, 0, 0.06); + border-radius: 16px 16px 0 0; + } + .dark .mermaid-toolbar { + background: rgba(15, 23, 42, 0.9); + border-bottom: 1px solid rgba(255, 255, 255, 0.06); + } + .mermaid-toolbar-label { + font-size: 0.65rem; + font-weight: 700; + letter-spacing: 0.08em; + text-transform: uppercase; + color: #94a3b8; + margin-right: 4px; + flex: 1; + } + .mermaid-zoom-btn { + display: inline-flex; + align-items: center; + justify-content: center; + width: 30px; + height: 30px; + border-radius: 8px; + border: 1px solid rgba(0, 0, 0, 0.08); + background: #fff; + color: #475569; + cursor: pointer; + font-size: 15px; + transition: all 0.15s ease; + user-select: none; + flex-shrink: 0; + } + .dark .mermaid-zoom-btn { + background: #1e293b; + border-color: rgba(255, 255, 255, 0.08); + color: #94a3b8; + } + .mermaid-zoom-btn:hover { + background: var(--accent-color, #4f46e5); + border-color: var(--accent-color, #4f46e5); + color: #fff; + transform: scale(1.05); + box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3); + } + .mermaid-zoom-btn:active { + transform: scale(0.95); + } + .mermaid-zoom-pct { + font-size: 0.7rem; + font-weight: 700; + color: #64748b; + min-width: 38px; + text-align: center; + font-family: 'Inter', monospace; + } + .dark .mermaid-zoom-pct { color: #64748b; } + + /* Mermaid svg canvas area */ + .mermaid-canvas { + width: 100%; + min-height: 200px; + cursor: grab; + padding: 1.5rem; + box-sizing: border-box; + } + .mermaid-canvas:active { cursor: grabbing; } + .mermaid-canvas svg { + display: block; + margin: 0 auto; + max-width: 100%; + height: auto; + } + + /* Fullscreen overlay */ + .mermaid-fullscreen-overlay { + display: none; + position: fixed; + inset: 0; + z-index: 9999; + background: rgba(2, 6, 23, 0.92); + backdrop-filter: blur(12px); + flex-direction: column; + align-items: center; + justify-content: center; + } + .mermaid-fullscreen-overlay.active { + display: flex; + } + .mermaid-fullscreen-inner { + background: #fff; + border-radius: 20px; + overflow: hidden; + width: 92vw; + max-width: 1200px; + max-height: 90vh; + display: flex; + flex-direction: column; + box-shadow: 0 40px 80px rgba(0,0,0,0.5); + } + .dark .mermaid-fullscreen-inner { + background: #0f172a; + } + .mermaid-fullscreen-canvas { + flex: 1; + overflow: auto; + display: flex; + align-items: center; + justify-content: center; + padding: 2rem; + cursor: grab; + } + .mermaid-fullscreen-canvas:active { cursor: grabbing; } + .mermaid-fullscreen-canvas svg { + width: 100%; + height: auto; + } + /* Bullet lists */ .proposal-content ul, .proposal-content ol { padding-left: 1.5rem; @@ -682,6 +805,8 @@ + + @@ -819,6 +944,9 @@ } }); + // Mermaid zoom state store + const mermaidZoomInstances = {}; + // Scan code blocks for mermaid and convert them const codeElements = contentDiv.querySelectorAll('pre code.language-mermaid'); codeElements.forEach((codeEl, index) => { @@ -830,25 +958,196 @@ wrapper.className = 'mermaid-container no-print transition-all duration-300'; wrapper.id = 'mermaid-wrapper-' + index; + // Zoom Toolbar + const toolbar = document.createElement('div'); + toolbar.className = 'mermaid-toolbar'; + toolbar.innerHTML = ` + + + 100% + + + + `; + + // Canvas wrapper + const canvas = document.createElement('div'); + canvas.className = 'mermaid-canvas'; + canvas.id = 'mermaid-canvas-' + index; + const graphDiv = document.createElement('div'); graphDiv.className = 'mermaid w-full'; graphDiv.id = 'mermaid-graph-' + index; graphDiv.textContent = rawMermaid; - wrapper.appendChild(graphDiv); + canvas.appendChild(graphDiv); + wrapper.appendChild(toolbar); + wrapper.appendChild(canvas); preContainer.parentNode.replaceChild(wrapper, preContainer); }); + // Fullscreen overlay (singleton) + const fsOverlay = document.createElement('div'); + fsOverlay.className = 'mermaid-fullscreen-overlay'; + fsOverlay.id = 'mermaid-fs-overlay'; + fsOverlay.innerHTML = ` +