File size: 4,160 Bytes
dcdaf35 | 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | """
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,
) |