Skip to content

fix: Choose Avatar responsive on mobile (Fixes #35)#44

Open
AKSHEXXXX wants to merge 1 commit into
ZenYukti:mainfrom
AKSHEXXXX:fix/issue-35-avatar-mobile-responsive
Open

fix: Choose Avatar responsive on mobile (Fixes #35)#44
AKSHEXXXX wants to merge 1 commit into
ZenYukti:mainfrom
AKSHEXXXX:fix/issue-35-avatar-mobile-responsive

Conversation

@AKSHEXXXX
Copy link
Copy Markdown

Summary

Makes the "Choose Avatar" section on the onboarding screen fully responsive on mobile devices. Fixes layout overflow, alignment, and cramped interaction on small viewports.

Changes

  • Responsive grid: 4 columns on mobile, 5 on sm+ to prevent overflow
  • Touch targets: Min 48px (mobile) / 52px (desktop) for reliable taps
  • Responsive sizing: Smaller emoji and padding on mobile (text-2xltext-4xl by breakpoint)
  • Selected state: scale-105 on mobile, scale-110 on larger screens to avoid overflow
  • Mobile UX: touch-manipulation to reduce tap delay; active:border-primary-400 for tap feedback
  • Containment: min-w-0 and overflow handling so content doesn't spill horizontally

Also: app no longer shows a blank page when Supabase env vars are missing (graceful fallback so the UI always loads).

Screenshot (mobile)

Choose Avatar - mobile

How to test

  1. Run frontend: cd frontend && npm run dev
  2. Open http://localhost:3000/onboarding
  3. Use DevTools device toolbar (e.g. iPhone 12) or resize to ~375px width
  4. Confirm avatar grid fits, no horizontal scroll, and avatars are easy to tap

Fixes #35

- Use 4 columns on mobile, 5 on larger screens
- Touch-friendly min 48px tap targets, responsive emoji size
- Scale selected avatar 105% on mobile to avoid overflow
- Add touch-manipulation and active state for mobile
- Prevent horizontal overflow with min-w-0
- Graceful handling when Supabase env missing (no blank page)
- Add mobile screenshot in docs/screenshots/

Made-with: Cursor
Copilot AI review requested due to automatic review settings March 9, 2026 10:35
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Mar 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the mobile responsiveness of the onboarding “Choose Avatar” UI and introduces a frontend-side fallback to avoid blank-page failures when Supabase env vars are missing.

Changes:

  • Adjusts onboarding layout/avatar grid to prevent horizontal overflow and improve tap targets on small screens.
  • Adds defensive handling around session lookup on the Home page to ensure loading state resolves even if session retrieval fails.
  • Changes Supabase client initialization and helper functions to tolerate missing VITE_SUPABASE_URL / VITE_SUPABASE_ANON_KEY.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
frontend/src/pages/Onboarding.tsx Makes the avatar picker responsive (grid columns, sizing, overflow containment, touch behavior).
frontend/src/pages/Home.tsx Ensures the home screen exits loading state even if session check throws.
frontend/src/lib/supabase.ts Adds “Supabase not configured” fallback behavior in helpers and changes client initialization.
docs/screenshots/issue-35-mobile-onboarding.png Adds a mobile screenshot documenting the updated onboarding layout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +31 to +33
if (!supabase) {
return { data: null, error: { message: 'Supabase not configured. Add VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY to .env' } as any };
}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When Supabase isn’t configured, signInAnonymously returns { data: null, error: { message } } with as any. This forces consumers to rely on runtime checks and any, and makes it easy to accidentally dereference data assuming the normal Supabase response shape. Consider returning a typed object matching Supabase’s auth response shape (e.g., data: { user: null, session: null }) and a properly typed AuthError/Error, or throw a dedicated configuration error that callers can catch and surface.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to 23
try {
const session = await getSession();
if (session) {
navigate('/dashboard');
}
} catch {
// ignore
} finally {
setLoading(false);
}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSession already handles the unconfigured Supabase case and catches errors internally (returns null). The extra try/catch { /* ignore */ } here is redundant and can hide unexpected errors during local debugging. Consider removing the try/catch and relying on getSession’s behavior (or at least logging the caught error in development).

Suggested change
try {
const session = await getSession();
if (session) {
navigate('/dashboard');
}
} catch {
// ignore
} finally {
setLoading(false);
}
const session = await getSession();
if (session) {
navigate('/dashboard');
}
setLoading(false);

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +9
export const supabase: SupabaseClient =
supabaseUrl && supabaseAnonKey
? createClient(supabaseUrl, supabaseAnonKey)
: (null as unknown as SupabaseClient);
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supabase is exported as SupabaseClient but can be null at runtime via (null as unknown as SupabaseClient). This defeats strict null-safety and can lead to runtime crashes in code that uses supabase directly (e.g., frontend/src/lib/api.ts calls supabase.auth.getSession() without a guard). Prefer exporting supabase as SupabaseClient | null (or undefined) and updating call sites/helpers to handle the unconfigured case explicitly (or provide a safe stub implementation).

Suggested change
export const supabase: SupabaseClient =
supabaseUrl && supabaseAnonKey
? createClient(supabaseUrl, supabaseAnonKey)
: (null as unknown as SupabaseClient);
export const supabase: SupabaseClient | null =
supabaseUrl && supabaseAnonKey
? createClient(supabaseUrl, supabaseAnonKey)
: null;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Choose Avatar component is not fully responsive on mobile

3 participants