Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| import { z } from "zod"; | ||
|
|
||
| export const imageFileSchema = z | ||
| .instanceof(File) |
There was a problem hiding this comment.
| const setUpload = (newFile: File, newPreviewUrl: string) => { | ||
| setFile(newFile); | ||
| setPreviewUrl(newPreviewUrl); | ||
| }; |
There was a problem hiding this comment.
P99999999: update???나 고러한 느낌으로 맞추는 건 어떨까요?
There was a problem hiding this comment.
onUpdateUpload -> props 네이밍 컨벤션 맞춰보기
| const image = useWatch<StoryRegisterFormData>({ name: "image" }); | ||
| const storeName = useWatch<StoryRegisterFormData>({ name: "storeName" }); | ||
|
|
||
| const isDisabled = !image || !storeName || !isValid || isPending; |
There was a problem hiding this comment.
잊으시오,, const isDisabled = [image, storeName, isValid, isPending].every(Boolean);
| const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
| const file = e.target.files?.[0]; | ||
| if (!file) return; | ||
|
|
||
| const validationResult = imageFileSchema.safeParse(file); | ||
|
|
||
| if (!validationResult.success) { | ||
| const errorMessage = validationResult.error.errors[0]?.message; | ||
| // TODO: Toast 변경 | ||
| alert(errorMessage || "올바르지 않은 파일입니다."); | ||
|
|
||
| if (fileInputRef.current) { | ||
| fileInputRef.current.value = ""; | ||
| } | ||
| return; | ||
| } |
There was a problem hiding this comment.
P999 image upload 로직은 어느정도 hook으로 추출해서 사용해볼 수 있을 것 같아요!
prop 조금 받아서욥
✅ 이슈 번호
close #84
🪄 작업 내용 (변경 사항)
스토리 등록 기능 구현
/api/stories이미지 업로드 Context 추가
📸 스크린샷
스토리 등록
2025-07-28.2.40.36.2.mov
파일 크기가 5MB 넘었을 때
💡 설명
/story/register 페이지 구조:
이미지 → 설명 → 가게 선택→ 제출 버튼🗣️ 리뷰어에게 전달 사항
이미지 싱태 관리 관련
홈 → 스토리 등록 페이지간 이미지 전달을 위한 목적입니다~!현재 UploadProvider를
app/layout.tsx에서 감싸 전역 범위로 설정해두었습니다.다만 이미지 공유가
/ → /story/register흐름에서만 사용되기 때문에 라우트 그룹 단위로 범위를 좁히는게 나을지, 아니면 현재처럼 전역 유지가 나을지, 아니면 더 나은 관리 방식이 있다면 의견 공유 부탁드립니다 🍀📍 트러블 슈팅