Skip to content

fix(feed): require map-selected creation location#7

Merged
seoJing merged 1 commit into
mainfrom
feature/spot-api-contract-sync
May 23, 2026
Merged

fix(feed): require map-selected creation location#7
seoJing merged 1 commit into
mainfrom
feature/spot-api-contract-sync

Conversation

@seoJing
Copy link
Copy Markdown
Member

@seoJing seoJing commented May 23, 2026

Summary

  • require feed creation payloads to include backend-required lat/lng
  • replace free-text activity location input with a map point picker in offer/request creation flows
  • tighten first-step required fields and preserve selected coordinates in the draft state
  • add API and picker regression tests for coordinate-backed feed creation

Test Plan

  • pnpm test -- src/features/post/api/post-api.test.ts src/features/post/ui/post-form/MapLocationPicker.test.tsx
  • pnpm lint (passes with existing 7 warnings)
  • pnpm build
  • notjing final gate: pass

Notes

  • Actual feed creation POST smoke test was intentionally skipped to avoid leaving test data in the backend.

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 지도 기반 위치 선택 기능 추가 - 사용자가 지도에서 직접 활동 위치를 선택할 수 있습니다.
  • Refactor

    • 위치 입력 시스템이 텍스트 입력에서 좌표 기반 선택으로 변경되었습니다.
    • 위치 정보가 필수 입력값으로 변경되었습니다.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontend Ready Ready Preview, Comment May 23, 2026 12:28pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

📝 Walkthrough

Walkthrough

이 PR은 포스트 생성 폼의 위치 입력을 텍스트 기반 문자열에서 지도 선택 기반 좌표로 전환합니다. 새로운 MapLocationPicker UI 컴포넌트를 추가하고, 폼 상태 관리 훅을 확장하며, 양쪽 포스트 클라이언트 폼과 API 계약을 일관되게 업데이트합니다.

Changes

지도 기반 위치 선택 폼 전환

Layer / File(s) Summary
폼 데이터 모델 확장
src/features/post/model/types.ts
PostBaseFormData 인터페이스에 lat: number, lng: number 필드를 추가하여 폼이 위치 좌표를 저장하도록 확장합니다.
지도 위치 선택 UI 컴포넌트
src/features/post/ui/post-form/MapLocationPicker.tsx, src/features/post/ui/post-form/MapLocationPicker.test.tsx
MapLocationPicker 컴포넌트를 신규 추가하여 지도 캔버스에서 클릭으로 위치를 선택합니다. SelectedPostLocation 타입(lat, lng, label)을 내보내고, 선택 상태와 좌표 요약을 UI에 표시합니다. 두 개의 테스트 케이스로 선택 동작과 렌더링을 검증합니다.
폼 상태 관리 훅 확장
src/features/post/model/use-post-base-form.ts
usePostBaseForm 훅에 locationLat/locationLng 필드를 추가하고 로컬스토리지 저장/복구를 지원합니다. selectedLocation: SelectedPostLocation | nullsetSelectedLocation 함수를 반환하여 클라이언트 폼이 좌표 기반 위치를 관리할 수 있게 합니다.
PostBaseInfoSection 통합
src/features/post/ui/post-form/PostBaseInfoSection.tsx
위치 입력 계약을 location: string에서 selectedLocation: SelectedPostLocation | null로 변경합니다. 텍스트 InputMapLocationPicker로 교체하고 props 연결을 업데이트합니다. 게시글 내용 필드를 필수로 설정합니다.
OfferFormClient 폼 흐름 업데이트
src/features/post/client/OfferFormClient.tsx
폼 검증을 selectedLocation !== null로 변경합니다. 제출 단계에서 좌표 확인 로직을 추가하고, API 호출 시 selectedLocation.lat/lng으로 좌표를 전달합니다. PostBaseInfoSection 호출 시 새로운 위치 관련 props를 사용합니다.
RequestFormClient 폼 흐름 업데이트
src/features/post/client/RequestFormClient.tsx
OfferFormClient와 동일하게 폼 검증, 제출 로직, PostBaseInfoSection props를 좌표 기반으로 업데이트하여 일관된 위치 선택 경험을 제공합니다.
API 계약 및 테스트 업데이트
src/features/post/api/post-api.ts, src/features/post/api/post-api.test.ts
BasePostPayload의 좌표 필드를 선택적에서 필수로 변경합니다(lat: number, lng: number). 테스트에서 createOffer/createRequest 호출과 검증에 좌표 값을 포함하도록 업데이트합니다.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 풀 리퀘스트의 핵심 변경사항인 지도 기반 위치 선택 요구 사항을 정확하게 요약하고 있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/spot-api-contract-sync

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/features/post/model/use-post-base-form.ts (1)

