Skip to content

Commit 0c40489

Browse files
authored
Merge pull request #172 from imaginer-dev/164---ui-프로필-수정-구현
feat: supabase storage 로 이미지 업로드 기능 추가
2 parents ac243f5 + 19e9f8f commit 0c40489

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/apis/updateUserApi.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ interface UpdateUserProfileParams {
1919
export const updateUserProfile = async ({ id, user_nickname, file }: UpdateUserProfileParams) => {
2020
let imageUrl: string | null = null;
2121

22+
console.log(`Updating profile for user: ${id}`);
23+
2224
const bucketName = 'profile';
2325

2426
if (file) {
25-
const filePath = `public/${id}_${file.name}`;
27+
const filePath = `${id}/profile.${file.name.split('.').pop()}`;
2628
console.log(`Uploading file to path: ${filePath}`);
2729

2830
const { error: uploadError } = await supabase.storage.from(bucketName).upload(filePath, file, { upsert: true });

src/assets/svgs/ProfileIcon.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ const ProfileIcon = ({
1919
/>
2020
</svg>
2121
) : (
22-
<div className="avatar overflow-hidden rounded-full">
23-
<div className="w-full rounded">
24-
<img src={imageUrl} alt="Profile" />
22+
<div className={`avatar h-[49[px]] w-[49px] overflow-hidden rounded-full`}>
23+
<div>
24+
<img className="object-cover" src={imageUrl} alt="Profile" />
2525
</div>
2626
</div>
2727
);

src/components/common/SideBar/SideBarProfile.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ const SideBarProfile: FC<Props> = ({ userName, imageUrl }) => {
2323
<Link to="/" className="cursor-pointer rounded-lg bg-base-100 px-3 py-1 font-black hover:opacity-50">
2424
내 캘린더 보기
2525
</Link>
26-
{/**
27-
* // TODO: 버튼 링크 수정 해야함.
28-
* */}
29-
<Link to="/setting" className="cursor-pointer hover:opacity-50">
26+
<Link to="/profile" className="cursor-pointer hover:opacity-50">
3027
<SettingIcon />
3128
</Link>
3229
</div>

src/hooks/useAddGroupSchedule.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const useAddGroupSchedule = () => {
1313
const failDialogRef = useRef<DialogElement | null>(null);
1414

1515
const addGroupSchedule = (e: React.FormEvent<HTMLFormElement>, userList: Member[]) => {
16+
e.preventDefault();
1617
const formData = new FormData(e.currentTarget);
1718
const newGroupSchedule = {
1819
title: formData.get('name') as string,

0 commit comments

Comments
 (0)