marvelai-org / marvel-platform

This is the marvel teaching assistant ai project.
https://app.marvelai.org/
MIT License
18 stars 98 forks source link

Kai/Marvel AI Onboarding Expedition #161

Closed ademiltonnunes closed 2 months ago

ademiltonnunes commented 2 months ago

Description

This PR focuses on enhancing the onboarding process for Marvel AI by implementing a persistent progress bar and a real-time updating checklist. This was implemented by the squad 404 gladiator. This feature will guide users through key steps such as the:

Implementation:

To provide a clearer understanding of the implementation and guide you through all the relevant files, I will summarize the most important modifications made to this feature.

  1. Database: To accommodate the new onboarding feature, the existing "Users" collection has been modified. We added fields to track the progress of onboarding steps. Database Diagram A user document now looks like this:
{
 "users": {
   "123": {
     "fullName": "John Doe",
     "email": "john.doe@example.com",
     "uid": "123",
     "onboarding": {
       "1": true,
       "2": true,
       "3": false,
       "4": false,
       "5": false
     },
     "occupation": "Software Developer",
     "socialLinks": {
       "facebook": "https://facebook.com/johndoe",
       "linkedin": "https://linkedin.com/in/johndoe",
       "twitter": "https://twitter.com/johndoe"
     },
     "profilePhotoUrl": "https://example.com/photos/johndoe.jpg",
     "bio": "Passionate developer with 5 years of experience",
     "systemConfig": {
       "email": true,
       "push": false,
       "reminders": true,
       "theme": false
     }
   }
 }
}
  1. Modified signUpUser Function: The backend function signUpUser was modified to save default onboarding values when a user signs up, incorporating the new onboarding data structure.

    • Firebase function modified: function/userControllers
  2. HOC for Onboarding Screens: A Higher-Order Component (HOC) was created to redirect users to the appropriate onboarding screens based on their current steps in the process. The HOC checks the user’s onboarding status and redirects accordingly during sign-up or sign-in.

    • HOC Created: frontend/hoc/onboarding/withLayoutRedirect
    • File Modified to accommodate the HOC: frontend/pages/index.js
  3. Firebase Listener for Real-Time Updates: A Firebase listener was added to update the Redux state and redirect users to the homepage upon completion of all onboarding steps.

    • File Modified: frontend/providers/GlobalProvider.jsx
  4. Onboarding Layout: A general onboarding layout was created to standardize all the onboarding screens. The layout includes a persistent progress menu to track onboarding steps.

    • Layout Created: frontend/layouts/OnboardingLayout
    • Icons Created:
      • frontend/assets/svg/IconProcessDoing
      • frontend/assets/svg/IconProcessDone
      • frontend/assets/svg/IconProcessUndo
    • New Component Created to Show Icons: frontend/component/CustomeCheckCircle
  5. Welcome Screen: The first screen of the onboarding process.

    • Screen Folders:
      • frontend/pages/welcome-screen
      • frontend/template/WelcomeScreen
  6. Profile Setup: A form to capture most of the onboarding fields and save them to the database. This included creating components for uploading profile images and handling social links.

    • Screen Folders Created:
      • frontend/pages/profile-setup
      • frontend/template/ProfileSetup/ProfileSetupForm
      • New component for handling social links: frontend/template/ProfileSetup/SocialLinkInput
    • New component for image uploading: frontend/components/ImageUpload
    • Hook to upload image to Firebase Storage: frontend/hook/useUploadFile
    • Utility function to crop profile photo: frontend/utils/getCroppedImg.js
    • Modified Firebase storage rules: storage.rules
    • New Firebase function to save form data to the database:
      • File Created: function/controllers/onboardingController.js
      • Function: setupUserProfile
    • Service to call the function: frontend/services/onboarding/setupUserProfile.js
  7. System Configuration: A screen to set up system preferences for users, such as email notifications and theme settings. Also modified how to theme in the whole system.

    • Screen Folders:
      • frontend/pages/system-config
      • frontend/template/SystemConfig
    • Modified project theme: Split theme.js into three files for better modularity:
      • frontend/theme/pallete.jsx
      • frontend/theme/componentsTheme.jsx
      • frontend/theme/theme.jsx
    • File Modified: _app.js to incorporate the theme across the project
    • Modified Redux slice to get theme info from the database: frontend/redux/slices/userSlice.js
    • Created a hook to sync user system configuration: frontend/hook/useThemeSync.jsx
    • Firebase function to save system configuration:
      • File Created: function/controllers/onboardingController.js
      • Function: setupUserSystemConfig
    • Service to call the function: frontend/services/onboarding/setupUserSystemConfig.js
  8. Final Steps: The final screen before completing onboarding.

    • Screen Folders:
      • frontend/pages/final-steps
      • frontend/templates/FinalSteps
  9. Result Page: The last screen confirms onboarding completion.

    • Screen Folders:
      • frontend/pages/result-page
      • frontend/templates/ResultPage
    • Firebase function to update onboarding status:
      • File Created: function/controllers/onboardingController.js
      • Function: advanceOnboardingStatus
    • Service to call the function: frontend/services/onboarding/advanceOnboardingStatus.js

Type of change

How Has This Been Tested?

The following tests were conducted to verify the functionality:

ademiltonnunes commented 2 months ago

PR closed after Billy's review in dev session.