lanna_lalala;- commited on
Commit
f73eaa7
ยท
1 Parent(s): 6971068

welcome css try

Browse files
Files changed (1) hide show
  1. phase/welcome.py +146 -138
phase/welcome.py CHANGED
@@ -1,154 +1,162 @@
1
  # phase/Welcome.py
2
  import streamlit as st
3
  from PIL import Image
 
 
 
 
 
 
4
 
5
  def show_page():
6
  st.title("๐Ÿ’น Welcome to $mart Kids App")
 
 
7
  if st.session_state.user:
8
  st.success(f"Welcome back, {st.session_state.user['name']}! โœ…")
9
- st.write(
10
- "This app helps you improve your **financial education and numeracy skills**. \n"
11
- "๐Ÿ‘‰ Use the sidebar to **Signup** or **Login** to get started."
12
- )
13
-
14
- # Load images
15
- logo = Image.open("assets/logo.png")
16
- banner = "assets/welcome-banner.png" # used as CSS background
17
-
18
- # Dummy role for now (could be replaced with session state or login)
19
- role = st.success(f"Welcome back, {st.session_state.user['name']}! โœ…")
20
-
21
- # ---------- CSS Styling ----------
22
- st.markdown("""
23
- <style>
24
- body {
25
- font-family: 'Segoe UI', sans-serif;
26
- background: #f9f9fb;
27
- }
28
-
29
- .hero {
30
- position: relative;
31
- padding: 4rem 2rem;
32
- text-align: center;
33
- background: linear-gradient(to right, #8EC5FC, #E0C3FC);
34
- color: white;
35
- }
36
-
37
- .hero::before {
38
- content: "";
39
- background-image: url("data:image/png;base64, """ + banner + """");
40
- position: absolute;
41
- opacity: 0.1;
42
- inset: 0;
43
- background-size: cover;
44
- background-position: center;
45
- }
46
-
47
- .badge {
48
- display: inline-block;
49
- padding: 0.5rem 1rem;
50
- background: white;
51
- color: #333;
52
- margin: 0.25rem;
53
- border-radius: 10px;
54
- font-weight: 600;
55
- box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
56
- }
57
-
58
- .card {
59
- background: white;
60
- border-radius: 12px;
61
- padding: 2rem;
62
- margin-bottom: 2rem;
63
- box-shadow: 0 5px 15px rgba(0,0,0,0.1);
64
- text-align: center;
65
- }
66
-
67
- .card-icon {
68
- font-size: 2rem;
69
- margin-bottom: 1rem;
70
- }
71
- </style>
72
- """, unsafe_allow_html=True)
73
-
74
- # ---------- Hero Section ----------
75
- st.markdown(f"""
76
- <div class="hero">
77
- <img src="data:image/png;base64,{logo}" width="120" style="margin-bottom:1rem;" />
78
- <h1>Welcome to FinanceLearn! ๐Ÿ’–</h1>
79
- <p style="font-size: 1.2rem; max-width: 700px; margin: auto;">
80
- The fun and engaging platform that makes financial literacy accessible for students and easy to teach! โœจ๐ŸŒŸ
81
- </p>
82
- <div style="margin-top:2rem;">
83
- <div class="badge">โค๏ธ Made with love for young learners</div>
84
- <div class="badge">๐Ÿ‘จโ€๐Ÿซ Perfect for classrooms and individuals</div>
85
- <div class="badge">๐Ÿ“š Curriculum-aligned content</div>
86
- </div>
87
- </div>
88
- """, unsafe_allow_html=True)
89
-
90
- # ---------- What is FinanceLearn ----------
91
- st.header("โœจ What is FinanceLearn? ๐ŸŽˆ")
92
- 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! โœจ")
93
-
94
- # ---------- Demo Video Placeholder ----------
95
- st.markdown("""
96
- <div class="card">
97
- <div class="card-icon">๐ŸŽฌ</div>
98
- <h3>See How It Works! ๐ŸŒˆ</h3>
99
- <div style="padding: 2rem; background: #f1f1f1; border-radius: 10px;">
100
- <div class="card-icon">โ–ถ๏ธ</div>
101
- <p><strong>Demo Video Coming Soon! ๐ŸŽฅโœจ</strong></p>
102
- <p>Watch students learn and teachers teach with FinanceLearn</p>
103
- </div>
104
- </div>
105
- """, unsafe_allow_html=True)
106
-
107
- # ---------- Platform Features ----------
108
- st.subheader("๐Ÿš€ Features")
109
- col1, col2, col3, col4 = st.columns(4)
110
-
111
- features = [
112
- ("๐Ÿ“–", "Interactive Lessons", "Engaging content that makes financial literacy fun and accessible for all ages!"),
113
- ("๐ŸŽฎ", "Educational Games", "Learn through play with our collection of money management games and challenges!"),
114
- ("๐Ÿ†", "Progress Tracking", "Monitor learning progress with quizzes, achievements, and detailed analytics!"),
115
- ("๐Ÿค–", "AI Assistant", "Get instant help and personalized guidance from our friendly chatbot!")
116
- ]
117
-
118
- for col, (icon, title, desc) in zip([col1, col2, col3, col4], features):
119
- with col:
120
- st.markdown(f"""
121
- <div class="card">
122
- <div class="card-icon">{icon}</div>
123
- <h4>{title}</h4>
124
- <p style="font-size:0.9rem;">{desc}</p>
125
- </div>
126
- """, unsafe_allow_html=True)
127
-
128
- # ---------- Get Started Section ----------
129
- st.subheader("๐ŸŽ“ Get Started")
130
-
131
- left, right = st.columns(2)
132
 
