Skip to content

Fix sidebar parameter action alignment and PDF report print rendering Issue#38#48

Open
EddW1219 wants to merge 3 commits into
mainfrom
edward_branch_2
Open

Fix sidebar parameter action alignment and PDF report print rendering Issue#38#48
EddW1219 wants to merge 3 commits into
mainfrom
edward_branch_2

Conversation

@EddW1219
Copy link
Copy Markdown
Collaborator

Fix Reset/Save parameter button alignment

Aligns Reset Parameters and Save Parameters buttons consistently in the sidebar.
Fix PDF print layout (report view).

Improves print-only chart/text flow to prevent overlap in exported PDF.
Consolidates print CSS behavior for chart spacing and heading separation.
Fixes formula rendering in PDF by preserving visual math output and suppressing assistive MathML in print.

@EddW1219 EddW1219 self-assigned this May 26, 2026
Copilot AI review requested due to automatic review settings May 26, 2026 11:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR addresses UI layout issues in the sidebar parameter actions and improves PDF/print rendering for the report view to prevent chart/text overlap and math rendering artifacts.

Changes:

  • Adds scoped CSS to align “Reset Parameters” and “Save Parameters” controls consistently in the sidebar action row.
  • Consolidates print-only CSS rules to improve chart spacing, heading separation, and formula rendering in exported PDFs.
  • Adjusts a report model snippet to wrap a LaTeX block with centered HTML.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/epicc/main.py Adds CSS for action-row alignment and print/PDF rendering; refactors parameter action buttons into a keyed container for styling.
src/epicc/model/models/tb_isolation.yaml Wraps a display-math block in a centered HTML div and tweaks the LaTeX test string.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/epicc/__main__.py Outdated
Comment thread src/epicc/__main__.py
Comment on lines +245 to +250
button_col2.button(
"Save Parameters",
disabled=True,
width="stretch",
help="Fix parameter errors first",
)
Comment thread src/epicc/__main__.py
Comment on lines +35 to +140
st.markdown(
"""
<style>
/* Action row wrapper */
.st-key-param-actions-row [data-testid="stHorizontalBlock"] {
align-items: flex-start !important;
}

/* Normalize column internal spacing */
.st-key-param-actions-row [data-testid="column"] > div {
padding-top: 0 !important;
}
.st-key-param-actions-row [data-testid="stElementContainer"] {
margin-top: 0 !important;
margin-bottom: 0 !important;
}

/* Make trigger controls fill width and remove extra top offset */
.st-key-param-actions-row [data-testid="stButton"],
.st-key-param-actions-row [data-testid="stPopover"] {
width: 100%;
margin-top: 0 !important;
padding-top: 0 !important;
}
.st-key-param-actions-row [data-testid="stButton"] > button,
.st-key-param-actions-row [data-testid="stPopover"] > button {
width: 100%;
}

/* Report spacing: keep headings away from charts */
.st-key-results-report [data-testid="stPlotlyChart"],
.st-key-results-report [data-testid="stVegaLiteChart"],
.st-key-results-report [data-testid="stPyplot"] {
margin-bottom: 2rem !important;
}

.st-key-results-report [data-testid="stMarkdownContainer"] h1,
.st-key-results-report [data-testid="stMarkdownContainer"] h2,
.st-key-results-report [data-testid="stMarkdownContainer"] h3 {
margin-top: 1.25rem !important;
}

/* -------- Print/PDF display fixes only (SINGLE CONSOLIDATED BLOCK) -------- */
@media print {
/* Scope strictly to report area */
.st-key-results-report {
overflow: visible !important;
}

/* 1) Keep chart block in flow + reserve vertical space below chart */
.st-key-results-report [data-testid="stPlotlyChart"],
.st-key-results-report [data-testid="stVegaLiteChart"],
.st-key-results-report [data-testid="stPyplot"] {
display: block !important;
position: static !important;
clear: both !important;
overflow: visible !important;
break-inside: avoid !important;
page-break-inside: avoid !important;
margin: 0 0 2.8rem 0 !important;
padding-bottom: 1.2rem !important;
}

/* Prevent Plotly print-height collapse */
.st-key-results-report [data-testid="stPlotlyChart"] .js-plotly-plot {
min-height: 520px !important;
}

/* 2) Ensure headings/text start after chart and have breathing room */
.st-key-results-report h1,
.st-key-results-report h2,
.st-key-results-report h3,
.st-key-results-report h4,
.st-key-results-report p,
.st-key-results-report [data-testid="stMarkdownContainer"] {
clear: both !important;
position: static !important;
z-index: auto !important;
margin-top: 1.5rem !important;
}

.st-key-results-report [data-testid="stMarkdownContainer"] h1,
.st-key-results-report [data-testid="stMarkdownContainer"] h2,
.st-key-results-report [data-testid="stMarkdownContainer"] h3 {
margin-top: 1.5rem !important;
clear: both !important;
}

/* 3) Formula print fix: show only visual layer, hide assistive MathML */
.st-key-results-report .katex,
.st-key-results-report .katex-display,
.st-key-results-report mjx-container,
.st-key-results-report .MathJax {
visibility: visible !important;
opacity: 1 !important;
}

.st-key-results-report .katex .katex-mathml,
.st-key-results-report mjx-assistive-mml {
display: none !important;
}
}
</style>
""",
unsafe_allow_html=True,
)
Comment on lines +330 to +336
<div style="text-align: center;">

$$
\LaTeX \text{ test.}
\text{LaTeX test.}
$$

</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants