Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b70b31d
Merge pull request #110 from Team-Frolog/hotfix
JIMIN1020 Dec 8, 2024
936382d
Merge pull request #114 from Team-Frolog/dev
JIMIN1020 Jan 8, 2025
4347303
Merge pull request #124 from Team-Frolog/dev
JIMIN1020 Feb 1, 2025
c070c12
Merge pull request #125 from Team-Frolog/dev
JIMIN1020 Feb 2, 2025
7033dd7
Merge pull request #126 from Team-Frolog/dev
JIMIN1020 Feb 3, 2025
f7fb096
Merge pull request #142 from Team-Frolog/dev
JIMIN1020 Feb 28, 2025
939ce67
Merge pull request #149 from Team-Frolog/dev
JIMIN1020 Mar 1, 2025
f258812
[Feat/#152]: 우물 수정 시트 구현
JIMIN1020 Apr 6, 2025
1166a58
[Feat/#51]: 우물 순서 변경 모드 구현
JIMIN1020 Apr 6, 2025
1be4f62
[Fix/#152]: custom link -> client component로 전환
JIMIN1020 Apr 13, 2025
316b84f
[Feat/#152]: 우물 아이템 드래그 기능 구현
JIMIN1020 Apr 13, 2025
eb11d52
[HOTFIX]: profile redirect 버그 수정
JIMIN1020 Apr 15, 2025
d0c3a7a
Merge pull request #169 from Team-Frolog/hotfix
JIMIN1020 Apr 15, 2025
37c3904
Merge branch 'main' into dev
JIMIN1020 Apr 21, 2025
0f17e06
Merge branch 'dev' into feat/#152
JIMIN1020 Apr 21, 2025
076e1db
[Feat/#152]: 우물 아이템 이동 API 연동
JIMIN1020 Apr 21, 2025
725a8f2
[Fix/#152]: 우물 순서 수정 후 리셋
JIMIN1020 May 3, 2025
f594ca3
Merge branch 'dev' into feat/#152
JIMIN1020 Jun 28, 2025
7d16c29
[Fix/#152]: 우물 아이템 이동 핸들러 수정
JIMIN1020 Jul 19, 2025
0aa5062
Merge branch 'dev' into feat/#152
JIMIN1020 Aug 4, 2025
91d8f0d
[Fix/#152]: 수정 시트 트리거 수정
JIMIN1020 Aug 4, 2025
466c07a
[Fix/#152]: story 오류 수정
JIMIN1020 Aug 4, 2025
85adff7
[Fix/#152]: lint 에러 수정
JIMIN1020 Aug 4, 2025
32d10a2
[Fix/#152]: lint 에러 수정
JIMIN1020 Aug 4, 2025
f67af28
Merge branch 'dev' into feat/#152
SebellKo Aug 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,850 changes: 480 additions & 1,370 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@sentry/nextjs": "^8.35.0",
"@svgr/webpack": "^8.1.0",
"@tanstack/react-query": "^5.40.1",
"@types/react-beautiful-dnd": "^13.1.8",
"axios": "^1.7.2",
"cookies-next": "^4.2.1",
"framer-motion": "^11.11.15",
Expand All @@ -30,6 +31,7 @@
"next-auth": "^4.24.7",
"next-pwa": "^5.6.0",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 패키지 이제 deprecated됐을텐데 괜찮아요 ?
atlassian/react-beautiful-dnd#2672

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

당장 react 19버전으로 업그레이드 할 예정은 없으니 기타 의존성 문제 생길 때 마이그레이션 하면 된다고 생각합니다~

"react-dom": "^18",
"react-error-boundary": "^4.0.13",
"react-hook-form": "^7.53.2",
Expand Down
1 change: 1 addition & 0 deletions public/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export { default as PlusIcon } from './well/circle-plus.svg';
export { default as EditIcon } from './well/well-edit.svg';
export { default as WellAddIcon } from './well/well-add-icon.svg';
export { default as StoreIcon } from './well/store-button.svg';
export { default as WellItemMoverIcon } from './well/well-item-mover.svg';
export { default as WellListIcon } from './well/well-list-icon.svg';

// test
Expand Down
7 changes: 7 additions & 0 deletions public/icons/well/well-item-mover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions public/images/frog/edit-well-frog.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions public/sw.js

This file was deleted.

1 change: 0 additions & 1 deletion public/sw.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions src/app/(store)/mission/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function MissionPage() {
<span className='self-end text-body-lg'>1회 10p</span>
</div>
<Image
src={IMAGES.frog.reading.before}
src={IMAGES.frog.add.reading}
alt='reading book frog'
width={127}
height={62}
Expand All @@ -33,7 +33,7 @@ function MissionPage() {
<span className='self-end text-body-lg'>1회 20p</span>
</div>
<Image
src={IMAGES.frog.reading.after}
src={IMAGES.frog.add.done}
alt='read book frog'
width={127}
height={62}
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavigationBar/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function NavigationBar() {
},
{
label: NAV_ITEM.profile.label,
href: getPath.profile(userId ?? ''),
href: userId ? getPath.profile(userId) : PAGES.PROFILE,
icon: ProfileIcon,
navKey: NAV_ITEM.profile.key,
},
Expand Down
7 changes: 4 additions & 3 deletions src/constants/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ export const IMAGES = {
notfound_page: `${BASE_PATH}/frog/fallback/not-found-frog.webp`,
},
first_congrats: `${BASE_PATH}/frog/first-review-congrats.svg`,
reading: {
before: `${BASE_PATH}/frog/book/before-reading.svg`,
after: `${BASE_PATH}/frog/book/after-reading.svg`,
add: {
reading: `${BASE_PATH}/frog/frog-reading.svg`,
done: `${BASE_PATH}/frog/frog-done.svg`,
},
edit_well_frog: `${BASE_PATH}/frog/edit-well-frog.svg`,
memo_frog: `${BASE_PATH}/frog/memo-frog.webp`,
first_memo_frog: `${BASE_PATH}/frog/first-memo-frog.webp`,
more_feed: `${BASE_PATH}/frog/morefeed-frog.svg`,
Expand Down
9 changes: 8 additions & 1 deletion src/data/ui/bottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ export const sheetData: { [key: string]: AlertSheet } = {
frog: SHEET_FROG.wink,
description: () => <>추후에 상점이 오픈될 때, 알려드릴게요.</>,
},
add_book: { getTitle: () => <>지금 이 책은...</>, type: 'normal' },
add_book: {
getTitle: () => <>지금 이 책은...</>,
type: 'normal',
},
edit_well: {
getTitle: () => <>무엇을 수정할까요?</>,
type: 'normal',
},
select_books: {
getTitle: () => <>기존 리뷰를 우물에 담을까요?</>,
type: 'normal',
Expand Down
4 changes: 2 additions & 2 deletions src/features/Book/components/BottomSheet/StateSelectSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function StateSelectSheet({
<span>읽기 전/중이에요</span>
<div className='flex h-full items-end'>
<Image
src={IMAGES.frog.reading.before}
src={IMAGES.frog.add.reading}
alt='reading'
width={127}
height={61}
Expand All @@ -45,7 +45,7 @@ function StateSelectSheet({
<span>다 읽었어요</span>
<div className='flex h-full items-end'>
<Image
src={IMAGES.frog.reading.after}
src={IMAGES.frog.add.done}
alt='done'
width={127}
height={61}
Expand Down
8 changes: 7 additions & 1 deletion src/features/Well/api/well.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
SearchUserWellReq,
SearchWell,
SearchWellItem,
ChangeWellItemOrderBulkReq,
ChangeWellItemOrderBulk,
GetUserWellItemCount,
} from '@frolog/frolog-api';

Expand Down Expand Up @@ -78,8 +80,8 @@ export const getWellItems = async (page: number, well_id: string) => {
const response = await searchWellItem.fetch({
well_id,
page,
sort: 'desc',
limit: WELLITEM_LIMIT,
sort: 'newest',
});
return response;
};
Expand Down Expand Up @@ -130,6 +132,10 @@ export const deleteThisBook = async (req: DeleteWellItemsByConditionReq) => {
return response;
};

export const updateWellItemOrder = async (req: ChangeWellItemOrderBulkReq) => {
await new ChangeWellItemOrderBulk(baseOptions).fetch(req);
};

export const getUserWellItemsCount = async (userId: string) => {
const response = await getUserWellItems.fetch({ id: userId });
return response;
Expand Down
2 changes: 1 addition & 1 deletion src/features/Well/api/well.server.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const getWellItemList = async (wellId: string) => {
page: 0,
well_id: wellId,
limit: WELLITEM_LIMIT,
sort: 'newest',
sort: 'desc',
});

return response;
Expand Down
143 changes: 143 additions & 0 deletions src/features/Well/components/Well/WellDetail.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import React, { useEffect, useMemo, useState } from 'react';
import { useObserver } from '@/hooks/gesture/useObserver';
import {
ChangeWellItemOrderReq,
GetWellItemRes,
GetWellRes,
SearchWellItemRes,
} from '@frolog/frolog-api';
import { usePathname } from 'next/navigation';
import { getPath } from '@/utils/getPath';
import { useCustomRouter } from '@/hooks/useCustomRouter';
import { useWellItems } from '../../hooks/useWellItems';
import WellTitle from './WellTitle';
import { updateWellItemOrder } from '../../api/well.api';
import WellItemList from './WellItem/WellItemList';
import WellOrderEditHeader from './WellHeader/WellOrderEditHeader';
import WellHeader from './WellHeader/WellHeader';

interface Props {
/** 우물 정보 데이터 객체 */
wellData: GetWellRes;
/** 로그인한 유저인지 여부 */
isRootUser: boolean;
/** 첫 우물인지 여부 */
isDefaultWell?: boolean;
/** 우물 순서 변경 모드 여부 */
isMovable: boolean;
userId: string;
initialWellItemList: SearchWellItemRes;
}
function WellDetail({
userId,
wellData,
isRootUser,
isDefaultWell,
isMovable,
initialWellItemList,
}: Props) {
const router = useCustomRouter('well');
const pathname = usePathname();
const { id, name, item_cnt } = wellData;

const {
wellItems,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
isEmpty,
isFetched,
} = useWellItems(wellData.id, initialWellItemList);

const { setTarget } = useObserver({ hasNextPage, fetchNextPage });
const originalItems = useMemo(() => wellItems, [wellItems]);
const [items, setItems] = useState<GetWellItemRes[]>([]);
const [orderChanges, setOrderChanges] = useState<ChangeWellItemOrderReq[]>(
[]
);

useEffect(() => {
if (originalItems.length) {
setItems(originalItems);
}
}, [originalItems]);

const handleMoveItem = (result: any) => {
const movedItem = items.find((item) => item.id === result.draggableId);
if (!movedItem) return;

const newOrder = items.length - result.destination.index - 1;

const prevChanges = [...orderChanges];
prevChanges.push({
well_id: wellData.id,
id: result.draggableId,
order: newOrder,
});

console.log(prevChanges);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‼️

setOrderChanges(prevChanges);

setItems((prevItems) => {
const updated = [...prevItems];
const [moved] = updated.splice(result.source.index, 1);
updated.splice(result.destination.index, 0, moved);
return updated;
});
};

const handleOrderChange = async () => {
try {
await updateWellItemOrder({
well_id: wellData.id,
changes: orderChanges,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 왜 mutation안쓰시고 바로 호출하셨어요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깜빡했달까...

setOrderChanges([]);
router.replace(getPath.wellDetail(userId, wellData.id));
} catch (error) {
console.error('순서 저장 실패:', error);
}
};

return (
<>
{isMovable ? (
<WellOrderEditHeader
onClickCancel={() => router.replace(pathname)}
onClickDone={handleOrderChange}
/>
) : (
<WellHeader
userId={userId}
wellId={wellData.id}
isRootUser={isRootUser}
/>
)}
<WellTitle
title={name}
wellId={id}
itemCount={item_cnt}
isRootUser={isRootUser}
isPointing={isDefaultWell && wellItems.length < 2}
isMovable={isMovable}
/>

<WellItemList
wellData={wellData}
items={items}
userId={userId}
wellItems={wellItems}
isRootUser={isRootUser}
isDefaultWell={isDefaultWell}
isMovable={isMovable}
isFetchingNextPage={isFetchingNextPage}
isFetched={isFetched}
isEmpty={isEmpty}
setTarget={setTarget}
handleMoveItem={handleMoveItem}
/>
</>
);
}

export default WellDetail;
Loading