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"", 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"""
""", unsafe_allow_html=True)
# ---------- Hero Section ----------
st.markdown(f"""
Welcome to $martKid 💖
The fun and engaging platform that makes financial literacy accessible for students and easy to teach! ✨🌟
❤️ Made with love for young learners
👨🏫 Perfect for classrooms and individuals
📚 Curriculum-aligned content
""", 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("""
🎬
See How It Works! 🌈
▶️
Demo Video Coming Soon! 🎥✨
Watch students learn and teachers teach with FinanceLearn
""", 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"""
""", unsafe_allow_html=True)
# ---------- Get Started Section ----------
st.subheader("🎓 Get Started")
left, right = st.columns(2)
with left:
st.markdown("""
👦👧
For Students
Start your financial learning journey with games, lessons, and fun challenges!
""", unsafe_allow_html=True)
if st.button("🚀 Start Learning!"):
st.session_state.current_page = "Student Dashboard"
st.rerun()
with right:
st.markdown("""
👩🏫
For Teachers
Manage your classroom, track progress, and engage your students!
""", 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()