Update page_files/Home.py
Browse files- page_files/Home.py +56 -141
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"))
|
|
@@ -529,148 +529,63 @@ st.markdown("""
|
|
| 529 |
|
| 530 |
|
| 531 |
# Showcase section - Databricks style
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
<
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
.showcase-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
}
|
| 550 |
-
.
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
}
|
| 554 |
-
.
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
box-shadow: 0 4px 20px rgba(0,0,0,0.10);
|
| 587 |
-
display: flex;
|
| 588 |
-
flex-direction: column;
|
| 589 |
-
cursor: pointer;
|
| 590 |
-
transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
|
| 591 |
-
}
|
| 592 |
-
.s-card:hover {
|
| 593 |
-
box-shadow: 0 8px 32px rgba(138,202,255,0.18);
|
| 594 |
-
border-color: #8ACAFF;
|
| 595 |
-
transform: translateY(-3px);
|
| 596 |
-
}
|
| 597 |
-
.s-card-img {
|
| 598 |
-
width: 100%;
|
| 599 |
-
height: 220px;
|
| 600 |
-
object-fit: contain;
|
| 601 |
-
object-position: top center;
|
| 602 |
-
display: block;
|
| 603 |
-
background: #fff;
|
| 604 |
-
border-bottom: 1px solid #1e3a30;
|
| 605 |
-
}
|
| 606 |
-
.s-card-body {
|
| 607 |
-
padding: 20px 22px 24px;
|
| 608 |
-
flex: 1;
|
| 609 |
-
display: flex;
|
| 610 |
-
flex-direction: column;
|
| 611 |
-
}
|
| 612 |
-
.s-card-title {
|
| 613 |
-
font-size: 1.1rem;
|
| 614 |
-
font-weight: 700;
|
| 615 |
-
color: #fff;
|
| 616 |
-
margin-bottom: 8px;
|
| 617 |
-
}
|
| 618 |
-
.s-card-desc {
|
| 619 |
-
font-size: 0.83rem;
|
| 620 |
-
color: #7a9e8f;
|
| 621 |
-
line-height: 1.6;
|
| 622 |
-
flex: 1;
|
| 623 |
-
margin-bottom: 16px;
|
| 624 |
-
}
|
| 625 |
-
.s-card-link {
|
| 626 |
-
font-size: 0.83rem;
|
| 627 |
-
font-weight: 600;
|
| 628 |
-
color: #8ACAFF;
|
| 629 |
-
display: inline-flex;
|
| 630 |
-
align-items: center;
|
| 631 |
-
gap: 4px;
|
| 632 |
-
}
|
| 633 |
-
.s-card-link::after { content: " \2192"; }
|
| 634 |
-
</style>
|
| 635 |
-
</head><body>
|
| 636 |
-
<div class="showcase-wrap">
|
| 637 |
-
<div class="showcase-left">
|
| 638 |
-
<div class="showcase-label">Platform Features</div>
|
| 639 |
-
<div class="showcase-heading">Accelerate Your Composites Research</div>
|
| 640 |
-
<p class="showcase-sub">Access a centralized, open-source database for experimental composite material properties. Polymer, fiber, and composite datasets, all in one place.</p>
|
| 641 |
-
</div>
|
| 642 |
-
<div class="showcase-cards">
|
| 643 |
-
<div class="s-card" onclick="window.parent.postMessage({type:'streamlit:setComponentValue',value:'upload'}, '*')">
|
| 644 |
-
<img class="s-card-img" src="""" + _extract_img + """" alt="Extract Data"/>
|
| 645 |
-
<div class="s-card-body">
|
| 646 |
-
<div class="s-card-title">Extract Data</div>
|
| 647 |
-
<p class="s-card-desc">Upload experimental datasets and extract structured material property data into the AIM database.</p>
|
| 648 |
-
<span class="s-card-link">Open platform</span>
|
| 649 |
-
</div>
|
| 650 |
-
</div>
|
| 651 |
-
<div class="s-card" onclick="window.parent.postMessage({type:'streamlit:setComponentValue',value:'search'}, '*')">
|
| 652 |
-
<img class="s-card-img" src="""" + _search_img + """" alt="Search"/>
|
| 653 |
-
<div class="s-card-body">
|
| 654 |
-
<div class="s-card-title">Search</div>
|
| 655 |
-
<p class="s-card-desc">Browse and filter polymer, fiber, and composite material properties across the full database.</p>
|
| 656 |
-
<span class="s-card-link">Open search</span>
|
| 657 |
-
</div>
|
| 658 |
-
</div>
|
| 659 |
-
</div>
|
| 660 |
-
</div>
|
| 661 |
-
</body></html>
|
| 662 |
-
""")
|
| 663 |
|
| 664 |
-
components.html(
|
| 665 |
|
| 666 |
-
# Handle card clicks via session state
|
| 667 |
-
_card_click = st.session_state.get("_showcase_click", None)
|
| 668 |
-
if _card_click == "upload":
|
| 669 |
-
st.session_state["_showcase_click"] = None
|
| 670 |
-
st.switch_page("page_files/Upload_Data.py")
|
| 671 |
-
elif _card_click == "search":
|
| 672 |
-
st.session_state["_showcase_click"] = None
|
| 673 |
-
st.switch_page("page_files/Categorized_Search.py")
|
| 674 |
|
| 675 |
|
| 676 |
|
|
|
|
| 57 |
_HERE = Path(__file__).parent # page_files/
|
| 58 |
_ROOT = _HERE.parent # project root
|
| 59 |
|
| 60 |
+
home_img = img_to_b64(str(_ROOT / "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"))
|
|
|
|
| 529 |
|
| 530 |
|
| 531 |
# Showcase section - Databricks style
|
| 532 |
+
def _build_showcase_html(extract_b64, search_b64):
|
| 533 |
+
return (
|
| 534 |
+
"<!DOCTYPE html><html lang='en'><head>"
|
| 535 |
+
"<meta charset='UTF-8'/>"
|
| 536 |
+
"<link href='https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap' rel='stylesheet'>"
|
| 537 |
+
"<style>"
|
| 538 |
+
"*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}"
|
| 539 |
+
"body{font-family:'DM Sans',sans-serif;background:#fff;}"
|
| 540 |
+
".showcase-wrap{display:flex;align-items:flex-start;gap:48px;padding:64px 60px;background:#fff;}"
|
| 541 |
+
".showcase-left{flex:0 0 280px;padding-top:16px;}"
|
| 542 |
+
".showcase-label{font-size:.68rem;font-weight:700;letter-spacing:1.8px;text-transform:uppercase;color:#8ACAFF;margin-bottom:14px;}"
|
| 543 |
+
".showcase-heading{font-size:2rem;font-weight:800;color:#0f1f1a;letter-spacing:-1px;line-height:1.15;margin-bottom:16px;}"
|
| 544 |
+
".showcase-sub{color:#5a6b65;font-size:.93rem;line-height:1.7;}"
|
| 545 |
+
".showcase-cards{flex:1;display:flex;gap:20px;}"
|
| 546 |
+
".s-card{flex:1;border-radius:16px;overflow:hidden;background:#0f1f1a;border:1.5px solid #1e3a30;"
|
| 547 |
+
"box-shadow:0 4px 20px rgba(0,0,0,.10);display:flex;flex-direction:column;"
|
| 548 |
+
"cursor:pointer;transition:box-shadow .2s,border-color .2s,transform .2s;}"
|
| 549 |
+
".s-card:hover{box-shadow:0 8px 32px rgba(138,202,255,.18);border-color:#8ACAFF;transform:translateY(-3px);}"
|
| 550 |
+
".s-card-img{width:100%;height:220px;object-fit:contain;object-position:top center;"
|
| 551 |
+
"display:block;background:#fff;border-bottom:1px solid #1e3a30;}"
|
| 552 |
+
".s-card-body{padding:20px 22px 24px;flex:1;display:flex;flex-direction:column;}"
|
| 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:' \u2192';}"
|
| 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=\"window.parent.location.href=window.parent.location.pathname.replace(/\\/[^/]*$/, '') + '/Upload_Data'\">"
|
| 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=\"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 |
|