Skip to content

Commit 922dbcd

Browse files
authored
Merge pull request #179 from kwnt-dev/chore/#178-frontend-comments-cleanup
chore: フロントエンドコメント追加・不要コード削除
2 parents afee909 + 4c43ec6 commit 922dbcd

59 files changed

Lines changed: 384 additions & 248 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/admin/cells/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ import { ConfirmDialog } from "@/components/ui/ConfirmDialog";
1919

2020
type CellType = "damage" | "ban" | "rain";
2121

22-
// 登録済みセルをcellId形式に変換(表示用)
22+
/** 登録済みセルをcellId形式に変換(表示用) */
2323
function groupsToCellIds(groups: CellGroup[], holeNumber: number): string[] {
2424
return groups
2525
.filter((g) => g.hole_number === holeNumber)
2626
.flatMap((g) => g.cells.map((c) => `cell_${c.x}_${c.y}`));
2727
}
2828

29-
// 全ホールの登録済みセルマップ(GreenCardGrid用)
29+
/** 全ホールの登録済みセルマップ(GreenCardGrid用) */
3030
function groupsToCellsMap(groups: CellGroup[]): Record<number, string[]> {
3131
const map: Record<number, string[]> = {};
3232
groups.forEach((g) => {
@@ -38,6 +38,7 @@ function groupsToCellsMap(groups: CellGroup[]): Record<number, string[]> {
3838
return map;
3939
}
4040

41+
/** セル設定ページ(左: 9ホール一覧、右: セル編集キャンバス) */
4142
export default function CellsEditPage() {
4243
const [course, setCourse] = useState<"out" | "in">("out");
4344
const [selectedHole, setSelectedHole] = useState<number>(1);
@@ -397,7 +398,6 @@ export default function CellsEditPage() {
397398
rainCells={cellMode === "rain" ? displayCells : []}
398399
onCellClick={handleCellClick}
399400
enablePaintMode={true}
400-
activeCells={displayCells}
401401
showExit={false}
402402
showExitRoute={false}
403403
showBoundaryBuffer={false}

app/admin/history/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Button } from "@/components/ui/button";
1414
import api from "@/lib/axios";
1515
import { PageHeader } from "@/components/layout/PageHeader";
1616
import { History as HistoryIcon, FileText } from "lucide-react";
17+
/** 日付ごとの履歴データ */
1718
type DateGroup = {
1819
date: string;
1920
eventName: string | null;
@@ -23,6 +24,7 @@ type DateGroup = {
2324
pdfUrl: string | null;
2425
};
2526

27+
/** ピン履歴ページ(日付別の履歴一覧、PDF表示) */
2628
export default function HistoryPage() {
2729
const [histories, setHistories] = useState<DateGroup[]>([]);
2830
const [searchTerm, setSearchTerm] = useState("");

app/admin/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { HelpButton } from "@/components/ui/HelpButton";
1515
import { toast } from "sonner";
1616
import { Loader2 } from "lucide-react";
1717

18+
/** セッションステータスのバッジ表示(未作成/作成中/公開中/確認済み/送信済み) */
1819
function StatusBadge({ session }: { session: PinSession | null }) {
1920
if (!session) {
2021
return (
@@ -54,6 +55,7 @@ function StatusBadge({ session }: { session: PinSession | null }) {
5455
}
5556
}
5657

58+
/** 管理者ダッシュボード(左: コースグリッド、右: 自動提案 or ピン編集の二画面構成) */
5759
export default function DashboardPage() {
5860
const router = useRouter();
5961
const {

app/admin/pdf-preview/page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ async function exportGridToImage(
119119

120120
/**
121121
* OUT/INグリッドからPDF Blobを生成する共通処理
122+
* Blob: PDFファイルのバイナリデータをメモリ上に保持するオブジェクト(Web API)
123+
* ダウンロード時はBlobからURL生成、送信時はBlobからBase64に変換して使う
122124
*/
123125
async function generatePdfBlob(
124126
outRef: React.RefObject<HTMLDivElement | null>,
@@ -154,6 +156,7 @@ function blobToBase64(blob: Blob): Promise<string> {
154156
});
155157
}
156158

159+
/** PDFプレビュー画面の本体(セッションからピン取得→OUT/INグリッド表示→PDF生成・送信) */
157160
function PDFPreviewContent() {
158161
const outRef = useRef<HTMLDivElement>(null);
159162
const inRef = useRef<HTMLDivElement>(null);
@@ -312,6 +315,7 @@ function PDFPreviewContent() {
312315
);
313316
}
314317

318+
/** PDFプレビューページ(useSearchParams: URLのクエリパラメータを取得するNext.jsフック。Suspense境界が必要) */
315319
export default function PDFPreviewPage() {
316320
return (
317321
<Suspense fallback={<Loading />}>

app/admin/schedule/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { HelpButton } from "@/components/ui/HelpButton";
2828
import { toast } from "sonner";
2929
import { ConfirmDialog } from "@/components/ui/ConfirmDialog";
3030

31+
/** 予定データの型 */
3132
type Schedule = {
3233
id: string;
3334
date: string;
@@ -36,6 +37,7 @@ type Schedule = {
3637
notes: string | null;
3738
};
3839

40+
/** 予定表ページ(カレンダー形式でイベント名・組数を管理) */
3941
export default function SchedulePage() {
4042
const [currentMonth, setCurrentMonth] = useState(() => new Date());
4143
const [schedules, setSchedules] = useState<Schedule[]>([]);

app/admin/users/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { Users } from "lucide-react";
2424
import { toast } from "sonner";
2525
import { ConfirmDialog } from "@/components/ui/ConfirmDialog";
2626

27+
/** ユーザーデータの型 */
2728
type User = {
2829
id: string;
2930
name: string;
@@ -32,6 +33,7 @@ type User = {
3233
created_at: string;
3334
};
3435

36+
/** ユーザー管理ページ(一覧表示・新規追加・編集・削除) */
3537
export default function UsersPage() {
3638
const [users, setUsers] = useState<User[]>([]);
3739
const [isOpen, setIsOpen] = useState(false);

app/login/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import api from "@/lib/axios";
1818
import { GolfIcon } from "@/components/ui/GolfIcon";
1919
import { RotateCcw } from "lucide-react";
2020

21+
/** ログインページ */
2122
export default function LoginPage() {
2223
const [email, setEmail] = useState("");
2324
const [password, setPassword] = useState("");
@@ -26,6 +27,7 @@ export default function LoginPage() {
2627
const [resetting, setResetting] = useState(false);
2728
const [resetMessage, setResetMessage] = useState("");
2829

30+
// デモデータリセット(全データを初期状態に戻す)
2931
async function handleDemoReset() {
3032
if (resetting) return;
3133

@@ -53,6 +55,7 @@ export default function LoginPage() {
5355
}
5456
}
5557

58+
// ログイン処理(成功後、roleに応じて管理者/スタッフ画面に遷移)
5659
async function handleSubmit(e: React.FormEvent) {
5760
e.preventDefault();
5861
setError("");

app/staff/hole/[id]/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ThemeToggle } from "@/components/theme/ThemeToggle";
99
import { getPinSessionDetail } from "@/lib/pinSession";
1010
import { useContainerSize } from "@/hooks/useContainerSize";
1111

12+
/** スタッフ用ホール個別編集ページ(ピン位置の確認・修正・保存) */
1213
export default function StaffHoleEditPage() {
1314
const params = useParams();
1415
const searchParams = useSearchParams();
@@ -100,6 +101,7 @@ export default function StaffHoleEditPage() {
100101
loadCells();
101102
}, [holeNumber]);
102103

104+
// ピン保存(既存ピンを削除→新しい位置で再作成)
103105
async function handleSave() {
104106
if (!pin || !sessionId) return;
105107

app/staff/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { getPinSessions, PinSession } from "@/lib/pinSession";
77
import { LogOut } from "lucide-react";
88
import { ThemeToggle } from "@/components/theme/ThemeToggle";
99

10+
/** 日付文字列を「M/D(曜日)」形式に変換 */
1011
function formatDate(dateStr: string | null): string {
1112
if (!dateStr) return "";
1213
const date = new Date(dateStr + "T00:00:00");
@@ -17,6 +18,7 @@ function formatDate(dateStr: string | null): string {
1718
return `${month}/${day}${weekday})`;
1819
}
1920

21+
/** スタッフホーム画面(OUT/INの選択画面) */
2022
export default function StaffPage() {
2123
const router = useRouter();
2224
const { user, logout } = useAuth();

0 commit comments

Comments
 (0)