From 480ba80e567867228ed63ab43f504d1975318fde Mon Sep 17 00:00:00 2001 From: Deepak Pandey Date: Mon, 15 Sep 2025 10:13:49 +0530 Subject: [PATCH] fix: Improve font visibility and resolve console errors - Make all small text darker and more readable (preview, requirements, footer) - Increase font sizes from text-xs to text-sm for better visibility - Add font-medium and font-semibold for better contrast - Fix generate_codeunia_id database function error by providing codeunia_id in profileService - Improve error handling with user-friendly toast messages - Enhance visual feedback with larger icons and better spacing - Fix console errors related to missing database functions This resolves the font visibility issues and database errors shown in the console --- app/complete-profile/page.tsx | 110 +++++++++++++++++----------------- lib/services/profile.ts | 6 +- 2 files changed, 61 insertions(+), 55 deletions(-) diff --git a/app/complete-profile/page.tsx b/app/complete-profile/page.tsx index 4478f289..808a8eac 100644 --- a/app/complete-profile/page.tsx +++ b/app/complete-profile/page.tsx @@ -71,6 +71,8 @@ export default function CompleteProfile() { } } catch (profileError) { console.error('Error checking profile:', profileError); + // Show a more user-friendly error message + toast.error('Unable to load profile data. Please refresh the page and try again.'); // Continue with the form - profileService will handle creation if needed } @@ -351,15 +353,15 @@ export default function CompleteProfile() { - {/* Username Preview */} - {username && ( -
- Preview: - - @{username.toLowerCase()} - -
- )} + {/* Username Preview */} + {username && ( +
+ Preview: + + @{username.toLowerCase()} + +
+ )} {/* Username Status Messages */} {isCheckingUsername && ( @@ -369,45 +371,45 @@ export default function CompleteProfile() { )} - {!isCheckingUsername && usernameAvailable === true && ( -
- -

Username is available!

-
- )} + {!isCheckingUsername && usernameAvailable === true && ( +
+ +

Username is available!

+
+ )} - {!isCheckingUsername && usernameAvailable === false && !usernameError && ( -
- -

Username is already taken

-
- )} + {!isCheckingUsername && usernameAvailable === false && !usernameError && ( +
+ +

Username is already taken

+
+ )} - {usernameError && ( -
- -

{usernameError}

-
- )} + {usernameError && ( +
+ +

{usernameError}

+
+ )} - {/* Username Requirements */} -
-

Username Requirements:

- -
+ {/* Username Requirements */} +
+

Username Requirements:

+ +
@@ -435,15 +437,15 @@ export default function CompleteProfile() { - {/* Footer */} -
-

- By continuing, you agree to CodeUnia's{' '} - Terms of Service - {' '}and{' '} - Privacy Policy -

-
+ {/* Footer */} +
+

+ By continuing, you agree to CodeUnia's{' '} + Terms of Service + {' '}and{' '} + Privacy Policy +

+
); diff --git a/lib/services/profile.ts b/lib/services/profile.ts index aaeff03d..1756b78f 100644 --- a/lib/services/profile.ts +++ b/lib/services/profile.ts @@ -31,13 +31,17 @@ export class ProfileService { async createProfile(userId: string): Promise { const { data: user } = await this.getSupabaseClient().auth.getUser() + // Generate a simple codeunia_id if needed + const codeuniaId = `CU-${userId.slice(-8).toUpperCase()}-${Date.now().toString(36).toUpperCase()}` + const profileData = { id: userId, first_name: user.user?.user_metadata?.first_name || '', last_name: user.user?.user_metadata?.last_name || '', is_public: true, email_notifications: true, - profile_completion_percentage: 0 + profile_completion_percentage: 0, + codeunia_id: codeuniaId } const supabase = this.getSupabaseClient();