Skip to content

feat: 스토리 등록 구현 (#84)#100

Merged
wkdtnqls0506 merged 11 commits intomainfrom
feature/PRODUCT-181
Jul 29, 2025
Merged

feat: 스토리 등록 구현 (#84)#100
wkdtnqls0506 merged 11 commits intomainfrom
feature/PRODUCT-181

Conversation

@wkdtnqls0506
Copy link
Contributor

@wkdtnqls0506 wkdtnqls0506 commented Jul 27, 2025

✅ 이슈 번호

close #84


🪄 작업 내용 (변경 사항)

  • 스토리 등록 기능 구현

    • 페이지 UI 구현
    • 스토리 등록 API 연동 /api/stories
  • 이미지 업로드 Context 추가


📸 스크린샷

스토리 등록

2025-07-28.2.40.36.2.mov

파일 크기가 5MB 넘었을 때

스크린샷 2025-07-28 오전 2 42 05

💡 설명

/story/register 페이지 구조: 이미지 → 설명 → 가게 선택 → 제출 버튼

<VStack as='main' justify='between' className={styles.mainWrapper}>
  <VStack>
    <StoryImagePreview />    // 이미지 미리보기 & 변경
    <StoryDescription />     // 설명 입력 (선택사항, 300자)
    <StorySearchStore />     // 가게 검색 & 선택, StoreSearchBottomSheet 사용
  </VStack>
  <StorySubmitButton isPending={isPending} />  // 제출 버튼
</VStack>

🗣️ 리뷰어에게 전달 사항

이미지 싱태 관리 관련

  • 전역 Context로 이미지 파일과 미리보기 URL 상태를 관리합니다.
  • useImageUploadContext 커스텀 훅으로 접근하며 홈 → 스토리 등록 페이지 간 이미지 전달을 위한 목적입니다~!

현재 UploadProvider를 app/layout.tsx에서 감싸 전역 범위로 설정해두었습니다.
다만 이미지 공유가 / → /story/register 흐름에서만 사용되기 때문에 라우트 그룹 단위로 범위를 좁히는게 나을지, 아니면 현재처럼 전역 유지가 나을지, 아니면 더 나은 관리 방식이 있다면 의견 공유 부탁드립니다 🍀


📍 트러블 슈팅

@wkdtnqls0506 wkdtnqls0506 added the ✨ feature 새로운 기능 추가 label Jul 27, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 27, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/PRODUCT-181

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Seojunhwan
Seojunhwan previously approved these changes Jul 28, 2025
import { z } from "zod";

export const imageFileSchema = z
.instanceof(File)
Copy link
Member

Choose a reason for hiding this comment

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

P2: z.file(); 사용해보는 것은 어떨까요?!

refs

Comment on lines +18 to +21
const setUpload = (newFile: File, newPreviewUrl: string) => {
setFile(newFile);
setPreviewUrl(newPreviewUrl);
};
Copy link
Member

Choose a reason for hiding this comment

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

P99999999: update???나 고러한 느낌으로 맞추는 건 어떨까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

onUpdateUpload -> props 네이밍 컨벤션 맞춰보기

const image = useWatch<StoryRegisterFormData>({ name: "image" });
const storeName = useWatch<StoryRegisterFormData>({ name: "storeName" });

const isDisabled = !image || !storeName || !isValid || isPending;
Copy link
Member

Choose a reason for hiding this comment

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

잊으시오,, const isDisabled = [image, storeName, isValid, isPending].every(Boolean);

Comment on lines +18 to +33
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;
}
Copy link
Member

Choose a reason for hiding this comment

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

P999 image upload 로직은 어느정도 hook으로 추출해서 사용해볼 수 있을 것 같아요!

prop 조금 받아서욥

Base automatically changed from feature/PRODUCT-211 to main July 28, 2025 15:44
@wkdtnqls0506 wkdtnqls0506 dismissed Seojunhwan’s stale review July 28, 2025 15:44

The base branch was changed.

@wkdtnqls0506 wkdtnqls0506 merged commit 120b7e1 into main Jul 29, 2025
3 checks passed
@wkdtnqls0506 wkdtnqls0506 deleted the feature/PRODUCT-181 branch July 29, 2025 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature 새로운 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PRODUCT-181] 스토리 등록 구현

2 participants