Skip to content

[FIX] 버스 이용시 1포인트 추가 로직 관련 수정 #690 - #691

Merged
zana0422-creator merged 2 commits into
developfrom
feat/bus-cost
Jul 25, 2026
Merged

[FIX] 버스 이용시 1포인트 추가 로직 관련 수정 #690#691
zana0422-creator merged 2 commits into
developfrom
feat/bus-cost

Conversation

@CallmeEterHist

@CallmeEterHist CallmeEterHist commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

close #690

image image image

Summary by CodeRabbit

  • New Features
    • Added bus-fare point requirements when visiting friend cities, including UI messaging for the required fare and point-based access blocking.
    • Added an error notification/toast that returns users to the student page after an insufficient-points visit is blocked.
  • Bug Fixes
    • Corrected friend-building requests to use the required request method.
    • Improved handling and redirection after insufficient-point errors.
  • Performance/Consistency
    • Updated route cache invalidation so MyPage/point updates reflect after fortune, guestbook, and lecture progress/review actions.
  • Other Updates
    • Added human-readable labeling for the Fortune point reason and expanded allowed remote image sources.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Friend-city building requests now use POST. Student and friend-city pages pass points to BusStation, which displays bus-fare requirements and blocks visits when funds are insufficient. Errors redirect with a toast, while point history and cache revalidation are updated.

Changes

Friend city bus-fare flow

Layer / File(s) Summary
Friend-building request method
src/app/services/city/service.ts
getFriendBuildings explicitly sends a POST request.
BusStation point gating
src/components/city/BusStation.tsx, src/app/student/page.tsx, src/app/student/users/[userId]/page.tsx
BusStation receives points, displays the bus-fare amount, and prevents friend navigation when points are insufficient.
Insufficient-funds redirect and toast
src/app/student/users/[userId]/page.tsx, src/app/student/page.tsx, src/components/city/BusFareErrorToast.tsx
Friend-city building loads handle status 400 with a redirect, while the student page displays the resulting error toast.
Point history and cache synchronization
src/features/point/type.ts, src/app/student/mypage/page.tsx, src/app/student/mypage/point/page.tsx, src/features/{city,guestbook,lecture}/action.ts
FORTUNE is added as a point reason, labeled in history views, and included in mypage cache revalidation after reward actions.
Remote image configuration
next.config.ts
HTTPS images from the specified CloudFront hostname and wildcard path are allowed.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related issues

Possibly related PRs

Suggested labels: 🐛 type: 버그

