diff --git a/src/auth.js b/src/auth.js index 2268d45..437f1a5 100644 --- a/src/auth.js +++ b/src/auth.js @@ -33,15 +33,7 @@ export async function initAuth(engine) { return; } - // Check initial session - try { - const { data } = await authModule.getUser(); - if (data?.user) handleLogin(data.user); - } catch (e) { - console.log("Auth check failed:", e.message); - } - - // Listen for auth changes + // Listen for auth changes FIRST (catches OAuth callback) authModule.onAuthStateChange((event, session) => { if (event === "SIGNED_IN" && session?.user) { handleLogin(session.user); @@ -50,6 +42,14 @@ export async function initAuth(engine) { } }); + // Check initial session (getSession handles OAuth callback URL) + try { + const { data } = await authModule.getSession(); + if (data?.session?.user) handleLogin(data.session.user); + } catch (e) { + console.log("Auth check failed:", e.message); + } + // Attach form handlers setupAuthForms(); } diff --git a/src/main.css b/src/main.css index 7a6a176..5ce8ea6 100644 --- a/src/main.css +++ b/src/main.css @@ -1651,6 +1651,13 @@ input:checked + .toggle-slider::before { .auth-links .btn-text { font-size: 0.875rem; + color: var(--primary-color); + text-decoration: none; +} + +.auth-links .btn-text:hover { + color: var(--primary-color-dark, var(--primary-color)); + text-decoration: underline; } /* Social Login */ @@ -3633,6 +3640,19 @@ body[data-section="tailwind"] .section-progress-bar .progress-fill { color: #1aafb8; } +/* Lesson title h2 section colors */ +body[data-section="css"] #lesson-title { + color: #9163b8; +} + +body[data-section="html"] #lesson-title { + color: #d45aa0; +} + +body[data-section="tailwind"] #lesson-title { + color: #1aafb8; +} + /* Section and Reference footer - override landing-footer styles */ .section-footer.landing-footer, .reference-footer.landing-footer { diff --git a/src/supabase.js b/src/supabase.js index dc9d850..cfee362 100644 --- a/src/supabase.js +++ b/src/supabase.js @@ -41,6 +41,10 @@ export const auth = { supabase?.auth.getUser() ?? Promise.resolve({ data: { user: null }, error: null }), + getSession: () => + supabase?.auth.getSession() ?? + Promise.resolve({ data: { session: null }, error: null }), + onAuthStateChange: (callback) => supabase?.auth.onAuthStateChange(callback) ?? { data: { subscription: { unsubscribe: () => {} } } },