133
- with left:
134
- st.markdown("""
135
- <div class="card" style="background: linear-gradient(to right, #D3CCE3, #E9E4F0); color: #333;">
136
- <div class="card-icon">๐Ÿ‘ฆ๐Ÿ‘ง</div>
137
- <h3>For Students</h3>
138
- <p>Start your financial learning journey with games, lessons, and fun challenges!</p>
 
 
 
 
 
 
 
139
  </div>
140
  """, unsafe_allow_html=True)
141
- if st.button("๐Ÿš€ Start Learning!"):
142
- st.success("Redirecting to Student Dashboard...")
143
 
144
- with right:
 
 
 
 
145
  st.markdown("""
146
- <div class="card" style="background: linear-gradient(to right, #30E8BF, #FF8235); color: #fff;">
147
- <div class="card-icon">๐Ÿ‘ฉโ€๐Ÿซ</div>
148
- <h3>For Teachers</h3>
149
- <p>Manage your classroom, track progress, and engage your students with financial education!</p>
 
 
 
 
150
  </div>
151
  """, unsafe_allow_html=True)
152
- if st.button("๐Ÿ“Š Teacher Dashboard"):
153
- st.success("Redirecting to Teacher Dashboard...")
154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # phase/Welcome.py
2
  import streamlit as st
3
  from PIL import Image
4
+ import base64
5
+
6
+ def get_base64_img(image_path):
7
+ with open(image_path, "rb") as f:
8
+ data = f.read()
9
+ return base64.b64encode(data).decode()
10
 
11
  def show_page():
12
  st.title("๐Ÿ’น Welcome to $mart Kids App")
13
+
14
+ # Display login status if user is logged in
15
  if st.session_state.user:
16
  st.success(f"Welcome back, {st.session_state.user['name']}! โœ…")
17
+ else:
18
+ st.write(
19
+ "This app helps you improve your **financial education and numeracy skills**. \n"
20
+ "๐Ÿ‘‰ Use the sidebar to **Signup** or **Login** to get started."
21
+ )
22
+
23
+ # Load logo and banner as base64
24
+ logo_path = "assets/logo.png"
25
+ banner_path = "assets/welcome-banner.png"
26
+ logo_base64 = get_base64_img(logo_path)
27
+ banner_base64 = get_base64_img(banner_path)
28
+
29
+ # ---------- CSS Styling ----------
30
+ st.markdown(f"""
31
+ <style>
32
+ body {{
33
+ font-family: 'Segoe UI', sans-serif;
34
+ background: #f9f9fb;
35
+ }}
36
+
37
+ .hero {{
38
+ position: relative;
39
+ padding: 4rem 2rem;
40
+ text-align: center;
41
+ background: linear-gradient(to right, #8EC5FC, #E0C3FC);
42
+ color: white;
43
+ }}
44
+
45
+ .hero::before {{
46
+ content: "";
47
+ background-image: url("data:image/png;base64,{banner_base64}");
48
+ position: absolute;
49
+ opacity: 0.1;
50
+ inset: 0;
51
+ background-size: cover;
52
+ background-position: center;
53
+ }}
54
+
55
+ .badge {{
56
+ display: inline-block;
57
+ padding: 0.5rem 1rem;
58
+ background: white;
59
+ color: #333;
60
+ margin: 0.25rem;
61
+ border-radius: 10px;
62
+ font-weight: 600;
63
+ box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
64
+ }}
65
+
66
+ .card {{
67
+ background: white;
68
+ border-radius: 12px;
69
+ padding: 2rem;
70
+ margin-bottom: 2rem;
71
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
72
+ text-align: center;
73
+ }}
74
+
75
+ .card-icon {{
76
+ font-size: 2rem;
77
+ margin-bottom: 1rem;
78
+ }}
79
+ </style>
80
+ """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
+ # ---------- Hero Section ----------
83
+ st.markdown(f"""
84
+ <div class="hero">
85
+ <img src="data:image/png;base64,{logo_base64}" width="120" style="margin-bottom:1rem;" />
86
+ <h1>Welcome to FinanceLearn! ๐Ÿ’–</h1>
87
+ <p style="font-size: 1.2rem; max-width: 700px; margin: auto;">
88
+ The fun and engaging platform that makes financial literacy accessible for students and easy to teach! โœจ๐ŸŒŸ
89
+ </p>
90
+ <div style="margin-top:2rem;">
91
+ <div class="badge">โค๏ธ Made with love for young learners</div>
92
+ <div class="badge">๐Ÿ‘จโ€๐Ÿซ Perfect for classrooms and individuals</div>
93
+ <div class="badge">๐Ÿ“š Curriculum-aligned content</div>
94
+ </div>
95
  </div>
96
  """, unsafe_allow_html=True)
 
 
97
 
98
+ # ---------- What is FinanceLearn ----------
99
+ st.header("โœจ What is FinanceLearn? ๐ŸŽˆ")
100
+ 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! โœจ")
101
+
102
+ # ---------- Demo Video Placeholder ----------
103
  st.markdown("""
104
+ <div class="card">
105
+ <div class="card-icon">๐ŸŽฌ</div>
106
+ <h3>See How It Works! ๐ŸŒˆ</h3>
107
+ <div style="padding: 2rem; background: #f1f1f1; border-radius: 10px;">
108
+ <div class="card-icon">โ–ถ๏ธ</div>
109
+ <p><strong>Demo Video Coming Soon! ๐ŸŽฅโœจ</strong></p>
110
+ <p>Watch students learn and teachers teach with FinanceLearn</p>
111
+ </div>
112
  </div>
113
  """, unsafe_allow_html=True)
 
 
114
 
115
+ # ---------- Platform Features ----------
116
+ st.subheader("๐Ÿš€ Features")
117
+ col1, col2, col3, col4 = st.columns(4)
118
+
119
+ features = [
120
+ ("๐Ÿ“–", "Interactive Lessons", "Engaging content that makes financial literacy fun and accessible for all ages!"),
121
+ ("๐ŸŽฎ", "Educational Games", "Learn through play with our collection of money management games and challenges!"),
122
+ ("๐Ÿ†", "Progress Tracking", "Monitor learning progress with quizzes, achievements, and detailed analytics!"),
123
+ ("๐Ÿค–", "AI Assistant", "Get instant help and personalized guidance from our friendly chatbot!")
124
+ ]
125
+
126
+ for col, (icon, title, desc) in zip([col1, col2, col3, col4], features):
127
+ with col:
128
+ st.markdown(f"""
129
+ <div class="card">
130
+ <div class="card-icon">{icon}</div>
131
+ <h4>{title}</h4>
132
+ <p style="font-size:0.9rem;">{desc}</p>
133
+ </div>
134
+ """, unsafe_allow_html=True)
135
+
136
+ # ---------- Get Started Section ----------
137
+ st.subheader("๐ŸŽ“ Get Started")
138
+ left, right = st.columns(2)
139
+
140
+ with left:
141
+ st.markdown("""
142
+ <div class="card" style="background: linear-gradient(to right, #D3CCE3, #E9E4F0); color: #333;">
143
+ <div class="card-icon">๐Ÿ‘ฆ๐Ÿ‘ง</div>
144
+ <h3>For Students</h3>
145
+ <p>Start your financial learning journey with games, lessons, and fun challenges!</p>
146
+ </div>
147
+ """, unsafe_allow_html=True)
148
+ if st.button("๐Ÿš€ Start Learning!"):
149
+ st.session_state.current_page = "Student Dashboard"
150
+ st.rerun()
151
+
152
+ with right:
153
+ st.markdown("""
154
+ <div class="card" style="background: linear-gradient(to right, #30E8BF, #FF8235); color: #fff;">
155
+ <div class="card-icon">๐Ÿ‘ฉโ€๐Ÿซ</div>
156
+ <h3>For Teachers</h3>
157
+ <p>Manage your classroom, track progress, and engage your students with financial education!</p>
158
+ </div>
159
+ """, unsafe_allow_html=True)
160
+ if st.button("๐Ÿ“Š Teacher Dashboard"):
161
+ st.session_state.current_page = "Teacher Dashboard"
162
+ st.rerun()