Skip to content

feat: fix auth context, profile pic storage#162

Merged
AnkushSarkar10 merged 1 commit intomainfrom
03-30-feat_fix_auth_context_profile_pic_storage
Apr 1, 2025
Merged

feat: fix auth context, profile pic storage#162
AnkushSarkar10 merged 1 commit intomainfrom
03-30-feat_fix_auth_context_profile_pic_storage

Conversation

@AnkushSarkar10
Copy link
Collaborator

@AnkushSarkar10 AnkushSarkar10 commented Mar 30, 2025

  • fixed all instances of using id = '1'
  • user profile pic in firebase storage
  • fixed bug with view habit page not opening for new habits
  • editprofile will open with users current data filled in in the input

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@AnkushSarkar10 AnkushSarkar10 marked this pull request as ready for review March 30, 2025 18:30
Copilot AI review requested due to automatic review settings March 30, 2025 18:30
Copy link

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

This pull request replaces hardcoded user IDs with a dynamic retrieval of the current user's ID and improves profile picture handling from Firebase storage. Key changes include:

  • Replacing all instances of the hardcoded user ID '1' with the getCurrentUserId() helper.
  • Adding getCurrentUser and getCurrentUserId functions in the auth module.
  • Updating profile picture fetching and habit view logic to better reflect the authenticated user.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/core/auth/index.tsx Added new helper functions to retrieve current user data and ID.
src/components/modify-habit-entry/modify-entry-modal.tsx Replaced hardcoded user ID with dynamic current user ID.
src/components/habit-card.tsx Replaced hardcoded user ID with getCurrentUserId() for habit card display.
src/app/habits/view-habit.tsx Updated filtering and UI logic to use the dynamic user ID.
src/app/auth/create-edit-profile.tsx Modified profile creation/edit logic to rely on getCurrentUserId() and improved default image usage.
src/api/users/* Replaced usage of getUserById with getUserWithRelationshipById where applicable and updated user ID acquisition.
src/api/notifications/* Replaced hardcoded user ID with getCurrentUserId() for notifications logic.
src/api/habits/* Updated habit mutations to use the current user's data and getCurrentUserId() instead of a hardcoded ID.
Comments suppressed due to low confidence (2)

src/api/habits/firebase-mutations.ts:49

  • Both displayName and username are set to currentUserData.username; consider using a separate field (e.g., currentUserData.displayName) for displayName to accurately represent user data.
displayName: currentUserData.username,

src/api/habits/firebase-mutations.ts:13

  • [nitpick] The import path for getCurrentUserId is inconsistent with other files (which import from '@/core'). Consider using a consistent import path to avoid potential confusion.
import { getCurrentUserId } from '@/core/auth';

@AnkushSarkar10 AnkushSarkar10 force-pushed the 03-30-feat_fix_auth_context_profile_pic_storage branch from 6164f3a to ff4e2dd Compare March 30, 2025 23:28
@AnkushSarkar10 AnkushSarkar10 force-pushed the 03-30-feat_fix_auth_context_profile_pic_storage branch from ff4e2dd to 2af7b65 Compare April 1, 2025 01:18
@AnkushSarkar10 AnkushSarkar10 merged commit ae0b57c into main Apr 1, 2025
2 checks passed
@AnkushSarkar10 AnkushSarkar10 deleted the 03-30-feat_fix_auth_context_profile_pic_storage branch April 1, 2025 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants