Conversation
…val function for sorting
… sortScrapData function
…on in FolderScrapScreen
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…es with valid scrap IDs
…c and optimizing recent scrap data retrieval
…n FolderScrapScreen
…s with IDs and updating related methods
…enhance sort order toggle functionality
…eletion, including folder count adjustments
… improved SVG rendering and size consistency
… improved type consistency
…onsistency in DeletedScrap and Scrap headers
… and update ScrapHeadCard for improved modal handling
… and update ScrapHeadCard for improved modal handling
…ppointer/Pointer into refactor/native/scrap-#190
…hing for entire problem and pointings
…e problem and pointings data structure
…lection logic in FolderScrapScreen
…ponents with layout adjustments
…t and adjusting layout logic
…over state styling
…omponents to enhance hover effects
…roved alignment and spacing
There was a problem hiding this comment.
Pull request overview
This PR refactors the native “scrap” feature to improve optimistic cache updates, simplify recent-scrap state management, unify sorting behavior, and enhance the scrap detail experience (entire pointings + new analysis sections), alongside several UI/layout adjustments and modal integrations.
Changes:
- Fix/expand optimistic cache updates for scrap move/delete and improve store synchronization via a new
useScrapStoreSynchook. - Refactor sorting keys/logic (
TITLE→NAME, unified timestamp handling) and restore client-side sorting where needed. - Update scrap detail to support “전체 포인팅 보기” using newly added “entire problem/pointing” queries, and add
AnalysisSectionrendering/filtering.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/native/src/features/student/scrap/utils/types.ts | Updates sort key unions (UISortKey, ApiSortKey) to align UI/API sorting changes. |
| apps/native/src/features/student/scrap/utils/scrapTransformers.ts | Refactors conversion logic for AllPointings, now based on “entire” problem/pointing inputs. |
| apps/native/src/features/student/scrap/utils/scrapFilters.ts | Adds analysis-section filter generation and visibility logic. |
| apps/native/src/features/student/scrap/utils/layout/gridLayout.ts | Removes fixed item height from grid layout calculation. |
| apps/native/src/features/student/scrap/utils/formatters/sortScrap.ts | Unifies sorting timestamp logic and updates sort key from TITLE→NAME. |
| apps/native/src/features/student/scrap/utils/formatters/formatToMinute.ts | Adds custom ko-KR date formatting path. |
| apps/native/src/features/student/scrap/stores/recentScrapStore.ts | Simplifies recent store from “detail objects” to “scrapIds”. |
| apps/native/src/features/student/scrap/screens/ScrapScreen.tsx | Restores client-side sorting, recent list derived from search results, and adds store sync hook. |
| apps/native/src/features/student/scrap/screens/ScrapDetailScreen.tsx | Adds “entire problem/pointing” queries, AnalysisSection rendering, and view-all navigation changes. |
| apps/native/src/features/student/scrap/screens/FolderScrapScreen.tsx | Restores client-side sorting and adjusts folder lookup/refetch wiring. |
| apps/native/src/features/student/scrap/hooks/useScrapStoreSync.ts | New hook to prune recent IDs and close notes based on valid scrap IDs. |
| apps/native/src/features/student/scrap/hooks/index.ts | Exports useScrapStoreSync. |
| apps/native/src/features/student/scrap/hoc/withScrapModals.tsx | Injects LoadQnaImageModal globally via the scrap modals provider. |
| apps/native/src/features/student/scrap/contexts/ScrapModalsContext.tsx | Adds LoadQnaImageModal visibility state and open/close actions. |
| apps/native/src/features/student/scrap/components/scrap/PointingsList.tsx | Minor padding change. |
| apps/native/src/features/student/scrap/components/scrap/AnalysisSection.tsx | New component to render “reading tip / one step more” analysis content. |
| apps/native/src/features/student/scrap/components/Tooltip/TooltipPopover.tsx | Adds onOpenChange callback for tooltip open/close state. |
| apps/native/src/features/student/scrap/components/Tooltip/ScrapItemTooltip.tsx | Simplifies state sync for rename input and removes now-unneeded cleanup paths. |
| apps/native/src/features/student/scrap/components/Tooltip/AddScrapTooltip.tsx | Refetches scraps after creating a scrap from an image. |
| apps/native/src/features/student/scrap/components/Modal/LoadQnaImageModal.tsx | Converts modal to context-driven visibility + triggers refetch/toast behavior. |
| apps/native/src/features/student/scrap/components/Modal/CreateFolderModal.tsx | Adjusts toast timing and text input layout; changes image upload error handling flow. |
| apps/native/src/features/student/scrap/components/Header/SearchScrapHeader.tsx | Layout changes and icon swap for clear button. |
| apps/native/src/features/student/scrap/components/Header/ScrapHeader.tsx | Selection header layout/text updates. |
| apps/native/src/features/student/scrap/components/Header/DeletedScrapHeader.tsx | Trash selection header layout/text updates. |
| apps/native/src/features/student/scrap/components/Dropdown/SortDropdown.tsx | Reorders options and changes ASC/DESC toggling behavior. |
| apps/native/src/features/student/scrap/components/Card/cards/TrashCard.tsx | Adds hover/tooltip-open driven styling and adjusts selection UI. |
| apps/native/src/features/student/scrap/components/Card/cards/SearchResultCard.tsx | Minor layout tweaks. |
| apps/native/src/features/student/scrap/components/Card/cards/ScrapHeadCard.tsx | Uses context-driven LoadQnaImageModal instead of local state. |
| apps/native/src/features/student/scrap/components/Card/cards/ScrapCard.tsx | Layout refactor + hover styling wiring to ImageWithSkeleton. |
| apps/native/src/features/student/scrap/components/Card/cards/RecentScrapCard.tsx | Adjusts prop typing to match new “recent by ID” approach. |
| apps/native/src/features/student/scrap/components/Card/ScrapCardGrid.tsx | Removes fixed itemHeight usage and adds max height constraint. |
| apps/native/src/components/system/icons/ScrapFolderDefalutIcon.tsx | Adds hover styling support to default folder icon. |
| apps/native/src/components/system/icons/ScrapDefalutIcon.tsx | Adjusts default scrap icon sizing behavior to square. |
| apps/native/src/components/system/icons/ChevronUpFilledIcon.tsx | Updates icon path geometry. |
| apps/native/src/components/common/ImageWithSkeleton.tsx | Adds isHovered support and adjusts border/overflow styling. |
| apps/native/src/apis/controller/student/study/useGetEntireProblemPointing.ts | Adds new query hook for entire problem pointings. |
| apps/native/src/apis/controller/student/study/useGetEntireProblem.ts | Adds new query hook for entire problems. |
| apps/native/src/apis/controller/student/study/index.ts | Exports newly added “entire” study hooks. |
| apps/native/src/apis/controller/student/scrap/utils/optimisticHelpers.ts | Updates optimistic move/delete to adjust folder counts and folderId updates. |
| apps/native/src/apis/controller/student/scrap/putMoveScraps.ts | Passes targetFolderId into optimistic move for correct cache updates. |
Comments suppressed due to low confidence (3)
apps/native/src/features/student/scrap/components/Header/SearchScrapHeader.tsx:6
- 현재 파일에서
ChevronLeft,CircleX,X(lucide-react-native)가 사용되지 않습니다. ESLintno-unused-vars경고를 줄이기 위해 미사용 import를 제거해 주세요.
import { CircleXFilledIcon } from '@/components/system/icons';
import { StudentRootStackParamList } from '@/navigation/student/types';
import { colors } from '@/theme/tokens';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { ChevronLeft, CircleX, X } from 'lucide-react-native';
import { useEffect, useRef } from 'react';
apps/native/src/features/student/scrap/utils/formatters/sortScrap.ts:25
- 정렬 키가
TITLE→NAME으로 변경됐는데, JSDoc이 아직TITLE을 참조하고 있어 코드와 문서가 불일치합니다. 주석의 정렬 키 설명/매핑 예시를NAME기준으로 업데이트해 주세요.
apps/native/src/features/student/scrap/stores/recentScrapStore.ts:52 recent-scrap-store의 persist 구조가{scraps: ...}에서{scrapIds: ...}로 변경되었는데persist에version/migrate가 없어 기존 저장 데이터를 가진 사용자는 최근 본 목록이 모두 초기화됩니다. 기존 persisted state의scraps[].scrapDetail.id를scrapIds로 변환하는 마이그레이션을 추가하거나, 의도된 초기화라면 버전 업과 함께 명시적으로 처리해 주세요.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
apps/native/src/features/student/scrap/components/Header/SearchScrapHeader.tsx
Show resolved
Hide resolved
| return { | ||
| no: 1, | ||
| problemId: scrapDetail.problem.id, | ||
| progress: 'DONE', | ||
| problemId: mainProblem.problemId, | ||
| problem, | ||
| childProblems: [], | ||
| }; | ||
| childProblems: transformedChildProblems, | ||
| } as PublishProblemGroupResp; |
There was a problem hiding this comment.
convertScrapToGroup가 PublishProblemGroupResp를 리턴한다고 하면서 no, progress 필드를 채우지 않고 as PublishProblemGroupResp로 캐스팅하고 있습니다. AllPointingsScreen에서 group.no를 사용해 헤더/설명을 만들기 때문에 현재는 undefined번으로 표시되거나 런타임 오류로 이어질 수 있어, 최소한 no/progress를 올바른 값으로 설정해 반환해야 합니다.
✅ Key Changes
1. 낙관적 업데이트 로직 수정
optimisticMoveScrap폴더 이동시, 이동된 항목을 현재 폴더에서 제거 ❌ 이동된 스크랩의 folderId 필드 변경 ✅optimisticDeleteScrap폴더 내 스크랩 삭제 시, 삭제된 항목을 즉시 제거 및 폴더 정보 업데이트 추가optimisticHelpers.ts2.
useScrapStoreSync추가 및RecentScrapStore객체 단순화recentScrapStore,scrapNoteStore관리useScrapStoreSync.tsRecentScrapStore.ts3. 정렬 로직 리팩토링
sortScrap.tstypes.tsSortDropdown수정정렬 옵션 순서 변경, 정렬 순서 토글 개선:
ScrapScreen.ts&FolderScrapScreen.tsuseGetEntireProblem: 전체 문제 데이터 조회 (MAIN_PROBLEM + CHILD_PROBLEM) 추가useGetEntireProblemPointing: 문제의 모든 포인팅 데이터 조회 추가convertScrapToGroup함수 개선, MAIN_PROBLEM과 CHILD_PROBLEM 구분 및 포인팅 매칭ScrapDetailScreen.tsx4. 스크랩 상세보기
AnalysisSection추가scrapFilters.ts필터 추가5.
ScrapCard,TrashCard,ScrapFolderDefaultIcon,ImageWithSkeleton호버 상태 추가6.
ScrapCardGrid, itemHeight 제거 및ScrapCard,TrashCard,SearchResultCard,ScrapAddCard레이아웃 수정7.
ScrapHeader,DeletedScrapHeader레이아웃 수정 및SearchScrapHeadertext input 레이아웃 버그 수정8.
LoadQnaImageModalScrapModalsContext에 추가, CreateFolderModal 폴더 추가 시 Toast 메시지 안 보이는 버그 수정