Skip to content

charge画面の追加#4

Open
kkkk0113 wants to merge 5 commits intomainfrom
feature-charge
Open

charge画面の追加#4
kkkk0113 wants to merge 5 commits intomainfrom
feature-charge

Conversation

@kkkk0113
Copy link
Copy Markdown
Collaborator

charge/insert画面の追加

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

チャージフローに「投入(insert)」画面と「完了(complete)」画面を追加し、選択したチャージ金額を画面間で保持できるようにする変更です。

Changes:

  • Zustand の useChargeStore を追加し、チャージ金額を保持
  • /charge/insert/charge/complete の画面を新規追加し、導線を更新
  • ルーティング型定義(generouted)に新パスを追加

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sysken-pay-front/src/store/useChargeStore.ts チャージ金額を保持する Zustand store を追加
sysken-pay-front/src/router.ts 新しいチャージ関連パスを型定義へ追加
sysken-pay-front/src/pages/charge/select.tsx 次画面遷移前にチャージ金額を保存するよう更新
sysken-pay-front/src/pages/charge/insert.tsx 投入案内画面を追加し完了へ遷移
sysken-pay-front/src/pages/charge/index.tsx ダミー残高の値を更新
sysken-pay-front/src/pages/charge/complete.tsx チャージ完了表示画面を追加

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +17 to 22
const handleNext = () => {
const normalizedChargeAmount =
Number(chargeAmount.replace(/[^\d]/g, "")) || 0;
saveChargeAmount(normalizedChargeAmount);
navigate("/charge/insert");
};
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

handleNext が未入力/不正入力時に normalizedChargeAmount を 0 にしてそのまま次画面へ遷移してしまい、0円チャージが成立してしまいます。最低金額(例: 1円以上 or ボタンで選べる金額のみ)をバリデーションし、条件を満たさない場合は遷移を止めてエラーメッセージ表示などの UX を追加してください。

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +36
<ArrowButton variant="prev" onClick={() => navigate("/charge/select")}>
戻る
</ArrowButton>
<ArrowButton variant="next" onClick={() => handleNext("user123")}>
完了
</ArrowButton>
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

完了ボタンで handleNext("user123") を呼んでおり、スキャン済みユーザーID(/chargesetBalance({ userId: barcode, ... }) した値)を上書きしてしまいます。誤ユーザーへのチャージ/表示につながるので、既存の useBalanceStore から userId を参照するか、遷移時に userId を引き回してこのページではハードコードしないでください。

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +20
const chargeAmount = useChargeStore((state) => state.chargeAmount);
const setBalance = useBalanceStore((state) => state.setBalance);

const handleNext = (barcode: string) => {
// TODO: APIから残高を参照
setBalance({
userId: barcode,
balance: 550,
});
navigate("/charge/complete");
};
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

このページで setBalance({ balance: 550 }) に固定値を入れており、選択した chargeAmount が残高に反映されません(少なくともフロントのスタブとしては既存残高 + chargeAmount などが自然です)。API 実装までの暫定でも、現在の useBalanceStore の残高を取得して加算する/もしくは TODO コメントを「チャージ処理」等に修正して誤解を避けてください。

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +15
<div className="flex flex-col items-center justify-center gap-8 h-full">
<div className="text-6xl font-bold text-[#454a53] mb-13 mt-50">
チャージが完了しました
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

mb-13mt-50 は Tailwind のデフォルト spacing scale に存在しないため(このリポジトリには tailwind.config も見当たらず)、スタイルが適用されない可能性が高いです。既存のスケール(例: mb-12, mt-12, mt-48 など)に合わせるか、必要なら mb-[...] / mt-[...] の任意値クラスを使ってください。

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +6
export default function Charge() {
const navigate = useNavigate();
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

complete.tsx のコンポーネント名が function Charge() になっており、pages/charge/index.tsxCharge と同名です。デバッグ時の表示やスタックトレースが紛らわしくなるため、ChargeCompletePage 等にリネームしてください。

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +11
const handleHome = () => {
navigate("/");
};
return (
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

useChargeStoreclearChargeAmount が用意されていますが、チャージ完了後にクリアされないため次回チャージ開始時に前回金額が残る可能性があります。handleHome(またはこの画面の初期化処理)で clearChargeAmount() を呼ぶなどして、フロー完了時に状態をリセットしてください。

Copilot uses AI. Check for mistakes.
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.

2 participants