5-5: ⚡ Quick win

모델 레이어에서 UI 타입을 직접 참조하지 않도록 분리해주세요.

use-post-base-form.ts../ui/post-form/MapLocationPicker의 타입에 의존하면 레이어 경계가 깨지고, UI 변경이 모델 훅 타입에 전파됩니다. SelectedPostLocationsrc/features/post/model/types.ts 같은 공용 모델 타입으로 이동하고, UI/훅이 둘 다 그 타입을 참조하도록 분리하는 편이 안전합니다.

예시 diff
- import type { SelectedPostLocation } from '../ui/post-form/MapLocationPicker';
+ import type { SelectedPostLocation } from './types';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/features/post/model/use-post-base-form.ts` at line 5,
use-post-base-form.ts currently imports SelectedPostLocation from the UI
component MapLocationPicker, breaking layer boundaries; move the
SelectedPostLocation type into a shared model file (e.g., create or update
src/features/post/model/types.ts) and export it there, then change
usePostBaseForm (use-post-base-form.ts) and the UI component MapLocationPicker
to import SelectedPostLocation from the new model types module so the model hook
(usePostBaseForm) no longer references UI internals.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/features/post/ui/post-form/MapLocationPicker.tsx`:
- Around line 61-71: The map currently only accepts clicks via MapV3Canvas with
onMapClickAction={handleSelect}, so add keyboard/assistive alternatives:
implement a focusable button like "Select current center" that calls
handleSelect(center) (use the existing center state), add optional text inputs
for latitude/longitude bound to center and a "Use coordinates" action that calls
handleSelect with parsed values, and ensure controls have accessible
labels/aria-describedby and keyboard focus order; reference MapV3Canvas,
handleSelect, and center/overlays when adding these elements so keyboard and
screen-reader users can complete the required location selection.

---

Nitpick comments:
In `@src/features/post/model/use-post-base-form.ts`:
- Line 5: use-post-base-form.ts currently imports SelectedPostLocation from the
UI component MapLocationPicker, breaking layer boundaries; move the
SelectedPostLocation type into a shared model file (e.g., create or update
src/features/post/model/types.ts) and export it there, then change
usePostBaseForm (use-post-base-form.ts) and the UI component MapLocationPicker
to import SelectedPostLocation from the new model types module so the model hook
(usePostBaseForm) no longer references UI internals.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 56c7d215-0bed-49e0-8359-c6e277972941

📥 Commits

Reviewing files that changed from the base of the PR and between f0e03c7 and fc2f048.

📒 Files selected for processing (9)
  • src/features/post/api/post-api.test.ts
  • src/features/post/api/post-api.ts
  • src/features/post/client/OfferFormClient.tsx
  • src/features/post/client/RequestFormClient.tsx
  • src/features/post/model/types.ts
  • src/features/post/model/use-post-base-form.ts
  • src/features/post/ui/post-form/MapLocationPicker.test.tsx
  • src/features/post/ui/post-form/MapLocationPicker.tsx
  • src/features/post/ui/post-form/PostBaseInfoSection.tsx

Comment thread src/features/post/ui/post-form/MapLocationPicker.tsx
@seoJing seoJing merged commit 491d70b into main May 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant