45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
|
|
# ui/streamlit_app/pages/EmailViewer.py
|
||
|
|
import streamlit as st
|
||
|
|
|
||
|
|
def fetch_emails():
|
||
|
|
# TODO: Replace with real DB call
|
||
|
|
return [
|
||
|
|
{
|
||
|
|
"Subject": "Welcome to our platform!",
|
||
|
|
"From": "noreply@example.com",
|
||
|
|
"Summary": "Intro to the platform and features.",
|
||
|
|
"Labels": ["promo"],
|
||
|
|
"Date": "2025-03-27",
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"Subject": "Your invoice is ready",
|
||
|
|
"From": "billing@example.com",
|
||
|
|
"Summary": "Invoice for your recent purchase.",
|
||
|
|
"Labels": ["finance"],
|
||
|
|
"Date": "2025-03-25",
|
||
|
|
},
|
||
|
|
]
|
||
|
|
|
||
|
|
def run():
|
||
|
|
st.title("📧 Email Viewer")
|
||
|
|
st.markdown("A simple, readable inbox-style layout.")
|
||
|
|
|
||
|
|
st.markdown("## 📬 Emails")
|
||
|
|
|
||
|
|
emails = fetch_emails()
|
||
|
|
|
||
|
|
for email in emails:
|
||
|
|
with st.container():
|
||
|
|
st.markdown(f"### {email['Subject']}")
|
||
|
|
col1, col2 = st.columns([4, 1])
|
||
|
|
with col1:
|
||
|
|
st.markdown(f"**From:** {email['From']}")
|
||
|
|
st.markdown(f"*{email['Summary']}*")
|
||
|
|
st.markdown("Labels: " + " ".join([f"`{label}`" for label in email["Labels"]]))
|
||
|
|
with col2:
|
||
|
|
st.markdown(f"📅 {email['Date']}")
|
||
|
|
|
||
|
|
st.markdown("---")
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
run()
|