large mock refector hopefully done + no errors?
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h13m59s

This commit is contained in:
2025-12-21 02:43:03 -08:00
parent 391d00ae15
commit c49e5f7019
77 changed files with 817 additions and 465 deletions

View File

@@ -1,7 +1,6 @@
// src/pages/admin/components/ProfileManager.tsx
import React, { useState, useEffect, useCallback } from 'react';
import toast from 'react-hot-toast';
import type { Profile, Address, User } from '../../../types';
import React, { useState, useEffect } from 'react';
import type { Profile, Address, UserProfile } from '../../../types';
import { useApi } from '../../../hooks/useApi';
import * as apiClient from '../../../services/apiClient';
import { notifySuccess, notifyError } from '../../../services/notificationService';
@@ -21,12 +20,11 @@ import { useProfileAddress } from '../../../hooks/useProfileAddress';
export interface ProfileManagerProps {
isOpen: boolean;
onClose: () => void;
user: User | null; // Can be null for login/register
authStatus: AuthStatus;
profile: Profile | null; // Can be null for login/register
profile: UserProfile | null; // Can be null for login/register
onProfileUpdate: (updatedProfile: Profile) => void;
onSignOut: () => void;
onLoginSuccess: (user: User, token: string, rememberMe: boolean) => void; // Add login handler
onLoginSuccess: (user: UserProfile, token: string, rememberMe: boolean) => void; // Add login handler
}
// --- API Hook Wrappers ---
@@ -41,7 +39,7 @@ const deleteAccountWrapper = (password: string, signal?: AbortSignal) => apiClie
const updatePreferencesWrapper = (prefs: Partial<Profile['preferences']>, signal?: AbortSignal) => apiClient.updateUserPreferences(prefs, { signal });
const updateProfileWrapper = (data: Partial<Profile>, signal?: AbortSignal) => apiClient.updateUserProfile(data, { signal });
export const ProfileManager: React.FC<ProfileManagerProps> = ({ isOpen, onClose, user, authStatus, profile, onProfileUpdate, onSignOut, onLoginSuccess }) => { // This line had a type error due to syntax issues below.
export const ProfileManager: React.FC<ProfileManagerProps> = ({ isOpen, onClose, authStatus, profile, onProfileUpdate, onSignOut, onLoginSuccess }) => {
const [activeTab, setActiveTab] = useState('profile');
// Profile state
@@ -88,7 +86,7 @@ export const ProfileManager: React.FC<ProfileManagerProps> = ({ isOpen, onClose,
e.preventDefault();
logger.debug('[handleProfileSave] Save process started.');
if (!user) {
if (!profile) {
notifyError("Cannot save profile, no user is logged in.");
logger.warn('[handleProfileSave] Aborted: No user is logged in.');
return;
@@ -175,12 +173,12 @@ export const ProfileManager: React.FC<ProfileManagerProps> = ({ isOpen, onClose,
const handleOAuthLink = async (provider: 'google' | 'github') => {
// This will redirect the user to the OAuth provider to link the account.
// TODO: This is a placeholder. Implement OAuth account linking via the Passport.js backend.
if (!user) {
if (!profile) {
return; // Should not be possible to see this button if not logged in
}
const errorMessage = `Account linking with ${provider} is not yet implemented.`;
logger.warn(errorMessage, { userId: user.user_id });
logger.warn(errorMessage, { userId: profile.user_id });
notifyError(errorMessage);
};