-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlanding_new.py
More file actions
501 lines (431 loc) Β· 16 KB
/
landing_new.py
File metadata and controls
501 lines (431 loc) Β· 16 KB
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
"""
Premium Landing Page - Study Buddy
Modern, minimal, Apple-inspired design with premium SaaS aesthetics
"""
import streamlit as st
from auth import auth_db, is_authenticated, get_current_user
from oauth_handler import OAuthHandler
def show_landing_page():
"""Display premium animated landing page"""
# Page configuration
st.set_page_config(
page_title="Study Buddy - Where Intelligence Meets Learning",
page_icon="π§ ",
layout="wide",
initial_sidebar_state="collapsed"
)
# Premium CSS styling
premium_css = """
<style>
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
overflow: hidden;
}
/* Premium dark background with gradient */
.stApp {
background: linear-gradient(135deg, #0f0a1a 0%, #1a0f2e 25%, #2d1b4e 50%, #1a0f2e 75%, #0f0a1a 100%) !important;
background-size: 400% 400% !important;
animation: premiumGradient 25s ease infinite !important;
position: relative;
min-height: 100vh;
overflow-y: auto;
}
@keyframes premiumGradient {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
/* Premium container */
.premium-hero {
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
position: relative;
padding: 40px 20px;
overflow: hidden;
}
/* Animated background elements */
.glow-background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.6;
pointer-events: none;
}
.glow-orb {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.5;
}
.glow-orb-1 {
width: 400px;
height: 400px;
background: radial-gradient(circle, #ec4899 0%, #d946ef 100%);
top: -100px;
left: -100px;
animation: float-slow 20s ease-in-out infinite;
}
.glow-orb-2 {
width: 350px;
height: 350px;
background: radial-gradient(circle, #f97316 0%, #ec4899 100%);
top: 50%;
right: -150px;
animation: float-slow-reverse 25s ease-in-out infinite;
}
.glow-orb-3 {
width: 300px;
height: 300px;
background: radial-gradient(circle, #a855f7 0%, #6366f1 100%);
bottom: -50px;
left: 50%;
animation: float-slow 22s ease-in-out infinite;
}
@keyframes float-slow {
0%, 100% { transform: translate(0, 0); }
25% { transform: translate(30px, -40px); }
50% { transform: translate(-20px, -80px); }
75% { transform: translate(-40px, -20px); }
}
@keyframes float-slow-reverse {
0%, 100% { transform: translate(0, 0); }
25% { transform: translate(-30px, 40px); }
50% { transform: translate(20px, 80px); }
75% { transform: translate(40px, 20px); }
}
/* Cherry blossom particles */
.petal {
position: absolute;
pointer-events: none;
}
@keyframes petal-fall {
0% {
opacity: 0;
transform: translateY(0) rotateZ(0deg);
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
transform: translateY(100vh) rotateZ(360deg);
}
}
/* Premium content wrapper */
.hero-content {
position: relative;
z-index: 10;
text-align: center;
max-width: 900px;
margin: 0 auto;
}
/* Premium headline */
.hero-headline {
font-family: 'Playfair Display', serif;
font-size: clamp(48px, 12vw, 96px);
font-weight: 700;
letter-spacing: -2px;
background: linear-gradient(135deg, #ffffff 0%, #f0f0ff 50%, #fca5a5 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 24px;
animation: headline-fade-in 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
line-height: 1.1;
}
@keyframes headline-fade-in {
0% {
opacity: 0;
transform: translateY(30px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
/* Premium tagline */
.hero-tagline {
font-family: 'Space Grotesk', sans-serif;
font-size: clamp(20px, 5vw, 32px);
font-weight: 400;
color: rgba(255, 255, 255, 0.8);
letter-spacing: 1.5px;
margin-bottom: 48px;
animation: tagline-fade-in 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
text-transform: uppercase;
}
@keyframes tagline-fade-in {
0% {
opacity: 0;
transform: translateY(30px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
/* Glassmorphism card */
.glass-card {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 20px;
padding: 48px 40px;
max-width: 500px;
margin: 0 auto;
box-shadow: 0 20px 80px rgba(236, 72, 153, 0.15);
animation: card-fade-in 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}
@keyframes card-fade-in {
0% {
opacity: 0;
transform: translateY(40px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
/* Premium buttons */
.premium-btn {
display: inline-block;
width: 100%;
padding: 16px 32px;
margin: 12px 0;
font-family: 'Space Grotesk', sans-serif;
font-size: 16px;
font-weight: 600;
letter-spacing: 0.5px;
border: none;
border-radius: 12px;
cursor: pointer;
transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
text-decoration: none;
text-align: center;
position: relative;
overflow: hidden;
}
.premium-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0.1);
transition: left 0.4s ease;
z-index: 0;
}
.premium-btn:hover::before {
left: 100%;
}
.premium-btn span {
position: relative;
z-index: 1;
}
/* Google button */
.btn-google {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
color: white;
box-shadow: 0 12px 40px rgba(79, 172, 254, 0.3);
}
.btn-google:hover {
transform: translateY(-4px);
box-shadow: 0 20px 60px rgba(79, 172, 254, 0.5);
}
/* Create account button */
.btn-create {
background: linear-gradient(135deg, #d946ef 0%, #ec4899 100%);
color: white;
box-shadow: 0 12px 40px rgba(217, 70, 239, 0.3);
}
.btn-create:hover {
transform: translateY(-4px);
box-shadow: 0 20px 60px rgba(217, 70, 239, 0.5);
}
/* Sign in/up text button */
.text-button {
background: transparent;
color: rgba(255, 255, 255, 0.7);
border: 1px solid rgba(255, 255, 255, 0.3);
margin-top: 16px;
font-weight: 500;
}
.text-button:hover {
background: rgba(255, 255, 255, 0.1);
color: white;
border-color: rgba(255, 255, 255, 0.5);
}
/* Divider */
.divider {
text-align: center;
margin: 24px 0;
color: rgba(255, 255, 255, 0.5);
font-size: 14px;
font-weight: 500;
letter-spacing: 1px;
}
.divider::before,
.divider::after {
content: '';
display: inline-block;
width: 50px;
height: 1px;
background: rgba(255, 255, 255, 0.2);
margin: 0 12px;
vertical-align: middle;
}
/* Responsive */
@media (max-width: 768px) {
.glass-card {
padding: 32px 24px;
}
.hero-headline {
font-size: 48px;
}
.hero-tagline {
font-size: 18px;
margin-bottom: 32px;
}
}
</style>
"""
st.markdown(premium_css, unsafe_allow_html=True)
# Initialize session state
if 'show_login' not in st.session_state:
st.session_state.show_login = False
if 'show_signup' not in st.session_state:
st.session_state.show_signup = False
# Hero HTML
hero_html = """
<div class="premium-hero">
<div class="glow-background">
<div class="glow-orb glow-orb-1"></div>
<div class="glow-orb glow-orb-2"></div>
<div class="glow-orb glow-orb-3"></div>
</div>
<div class="hero-content">
<h1 class="hero-headline">Welcome to Study Buddy</h1>
<p class="hero-tagline">Where Intelligence Meets Learning</p>
</div>
</div>
"""
st.markdown(hero_html, unsafe_allow_html=True)
# Main content area
col1, col2, col3 = st.columns([1, 1.2, 1])
with col2:
# Check if showing login or signup form
if not st.session_state.show_login and not st.session_state.show_signup:
# Show CTA buttons
st.markdown('<div class="glass-card">', unsafe_allow_html=True)
# Google button
google_auth_url = OAuthHandler.get_google_auth_url()
if google_auth_url:
st.markdown(f'''
<a href="{google_auth_url}" target="_blank" class="premium-btn btn-google">
<span>π΅ Continue with Google</span>
</a>
''', unsafe_allow_html=True)
st.markdown('<div class="divider">Or</div>', unsafe_allow_html=True)
# Sign in/up buttons
btn_col1, btn_col2 = st.columns(2, gap="small")
with btn_col1:
if st.button("Sign In", key="cta_signin", use_container_width=True):
st.session_state.show_login = True
st.rerun()
with btn_col2:
if st.button("Create Account", key="cta_create", use_container_width=True):
st.session_state.show_signup = True
st.rerun()
st.markdown('</div>', unsafe_allow_html=True)
# Login Form
elif st.session_state.show_login:
st.markdown('<div class="glass-card">', unsafe_allow_html=True)
st.markdown("<h2 style='color: white; font-family: Space Grotesk; font-size: 28px; margin-bottom: 24px;'>Sign In</h2>", unsafe_allow_html=True)
login_email = st.text_input("Email", placeholder="you@example.com", key="login_email")
login_password = st.text_input("Password", type="password", placeholder="β’β’β’β’β’β’β’β’", key="login_password")
if st.button("Sign In", use_container_width=True, key="login_submit"):
if not login_email or not login_password:
st.error("β Please fill in all fields")
else:
result = auth_db.login_user(login_email, login_password)
if result["success"]:
st.session_state.authenticated = True
st.session_state.user_id = result["user_id"]
st.session_state.user_name = result["name"]
st.session_state.user_email = login_email
st.session_state.session_token = result["session_token"]
st.success("β
Login successful!")
st.rerun()
else:
st.error("β " + result["error"])
st.markdown("<p style='text-align: center; color: rgba(255,255,255,0.7); margin-top: 20px; font-size: 14px;'>Don't have an account? </p>", unsafe_allow_html=True)
col_a, col_b = st.columns([1, 1])
with col_a:
if st.button("Sign Up", use_container_width=True, key="to_signup"):
st.session_state.show_login = False
st.session_state.show_signup = True
st.rerun()
with col_b:
if st.button("β Back", use_container_width=True, key="back_login"):
st.session_state.show_login = False
st.rerun()
st.markdown('</div>', unsafe_allow_html=True)
# Sign Up Form
elif st.session_state.show_signup:
st.markdown('<div class="glass-card">', unsafe_allow_html=True)
st.markdown("<h2 style='color: white; font-family: Space Grotesk; font-size: 28px; margin-bottom: 24px;'>Create Account</h2>", unsafe_allow_html=True)
signup_name = st.text_input("Full Name", placeholder="John Doe", key="signup_name")
signup_email = st.text_input("Email", placeholder="you@example.com", key="signup_email")
signup_password = st.text_input("Password", type="password", placeholder="β’β’β’β’β’β’β’β’", key="signup_password")
st.markdown("""
<div style='background: rgba(124, 58, 237, 0.15); border: 1px solid rgba(124, 58, 237, 0.3); border-radius: 8px; padding: 10px 15px; margin: 8px 0; font-size: 12px; color: rgba(255, 255, 255, 0.85);'>
<strong>Password Requirements:</strong><br>
β Min 8 characters β 1 uppercase (A-Z) β 1 lowercase (a-z)<br>
β 1 number (0-9) β 1 special char (!@#$%^&*)
</div>
""", unsafe_allow_html=True)
signup_confirm = st.text_input("Confirm Password", type="password", placeholder="β’β’β’β’β’β’β’β’", key="signup_confirm")
if st.button("Create Account", use_container_width=True, key="signup_submit"):
if not signup_name or not signup_email or not signup_password or not signup_confirm:
st.error("β Please fill in all fields")
elif signup_password != signup_confirm:
st.error("β Passwords do not match")
else:
result = auth_db.register_user(signup_name, signup_email, signup_password)
if result["success"]:
st.success("β
Account created! Please sign in.")
st.session_state.show_signup = False
st.session_state.show_login = True
st.rerun()
else:
st.error("β " + result["error"])
st.markdown("<p style='text-align: center; color: rgba(255,255,255,0.7); margin-top: 20px; font-size: 14px;'>Already have an account? </p>", unsafe_allow_html=True)
col_a, col_b = st.columns([1, 1])
with col_a:
if st.button("Sign In", use_container_width=True, key="to_signin"):
st.session_state.show_signup = False
st.session_state.show_login = True
st.rerun()
with col_b:
if st.button("β Back", use_container_width=True, key="back_signup"):
st.session_state.show_signup = False
st.rerun()
st.markdown('</div>', unsafe_allow_html=True)
if __name__ == "__main__":
show_landing_page()