Update page_files/Home.py
Browse files- page_files/Home.py +53 -24
page_files/Home.py
CHANGED
|
@@ -57,7 +57,7 @@ def img_to_b64(path):
|
|
| 57 |
_HERE = Path(__file__).parent # page_files/
|
| 58 |
_ROOT = _HERE.parent # project root
|
| 59 |
|
| 60 |
-
home_img = img_to_b64(str(
|
| 61 |
logo_img = img_to_b64(str(_ROOT / "logo.png"))
|
| 62 |
extract_card_img = img_to_b64(str(_ROOT / "extract_card_img.png"))
|
| 63 |
search_card_img = img_to_b64(str(_ROOT / "search_card_img.png"))
|
|
@@ -553,39 +553,68 @@ def _build_showcase_html(extract_b64, search_b64):
|
|
| 553 |
".s-card-title{font-size:1.1rem;font-weight:700;color:#fff;margin-bottom:8px;}"
|
| 554 |
".s-card-desc{font-size:.83rem;color:#7a9e8f;line-height:1.6;flex:1;margin-bottom:16px;}"
|
| 555 |
".s-card-link{font-size:.83rem;font-weight:600;color:#8ACAFF;display:inline-flex;align-items:center;gap:4px;}"
|
| 556 |
-
".s-card-link::after{content:'
|
| 557 |
"</style></head><body>"
|
| 558 |
"<div class='showcase-wrap'>"
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 564 |
"</div>"
|
| 565 |
-
"<div class='
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
"</div>"
|
| 573 |
-
"</div>"
|
| 574 |
-
"<div class='s-card' onclick=\"window.parent.location.href=window.parent.location.pathname.replace(/\\/[^/]*$/, '') + '/Categorized_Search'\">"
|
| 575 |
-
"<img class='s-card-img' src='" + search_b64 + "' alt='Search'/>"
|
| 576 |
-
"<div class='s-card-body'>"
|
| 577 |
-
"<div class='s-card-title'>Search</div>"
|
| 578 |
-
"<p class='s-card-desc'>Browse and filter polymer, fiber, and composite material properties across the full database.</p>"
|
| 579 |
-
"<span class='s-card-link'>Open search</span>"
|
| 580 |
-
"</div>"
|
| 581 |
-
"</div>"
|
| 582 |
"</div>"
|
|
|
|
| 583 |
"</div>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
"</body></html>"
|
| 585 |
)
|
| 586 |
|
| 587 |
components.html(_build_showcase_html(extract_card_img, search_card_img), height=480, scrolling=False)
|
| 588 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
|
| 590 |
|
| 591 |
|
|
|
|
| 57 |
_HERE = Path(__file__).parent # page_files/
|
| 58 |
_ROOT = _HERE.parent # project root
|
| 59 |
|
| 60 |
+
home_img = img_to_b64(str(_HERE / "images" / "Home.png"))
|
| 61 |
logo_img = img_to_b64(str(_ROOT / "logo.png"))
|
| 62 |
extract_card_img = img_to_b64(str(_ROOT / "extract_card_img.png"))
|
| 63 |
search_card_img = img_to_b64(str(_ROOT / "search_card_img.png"))
|
|
|
|
| 553 |
".s-card-title{font-size:1.1rem;font-weight:700;color:#fff;margin-bottom:8px;}"
|
| 554 |
".s-card-desc{font-size:.83rem;color:#7a9e8f;line-height:1.6;flex:1;margin-bottom:16px;}"
|
| 555 |
".s-card-link{font-size:.83rem;font-weight:600;color:#8ACAFF;display:inline-flex;align-items:center;gap:4px;}"
|
| 556 |
+
".s-card-link::after{content:' →';}"
|
| 557 |
"</style></head><body>"
|
| 558 |
"<div class='showcase-wrap'>"
|
| 559 |
+
"<div class='showcase-left'>"
|
| 560 |
+
"<div class='showcase-label'>Platform Features</div>"
|
| 561 |
+
"<div class='showcase-heading'>Accelerate Your Composites Research</div>"
|
| 562 |
+
"<p class='showcase-sub'>Access a centralized, open-source database for experimental composite "
|
| 563 |
+
"material properties. Polymer, fiber, and composite datasets, all in one place.</p>"
|
| 564 |
+
"</div>"
|
| 565 |
+
"<div class='showcase-cards'>"
|
| 566 |
+
"<div class='s-card' onclick='document.getElementById("btn_upload").click()'>"
|
| 567 |
+
"<img class='s-card-img' src='" + extract_b64 + "' alt='Extract Data'/>"
|
| 568 |
+
"<div class='s-card-body'>"
|
| 569 |
+
"<div class='s-card-title'>Extract Data</div>"
|
| 570 |
+
"<p class='s-card-desc'>Upload experimental datasets and extract structured material property data into the AIM database.</p>"
|
| 571 |
+
"<span class='s-card-link'>Open platform</span>"
|
| 572 |
+
"</div>"
|
| 573 |
"</div>"
|
| 574 |
+
"<div class='s-card' onclick='document.getElementById("btn_search").click()'>"
|
| 575 |
+
"<img class='s-card-img' src='" + search_b64 + "' alt='Search'/>"
|
| 576 |
+
"<div class='s-card-body'>"
|
| 577 |
+
"<div class='s-card-title'>Search</div>"
|
| 578 |
+
"<p class='s-card-desc'>Browse and filter polymer, fiber, and composite material properties across the full database.</p>"
|
| 579 |
+
"<span class='s-card-link'>Open search</span>"
|
| 580 |
+
"</div>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 581 |
"</div>"
|
| 582 |
+
"</div>"
|
| 583 |
"</div>"
|
| 584 |
+
"<button id='btn_upload' style='display:none' "
|
| 585 |
+
"onclick="window.parent.document.querySelectorAll('[data-testid=stBaseButton-header]')[0]?.click()">"
|
| 586 |
+
"</button>"
|
| 587 |
+
"<button id='btn_search' style='display:none' "
|
| 588 |
+
"onclick="window.parent.document.querySelectorAll('[data-testid=stBaseButton-header]')[1]?.click()">"
|
| 589 |
+
"</button>"
|
| 590 |
"</body></html>"
|
| 591 |
)
|
| 592 |
|
| 593 |
components.html(_build_showcase_html(extract_card_img, search_card_img), height=480, scrolling=False)
|
| 594 |
|
| 595 |
+
# Hidden Streamlit buttons wired to the card clicks via JS
|
| 596 |
+
_btn_col1, _btn_col2 = st.columns(2)
|
| 597 |
+
with _btn_col1:
|
| 598 |
+
if st.button("Go to Extract Data", key="_nav_upload", help="", use_container_width=True):
|
| 599 |
+
st.switch_page("page_files/Upload_Data.py")
|
| 600 |
+
with _btn_col2:
|
| 601 |
+
if st.button("Go to Search", key="_nav_search", help="", use_container_width=True):
|
| 602 |
+
st.switch_page("page_files/Categorized_Search.py")
|
| 603 |
+
|
| 604 |
+
# Hide the nav buttons visually — they are only triggered by JS
|
| 605 |
+
st.markdown("""
|
| 606 |
+
<style>
|
| 607 |
+
.st-key-_nav_upload, .st-key-_nav_search {
|
| 608 |
+
position: absolute !important;
|
| 609 |
+
opacity: 0 !important;
|
| 610 |
+
pointer-events: none !important;
|
| 611 |
+
height: 0 !important;
|
| 612 |
+
overflow: hidden !important;
|
| 613 |
+
}
|
| 614 |
+
</style>
|
| 615 |
+
""", unsafe_allow_html=True)
|
| 616 |
+
|
| 617 |
+
|
| 618 |
|
| 619 |
|
| 620 |
|