-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
42 lines (36 loc) Β· 1.75 KB
/
app.py
File metadata and controls
42 lines (36 loc) Β· 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Top-level Streamlit setup & navigation logic
import streamlit as st
import datetime
from newsletterBuilder import create_newsletter_builder
from analytics_dashboard import create_analytics_dashboard
# Set Streamlit page config
st.set_page_config(page_title="SimPPL Newsletter & Analytics", page_icon="π°", layout="wide")
# Page navigation
if 'current_page' not in st.session_state:
st.session_state.current_page = 'newsletter'
# Sidebar
with st.sidebar:
st.header("π Navigation")
page = st.radio("Select Page", ["π° Newsletter Builder", "π Analytics Dashboard"], key="page_selector")
if page == "π° Newsletter Builder":
st.session_state.current_page = 'newsletter'
st.divider()
st.subheader("Settings")
today = datetime.date.today()
selected_month = st.selectbox("Select Month", range(1, 13), index=today.month - 1,
format_func=lambda x: datetime.date(2000, x, 1).strftime('%B'))
selected_year = st.number_input("Select Year", min_value=2020, max_value=2035, value=today.year)
st.session_state.selected_month = selected_month
st.session_state.selected_year = selected_year
if st.button("β Add Highlight"):
st.session_state.highlights.append({'title': '', 'description': '', 'link': '', 'image': ''})
if st.button("β Remove Highlight") and len(st.session_state.get('highlights', [])) > 1:
st.session_state.highlights.pop()
else:
st.session_state.current_page = 'analytics'
st.info("π‘ View detailed analytics of your newsletter link clicks")
# Main content switch
if st.session_state.current_page == 'analytics':
create_analytics_dashboard()
else:
create_newsletter_builder()