@@ -8,6 +8,8 @@ import api from "@/lib/axios";
88import { ThemeToggle } from "@/components/theme/ThemeToggle" ;
99import { getPinSessionDetail } from "@/lib/pinSession" ;
1010import { useContainerSize } from "@/hooks/useContainerSize" ;
11+ import { useHoleData } from "@/hooks/useHoleData" ;
12+ import { getBoundaryIntersectionY } from "@/lib/greenCanvas.geometry" ;
1113
1214/** スタッフ用ホール個別編集ページ(ピン位置の確認・修正・保存) */
1315export default function StaffHoleEditPage ( ) {
@@ -38,6 +40,21 @@ export default function StaffHoleEditPage() {
3840 const [ containerRef , containerSize ] = useContainerSize ( ) ;
3941 const canvasSize =
4042 Math . floor ( Math . min ( containerSize . width , containerSize . height ) ) || 400 ;
43+ const holeData = useHoleData ( holeId ) ;
44+
45+ // ゴルフ場座標(PDF版と同じ: 奥行き + グリーンエッジからの左右距離)
46+ const pinLabel = ( ( ) => {
47+ if ( ! pin || ! holeData ) return null ;
48+ const depth = Math . round ( holeData . origin . y - pin . y ) ;
49+ if ( pin . x === 30 ) return `奥${ depth } yd 中心` ;
50+ const edges = getBoundaryIntersectionY ( holeData . boundary . d , pin . y ) ;
51+ if ( ! edges ) return `奥${ depth } yd` ;
52+ const side = pin . x < 30 ? "左" : "右" ;
53+ const dist = Math . round (
54+ pin . x < 30 ? pin . x - edges . left : edges . right - pin . x ,
55+ ) ;
56+ return `奥${ depth } yd ${ side } ${ dist } yd` ;
57+ } ) ( ) ;
4158
4259 useEffect ( ( ) => {
4360 if ( ! sessionId ) return ;
@@ -125,29 +142,36 @@ export default function StaffHoleEditPage() {
125142
126143 return (
127144 < div className = "h-screen bg-background flex flex-col overflow-hidden" >
128- < header className = "flex-shrink-0 h-14 px-4 bg-card border-b flex items-center justify-between" >
145+ < header className = "flex-shrink-0 min- h-14 py-1 px-4 bg-card border-b flex items-center justify-between" >
129146 < button
130147 onClick = { ( ) => router . push ( isOut ? "/staff/out" : "/staff/in" ) }
131148 className = "text-sm font-medium text-muted-foreground"
132149 >
133150 ← 戻る
134151 </ button >
135- < div className = "flex items-center gap-2" >
136- < button
137- onClick = { ( ) => hasPrev && navigateHole ( holeNumber - 1 ) }
138- disabled = { ! hasPrev }
139- className = "p-1 rounded disabled:opacity-30"
140- >
141- < ChevronLeft size = { 20 } />
142- </ button >
143- < h1 className = "text-lg font-bold" > Hole { holeId } </ h1 >
144- < button
145- onClick = { ( ) => hasNext && navigateHole ( holeNumber + 1 ) }
146- disabled = { ! hasNext }
147- className = "p-1 rounded disabled:opacity-30"
148- >
149- < ChevronRight size = { 20 } />
150- </ button >
152+ < div className = "flex flex-col items-center" >
153+ < div className = "flex items-center gap-2" >
154+ < button
155+ onClick = { ( ) => hasPrev && navigateHole ( holeNumber - 1 ) }
156+ disabled = { ! hasPrev }
157+ className = "p-1 rounded disabled:opacity-30"
158+ >
159+ < ChevronLeft size = { 20 } />
160+ </ button >
161+ < h1 className = "text-lg font-bold" > Hole { holeId } </ h1 >
162+ < button
163+ onClick = { ( ) => hasNext && navigateHole ( holeNumber + 1 ) }
164+ disabled = { ! hasNext }
165+ className = "p-1 rounded disabled:opacity-30"
166+ >
167+ < ChevronRight size = { 20 } />
168+ </ button >
169+ </ div >
170+ { pinLabel && (
171+ < span className = "text-sm font-semibold text-foreground" >
172+ { pinLabel }
173+ </ span >
174+ ) }
151175 </ div >
152176 < div className = "flex items-center gap-2" >
153177 < ThemeToggle />
0 commit comments