""" Human+ — Page 1: Upload Lab PDF Refactored: semua konten pakai Streamlit native. """ import streamlit as st from ui.components import ( render_trust_badges, render_section_label, render_info_card, render_highlight_quote, render_error_state, ) def render_upload_page(): render_trust_badges() # ── Cara kerja ──────────────────────────────────────────────── render_section_label("CARA KERJA", "🔄") col1, col2, col3 = st.columns(3) with col1: st.markdown("**1 · 📤 Upload PDF**") st.caption("Hasil lab dari klinik manapun") with col2: st.markdown("**2 · 🧠 AI Analisis**") st.caption("Gemini baca & identifikasi biomarker") with col3: st.markdown("**3 · 💉 Terima Protocol**") st.caption("IV drip + suplemen hyperpersonal") st.write("") # ── Upload zone ─────────────────────────────────────────────── render_section_label("UPLOAD HASIL LAB", "📋") uploaded_file = st.file_uploader( label="Upload PDF hasil lab (maks 10MB)", type=["pdf"], help="Format: PDF · Maksimal 10MB · Data tidak disimpan di server", ) st.caption("🔒 PDF · Maks 10MB · Semua data hanya diproses sementara") # ── Validasi & lanjut ───────────────────────────────────────── if uploaded_file is not None: if uploaded_file.size > 10 * 1024 * 1024: render_error_state( title="File Terlalu Besar", message="Maksimal ukuran file adalah 10MB. Silakan compress PDF terlebih dahulu.", ) return size_kb = uploaded_file.size / 1024 size_str = f"{size_kb:.1f} KB" if size_kb < 1024 else f"{size_kb/1024:.2f} MB" # File preview — native columns col_icon, col_info, col_ok = st.columns([1, 6, 1]) with col_icon: st.write("📄") with col_info: st.markdown(f"**{uploaded_file.name}**") st.caption(f"{size_str} · PDF siap dianalisis") with col_ok: st.write("✅") # Simpan ke session state SEBELUM tombol ditekan if st.session_state.uploaded_pdf_bytes is None: st.session_state.uploaded_pdf_bytes = uploaded_file.read() st.session_state.pdf_filename = uploaded_file.name st.write("") if st.button("🔬 Analisis Hasil Lab Saya", type="primary", use_container_width=True): st.session_state.step = 2 st.rerun() else: st.caption("↑ Upload file PDF untuk memulai") # ── Quote ───────────────────────────────────────────────────── st.write("") render_highlight_quote( "Tubuh manusia luar biasa jika diberi apa yang dibutuhkannya. " "Mulai dari data lab Anda, lalu ambil action." ) # ── Biomarker list ──────────────────────────────────────────── render_section_label("BIOMARKER YANG DIANALISIS", "🧬") render_info_card( title="LONGEVITY MARKERS", icon="🎯", body=( "hs-CRP · Homocysteine · Vitamin D · HbA1c · Testosterone · Magnesium · " "Zinc · Vitamin B12 · Ferritin · ApoB · Triglycerides · HDL · " "TSH · Cortisol · DHEA-S · Fasting Insulin · dan lainnya. " "Semua dibandingkan dengan optimal longevity range Human+, " "bukan sekadar range lab standar." ), )