User Profile Management

The Kenya Estates platform allows registered users to manage their personal profiles, ensuring their information is up-to-date and their preferences are correctly set. This section outlines the functionalities related to user profile management.

1. Accessing the Profile

Users can typically access their profile settings from their user dashboard or a user-specific menu.

  • Dashboard Link: A "Profile," "My Account," or "Settings" link within the user dashboard. (See app/dashboard/profile/page.tsx).
  • User Menu: Often accessible by clicking on the user's avatar or name in the navigation bar.

Relevant files: app/dashboard/profile/page.tsx, components/navbar.tsx (if profile link is there), components/dashboard/dashboard-nav.tsx.

2. Viewing Profile Information

The profile page displays the user's current information stored on the platform.

  • Personal Details: Name, email address (often read-only or requires verification to change), phone number, profile picture/avatar.
  • Account Type: Indicates if the user is a regular user, agent, or admin.
  • Other Information: Depending on the platform, this might include agency details (for agents), saved addresses, etc.

3. Editing Profile Information

Users can update their personal details through a profile editing form.

  • Profile Form: A dedicated form allows users to modify editable fields. (See components/dashboard/profile-form.tsx).
  • Editable Fields: Typically include name, phone number, bio/description, profile picture. Email changes might be restricted or require a verification process.
  • Password Changes: Usually handled in a separate section or form for security reasons. The platform might have a "Change Password" feature.
  • Saving Changes: Submitted data is validated and updated in the user's record in the database.

Relevant files: components/dashboard/profile-form.tsx, app/actions/profile-actions.ts (handles update logic), lib/validators/profile.ts (for data validation).

4. Managing Preferences

Users may have options to manage various preferences related to their account and platform usage.

  • Notification Preferences: Users can choose which types of notifications they want to receive (e.g., new property alerts, message notifications, promotional content). (See supabase/migrations/20250512093900_add_content_notifications_preference_to_users.sql which adds a preference column).
  • Privacy Settings: Options to control the visibility of certain profile information to other users.
  • Communication Preferences: Opt-in/out of newsletters or marketing emails.

Relevant files: Preferences might be part of components/dashboard/profile-form.tsx or a separate settings section. Logic handled in app/actions/profile-actions.ts or specific notification/preference actions.

5. Profile Picture/Avatar Management

  • Upload Functionality: Users can upload a new profile picture. This often involves client-side preview and server-side processing/storage.
  • Storage: Profile pictures are typically stored in a cloud storage service (like Supabase Storage), with the URL linked to the user's profile.

6. Technical Implementation Highlights

  • User Authentication & Authorization: Ensures that users can only view and edit their own profiles.
  • Data Validation: Zod schemas (e.g., lib/validators/profile.ts) are used for robust server-side validation of profile data. Client-side validation improves UX.
  • Database Interaction: Profile information is stored in theusers table (or a related profiles table) in the Supabase database. (See types/user.ts, types/supabase.ts).
  • Server Actions: Securely handle profile updates and preference changes (e.g., app/actions/profile-actions.ts).

A well-structured user profile management system is essential for personalization, account security, and user satisfaction on the platform.