File size: 6,263 Bytes
e432420 b2239bd f73eaa7 b2239bd f73eaa7 78f9beb b2239bd f73eaa7 42a61a3 f73eaa7 eee2aab e432420 b2239bd 42a61a3 b2239bd f73eaa7 bfa8482 f73eaa7 bfa8482 f73eaa7 6971068 f73eaa7 bfa8482 f73eaa7 6971068 f73eaa7 b2239bd f73eaa7 6971068 f73eaa7 6971068 f73eaa7 702933a f73eaa7 702933a f73eaa7 b2239bd 78f9beb bfa8482 b2239bd | 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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | import streamlit as st
from PIL import Image
import base64
import os
# --- Load external CSS (optional) ---
def load_css(file_name: str):
try:
with open(file_name, "r", encoding="utf-8") as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
except FileNotFoundError:
st.warning("โ ๏ธ Stylesheet not found. Please ensure 'assets/styles.css' exists.")
@st.cache_data
def get_base64_img(image_path):
if not os.path.exists(image_path):
return ""
with open(image_path, "rb") as f:
return base64.b64encode(f.read()).decode()
logo_base64 = get_base64_img("assets/logo.png")
banner_base64 = get_base64_img("assets/welcome-banner.png")
def welcomeui():
# ---------- CSS Styling ----------
st.markdown(f"""
<style>
body {{
font-family: 'Segoe UI', sans-serif;
background: #f9f9fb;
}}
.hero {{
position: relative;
padding: 4rem 2rem;
text-align: center;
background: linear-gradient(to right, #8EC5FC, #E0C3FC);
color: white;
}}
.hero::before {{
content: "";
background-image: url("data:image/png;base64,{banner_base64}");
position: absolute;
opacity: 0.1;
inset: 0;
background-size: cover;
background-position: center;
}}
.badge {{
display: inline-block;
padding: 0.5rem 1rem;
background: white;
color: #333;
margin: 0.25rem;
border-radius: 10px;
font-weight: 600;
box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
transition: all 0.3s ease;
}}
.badge:hover {{
background-color: #f0f0ff;
transform: scale(1.05);
box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.2);
cursor: pointer;
}}
.card {{
background: white;
border-radius: 12px;
padding: 2rem;
margin-bottom: 2rem;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
text-align: center;
transition: all 0.3s ease;
}}
.card:hover {{
transform: scale(1.02);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
cursor: default;
}}
.card-icon {{
font-size: 2rem;
margin-bottom: 1rem;
}}
</style>
""", unsafe_allow_html=True)
# ---------- Hero Section ----------
st.markdown(f"""
<div class="hero">
<img src="data:image/png;base64,{logo_base64}" width="120" style="margin-bottom:1rem;" />
<h1>Welcome to $martKid ๐</h1>
<p style="font-size: 1.2rem; max-width: 700px; margin: auto;">
The fun and engaging platform that makes financial literacy accessible for students and easy to teach! โจ๐
</p>
<div style="margin-top:2rem;">
<div class="badge">โค๏ธ Made with love for young learners</div>
<div class="badge">๐จโ๐ซ Perfect for classrooms and individuals</div>
<div class="badge">๐ Curriculum-aligned content</div>
</div>
</div>
""", unsafe_allow_html=True)
# ---------- What is FinanceLearn ----------
st.header("โจ What is $mart Kids App?")
st.write("FinanceLearn is an interactive educational platform designed to teach financial literacy through fun, engaging activities. Perfect for both classroom learning and individual exploration! โจ")
# ---------- Demo Video Placeholder ----------
st.markdown("""
<div class="card">
<div class="card-icon">๐ฌ</div>
<h3>See How It Works! ๐</h3>
<div style="padding: 2rem; background: #f1f1f1; border-radius: 10px;">
<div class="card-icon">โถ๏ธ</div>
<p><strong>Demo Video Coming Soon! ๐ฅโจ</strong></p>
<p>Watch students learn and teachers teach with FinanceLearn</p>
</div>
</div>
""", unsafe_allow_html=True)
# ---------- Platform Features ----------
st.subheader("๐ Features")
col1, col2, col3, col4 = st.columns(4)
features = [
("๐", "Lessons", "Engaging content that makes financial literacy fun and accessible for all ages!"),
("๐ฎ", "Games", "Learn through play with our collection of money management games and challenges!"),
("๐", "Progress Tracking", "Monitor learning progress with quizzes, achievements, and detailed analytics!"),
("๐ค", "AI Assistant", "Get instant help and personalized guidance from our friendly chatbot!")
]
for col, (icon, title, desc) in zip([col1, col2, col3, col4], features):
with col:
st.markdown(f"""
<div class="card">
<div class="card-icon">{icon}</div>
<h4>{title}</h4>
<p style="font-size:0.9rem;">{desc}</p>
</div>
""", unsafe_allow_html=True)
# ---------- Get Started Section ----------
st.subheader("๐ Get Started")
left, right = st.columns(2)
with left:
st.markdown("""
<div class="card" style="background: linear-gradient(to right, #D3CCE3, #E9E4F0); color: #333;">
<div class="card-icon">๐ฆ๐ง</div>
<h3>For Students</h3>
<p>Start your financial learning journey with games, lessons, and fun challenges!</p>
</div>
""", unsafe_allow_html=True)
if st.button("๐ Start Learning!"):
st.session_state.current_page = "Student Dashboard"
st.rerun()
with right:
st.markdown("""
<div class="card" style="background: linear-gradient(to right, #30E8BF, #FF8235); color: #fff;">
<div class="card-icon">๐ฉโ๐ซ</div>
<h3>For Teachers</h3>
<p>Manage your classroom, track progress, and engage your students!</p>
</div>
""", unsafe_allow_html=True)
if st.button("๐ Teacher Dashboard"):
st.session_state.current_page = "Teacher Dashboard"
st.rerun()
def show_page():
load_css(os.path.join("assets", "styles.css"))
# โ
Only show this when user is logged in
if "user" in st.session_state and st.session_state.user:
st.success(f"Welcome back, {st.session_state.user['name']}! โ
")
else:
welcomeui() |