lanna_lalala;- commited on
Commit Β·
b2239bd
1
Parent(s): 42a61a3
welcome css try
Browse files- phase/welcome.py +16 -22
phase/welcome.py
CHANGED
|
@@ -1,34 +1,19 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import
|
| 3 |
import base64
|
|
|
|
| 4 |
|
|
|
|
| 5 |
def get_base64_img(image_path):
|
| 6 |
if not os.path.exists(image_path):
|
| 7 |
-
print(f"[WARNING] Missing image: {image_path}")
|
| 8 |
return ""
|
| 9 |
with open(image_path, "rb") as f:
|
| 10 |
return base64.b64encode(f.read()).decode()
|
| 11 |
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
def
|
| 14 |
-
st.title("πΉ Welcome to $mart Kids App")
|
| 15 |
-
|
| 16 |
-
# Check if 'user' exists before using it
|
| 17 |
-
if "user" in st.session_state and st.session_state.user:
|
| 18 |
-
st.success(f"Welcome back, {st.session_state.user['name']}! β
")
|
| 19 |
-
else:
|
| 20 |
-
st.write(
|
| 21 |
-
"This app helps you improve your **financial education and numeracy skills**. \n"
|
| 22 |
-
"π Use the sidebar to **Signup** or **Login** to get started."
|
| 23 |
-
)
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
# Load logo and banner as base64
|
| 27 |
-
logo_path = "assets/logo.png"
|
| 28 |
-
banner_path = "assets/welcome-banner.png"
|
| 29 |
-
logo_base64 = get_base64_img(logo_path)
|
| 30 |
-
banner_base64 = get_base64_img(banner_path)
|
| 31 |
-
|
| 32 |
# ---------- CSS Styling ----------
|
| 33 |
st.markdown(f"""
|
| 34 |
<style>
|
|
@@ -99,7 +84,7 @@ def show_page():
|
|
| 99 |
""", unsafe_allow_html=True)
|
| 100 |
|
| 101 |
# ---------- What is FinanceLearn ----------
|
| 102 |
-
st.header("β¨ What is
|
| 103 |
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! β¨")
|
| 104 |
|
| 105 |
# ---------- Demo Video Placeholder ----------
|
|
@@ -163,3 +148,12 @@ def show_page():
|
|
| 163 |
if st.button("π Teacher Dashboard"):
|
| 164 |
st.session_state.current_page = "Teacher Dashboard"
|
| 165 |
st.rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from PIL import Image
|
| 3 |
import base64
|
| 4 |
+
import os
|
| 5 |
|
| 6 |
+
@st.cache_data
|
| 7 |
def get_base64_img(image_path):
|
| 8 |
if not os.path.exists(image_path):
|
|
|
|
| 9 |
return ""
|
| 10 |
with open(image_path, "rb") as f:
|
| 11 |
return base64.b64encode(f.read()).decode()
|
| 12 |
|
| 13 |
+
logo_base64 = get_base64_img("assets/logo.png")
|
| 14 |
+
banner_base64 = get_base64_img("assets/welcome-banner.png")
|
| 15 |
|
| 16 |
+
def welcomeui():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# ---------- CSS Styling ----------
|
| 18 |
st.markdown(f"""
|
| 19 |
<style>
|
|
|
|
| 84 |
""", unsafe_allow_html=True)
|
| 85 |
|
| 86 |
# ---------- What is FinanceLearn ----------
|
| 87 |
+
st.header("β¨ What is $mart Kids App?")
|
| 88 |
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! β¨")
|
| 89 |
|
| 90 |
# ---------- Demo Video Placeholder ----------
|
|
|
|
| 148 |
if st.button("π Teacher Dashboard"):
|
| 149 |
st.session_state.current_page = "Teacher Dashboard"
|
| 150 |
st.rerun()
|
| 151 |
+
|
| 152 |
+
def show_page():
|
| 153 |
+
st.title("πΉ Welcome to $mart Kids App")
|
| 154 |
+
|
| 155 |
+
# β
Only show this when user is logged in
|
| 156 |
+
if "user" in st.session_state and st.session_state.user:
|
| 157 |
+
st.success(f"Welcome back, {st.session_state.user['name']}! β
")
|
| 158 |
+
else:
|
| 159 |
+
welcomeui()
|