Suggested reviewers: zana0422-creator

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The POST method fix and bus-fare handling align with #690's friend-city visit API backend change.
Out of Scope Changes check ✅ Passed I don't see clear unrelated code changes; the extra revalidation and config updates appear tied to the point and visit flow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is clearly related to the main bus-fare point changes, though it omits the friend-city API and UI handling details.
✨ 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 feat/bus-cost

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/components/city/BusStation.tsx`:
- Around line 269-319: In the hasEnoughBusFare guard within the friend card
rendering, remove the native disabled attribute from the button while preserving
its unavailable styling, cursor state, and existing onClick toast handler so
clicks reliably display the insufficient-points message.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8771ccc6-5770-4dd3-af95-671e7423ba10

📥 Commits

Reviewing files that changed from the base of the PR and between e0b9703 and 21acdb6.

📒 Files selected for processing (5)
  • src/app/services/city/service.ts
  • src/app/student/page.tsx
  • src/app/student/users/[userId]/page.tsx
  • src/components/city/BusFareErrorToast.tsx
  • src/components/city/BusStation.tsx

Comment on lines +269 to +319
if (!hasEnoughBusFare) {
return (
<HoverCard
key={friend.userId}
openDelay={100}
closeDelay={0}
>
<HoverCardTrigger asChild>
<button
type="button"
disabled
onClick={() =>
toast.error(
"친구 도시 방문에 필요한 포인트가 부족합니다."
)
}
className="flex h-20 w-full cursor-not-allowed items-center gap-3 rounded-2xl border border-slate-100 bg-slate-50 p-3 text-left opacity-60"
>
<div className="flex size-11 shrink-0 items-center justify-center overflow-hidden rounded-full bg-slate-200 text-sm font-black text-slate-400">
{friend.profileImageUrl ? (
<img
src={friend.profileImageUrl}
alt={`${friend.nickname} 프로필`}
className="h-full w-full object-cover"
/>
) : (
friend.nickname.slice(0, 1)
)}
</div>

<div className="min-w-0">
<p className="truncate text-sm font-black text-slate-500">
{friend.nickname}
</p>
<p className="mt-0.5 text-xs font-bold text-slate-400">
친구 도시로 이동하기
</p>
</div>
</button>
</HoverCardTrigger>
<HoverCardContent
side="top"
align="center"
className="w-auto px-3 py-1.5 text-xs font-bold text-rose-500"
>
포인트가 부족해 지금은 이동할 수 없어요.
</HoverCardContent>
</HoverCard>
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate BusStation.tsx =="
fd -a 'BusStation\.tsx$' . || true

echo "== inspect relevant file length/path =="
if [ -f src/components/city/BusStation.tsx ]; then
  wc -l src/components/city/BusStation.tsx
  sed -n '240,340p' src/components/city/BusStation.tsx
fi

echo "== search for same button pattern =="
rg -n 'disabled[\s\n\t]*onClick|cursor-not-allowed' src/components/city/BusStation.tsx || true

echo "== behavioral probe: disabled button click handling in generated HTML/JSDOM-lite logic =="
python3 - <<'PY'
html = '''<button type="button" class="flex h-20 w-full cursor-not-allowed items-center gap-3 rounded-2xl border border-slate-100 bg-slate-50 p-3 text-left opacity-60" disabled onclick="toast.error(...);">
<div>
<img src="https://example.com/a.jpg" alt="A">
</div>
</button>'''
print("disabled native button contains nested img via child div")
print("HTML disabled attribute is present")
PY

Repository: MoMoFighters/FRONT-Fighters

Length of output: 8548


🌐 Web query:

W3C HTML buttons Disabled buttons do not dispatch click events

💡 Result:

According to the HTML specification, a form control—such as a button—that is disabled must prevent any click events that are queued on the user interaction task source from being dispatched on that element [1][2][3]. This requirement specifically targets the behavior of browser-native interaction events [2]. When a button is disabled, the browser prevents the standard activation behavior (such as submitting a form or firing a click event) that would otherwise occur upon user interaction [1][4]. While the specification is explicit regarding click events, practical implementation across different browsers has historically shown some nuance regarding other mouse events (like mousedown or mouseup) and whether event propagation occurs if an event is triggered on a descendant of a disabled element [2][5][6][7]. Because of these variations, developers often use CSS to ensure consistent behavior, such as setting pointer-events: none on disabled elements to completely prevent them from capturing or responding to mouse interactions [5]. In summary, the specification explicitly mandates the suppression of click events on disabled form controls to ensure they remain non-interactive [1][4].

Citations:


Rely on CSS/tooltip instead of a disabled native button for the toast trigger.

This card is already styled and explained as unavailable, so the native disabled attribute is unnecessary. On a normal native disabled button with nested descendants, click behavior can be inconsistent; removing disabled lets the existing onClick toast fire reliably on the unavailable friend cards.

🤖 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/components/city/BusStation.tsx` around lines 269 - 319, In the
hasEnoughBusFare guard within the friend card rendering, remove the native
disabled attribute from the button while preserving its unavailable styling,
cursor state, and existing onClick toast handler so clicks reliably display the
insufficient-points message.

@CallmeEterHist
CallmeEterHist marked this pull request as draft July 25, 2026 12:37
@CallmeEterHist
CallmeEterHist marked this pull request as ready for review July 25, 2026 13:15

@zana0422-creator zana0422-creator left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

확인했습니다

@zana0422-creator
zana0422-creator merged commit 08d122b into develop Jul 25, 2026
1 check was pending
@github-project-automation github-project-automation Bot moved this from Todo to Done in MoMocityproject Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚙️ type: 기능 프로젝트 기능 개발

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEAT] 친구 도시 방문 API 백엔드 코드 수정으로 인한 메소드 수정

2 participants