Danialebrat's picture
deploying the new UI
dcdaf35
"""
Brand theming for the AI Messaging System Visualization Tool.
"""
import streamlit as st
BRAND_CONFIG = {
"drumeo": {
"color": "#E84545",
"light": "#FDEAEA",
"emoji": "πŸ₯",
"label": "Drumeo",
},
"pianote": {
"color": "#4A90D9",
"light": "#EAF3FC",
"emoji": "🎹",
"label": "Pianote",
},
"guitareo": {
"color": "#F5A623",
"light": "#FEF6E7",
"emoji": "🎸",
"label": "Guitareo",
},
"singeo": {
"color": "#7B68EE",
"light": "#F0EEFF",
"emoji": "🎀",
"label": "Singeo",
},
"playbass": {
"color": "#3DAA5C",
"light": "#E8F7ED",
"emoji": "🎸",
"label": "Playbass",
},
"all": {
"color": "#555555",
"light": "#F5F5F5",
"emoji": "🎡",
"label": "All Brands",
},
}
CAMPAIGN_LABELS = {
"dailyPush_dailyStreak": "Daily Streak",
"dailyPush_weeklyStreak": "Weekly Streak",
"dailyPush_noStreak": "No Streak (Re-engagement)",
"all": "All Campaigns",
}
ALL_BRANDS = ["all", "drumeo", "pianote", "guitareo", "singeo", "playbass"]
ALL_CAMPAIGNS = [
"all",
"dailyPush_dailyStreak",
"dailyPush_weeklyStreak",
"dailyPush_noStreak",
]
# Scenarios per campaign, applied client-side after data load.
# Detection uses the RECOMMENDATION column in DAILY_PUSH_MESSAGES.
# For weeklyStreak: RECOMMENDATION == 'for_you' β†’ no_practice_this_week
CAMPAIGN_SCENARIOS = {
"all": [],
"dailyPush_dailyStreak": [], # single scenario, no sub-filter needed
"dailyPush_weeklyStreak": [
("all", "All"),
("practiced_this_week", "Practiced This Week"),
("no_practice_this_week", "No Practice This Week"),
],
"dailyPush_noStreak": [],
}
def get_scenarios(campaign: str) -> list:
"""Return scenario (key, label) pairs for a given campaign."""
return CAMPAIGN_SCENARIOS.get(campaign, [])
def detect_scenario(recommendation_value) -> str:
"""
Detect the weekly-streak sub-scenario from the RECOMMENDATION column.
RECOMMENDATION == 'for_you' β†’ user hasn't practiced this week
anything else β†’ user has practiced this week
"""
s = str(recommendation_value or "").strip().lower()
return "no_practice_this_week" if s == "for_you" else "practiced_this_week"
def get_brand(brand: str) -> dict:
return BRAND_CONFIG.get(brand.lower() if brand else "all", BRAND_CONFIG["all"])
def get_campaign_label(campaign: str) -> str:
return CAMPAIGN_LABELS.get(campaign, campaign)
def inject_global_css():
"""Inject shared CSS into the Streamlit app."""
st.markdown(
"""
<style>
.msg-card {
border: 1px solid #e0e0e0;
border-radius: 12px;
padding: 20px;
margin-bottom: 18px;
background: #ffffff;
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.msg-preview {
background: #f4f6f8;
border-left: 4px solid #aaa;
border-radius: 6px;
padding: 12px 16px;
margin: 10px 0;
}
.msg-header-text {
font-size: 15px;
font-weight: 700;
margin: 0 0 5px 0;
color: #1a1a1a;
}
.msg-body-text {
font-size: 14px;
color: #444;
margin: 0;
}
.user-meta {
font-size: 13px;
color: #555;
margin: 3px 0;
}
.streak-badge {
display: inline-block;
background: #fff3cd;
border: 1px solid #ffc107;
border-radius: 20px;
padding: 2px 10px;
font-size: 12px;
font-weight: 600;
margin-right: 6px;
}
.section-label {
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: #888;
margin-bottom: 4px;
}
</style>
""",
unsafe_allow_html=True,
)