Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zestlee1106 committed Nov 1, 2023
2 parents f7db4d1 + 0c66566 commit 52f4bef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
7 changes: 4 additions & 3 deletions components/ProfileCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import Vector from '@/public/icons/Vector 115.svg';
import { useRouter } from 'next/router';
import useModal from '@/hooks/useModal.ts';
import { signOut } from 'next-auth/react';
import { Profile } from '@/public/types/user';
import { UserInfoProps } from '@/context/UserInfoProvider.tsx';
// import { Profile } from '@/public/types/user';
import { formatAge } from '@/utils/transform';

interface ListItemProps {
Expand All @@ -23,15 +24,15 @@ interface ListItemProps {
}

interface ProfileCard {
userInfo: Profile;
userInfo: UserInfoProps;
imageSrc: string;
}

export default function ProfileCard({ imageSrc, userInfo }: ProfileCard) {
const { register } = useForm({ mode: 'onChange' });
const [showModal, setShowModal] = useState(false);
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
const age = formatAge(userInfo.birthDate);
const age = formatAge(userInfo?.birthDate || '');
const router = useRouter();
const { openModal } = useModal();

Expand Down
1 change: 1 addition & 0 deletions context/UserInfoProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface ComponentProps {

export interface UserInfoProps {
id?: number;
profileId?: number;
email?: string;
firstName?: string;
lastName?: string;
Expand Down
10 changes: 3 additions & 7 deletions pages/userInfo/editProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,18 @@ import { Textarea, Button, Upload, Input, Calendar } from '@/components/index.ts
import ProfileCamera from '@/public/icons/profileCamera.svg';
import { User, Profile } from '@/public/types/user';
import { modifyProfile } from '@/api/userInfo';
import { UserInfoProps } from '@/context/UserInfoProvider.tsx';

interface ProfileProps {
_imageSrc: string;
userInfo: Profile;
userInfo: UserInfoProps;
}

interface ImageComponentClickProps {
onClick?: () => void;
}

export default function EditProfile({ _imageSrc, userInfo }: ProfileProps) {
useEffect(() => {
console.log('_imageSrc', _imageSrc);
console.log('userInfo in editprofile', userInfo);
debugger;
}, []);
const [imageSrc, setImageSrc] = useState(_imageSrc);
const subHeader = 'font-pretendard font-semibold text-[16px]';
const {
Expand All @@ -39,7 +35,7 @@ export default function EditProfile({ _imageSrc, userInfo }: ProfileProps) {
return (str || '').charAt(0).toUpperCase() + (str || '').slice(1).toLowerCase();
};

const [buttonState, setButtonState] = useState(capitalizeFirstLetter(userInfo?.gender));
const [buttonState, setButtonState] = useState(capitalizeFirstLetter(userInfo?.gender || ''));

const onSubmit: SubmitHandler<FieldValues> = async (data) => {
try {
Expand Down
1 change: 0 additions & 1 deletion pages/userInfo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useState, useEffect } from 'react';
import { Nav, ProfileCard } from '@/components/index.tsx';
import { useRouter } from 'next/router';
import { getProfile } from '@/api/userInfo';
import { UserInfoProps } from '@/context/UserInfoProvider.tsx';

Expand Down

0 comments on commit 52f4bef

Please sign in to comment.