dev(test): /test prefill 을 뷰성형외과 fixture 로 고정
- pickRandomIndex → pickIndex(PINNED_LABEL) 로 변경, 항상 뷰성형외과 선택. - "다른 병원 랜덤" 버튼·seed state 제거 (의미 없어짐). - CLINICS 의 나머지 9개 fixture 는 mockUrls.ts 에 그대로 보존. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>main
parent
da07bdc8c8
commit
68bb1d62cd
|
|
@ -5,19 +5,21 @@
|
||||||
* - "다른 병원 랜덤" 버튼으로 재선택 가능
|
* - "다른 병원 랜덤" 버튼으로 재선택 가능
|
||||||
* - DevOnly 가드 아래 등록되어 localhost에서만 접근
|
* - DevOnly 가드 아래 등록되어 localhost에서만 접근
|
||||||
*/
|
*/
|
||||||
import { useMemo, useState } from 'react'
|
|
||||||
import { useNavigate } from 'react-router'
|
import { useNavigate } from 'react-router'
|
||||||
import MultiChannelInput, { type AnalyzePayload } from '@/features/channels/components/MultiChannelInput'
|
import MultiChannelInput, { type AnalyzePayload } from '@/features/channels/components/MultiChannelInput'
|
||||||
import { CLINICS } from '../fixtures/mockUrls'
|
import { CLINICS } from '../fixtures/mockUrls'
|
||||||
|
|
||||||
function pickRandomIndex(): number {
|
// 현재는 뷰성형외과만 prefill 한다. CLINICS 의 다른 fixture 는 삭제하지 않고 보존.
|
||||||
return Math.floor(Math.random() * CLINICS.length)
|
const PINNED_LABEL = '뷰성형외과'
|
||||||
|
|
||||||
|
function pickIndex(): number {
|
||||||
|
const i = CLINICS.findIndex((c) => c.label === PINNED_LABEL)
|
||||||
|
return i >= 0 ? i : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function TestPrefillPage() {
|
export default function TestPrefillPage() {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const [seed, setSeed] = useState(0)
|
const index = pickIndex()
|
||||||
const index = useMemo(() => pickRandomIndex(), [seed])
|
|
||||||
const clinic = CLINICS[index]
|
const clinic = CLINICS[index]
|
||||||
|
|
||||||
const handleAnalyze = (payload: AnalyzePayload) => {
|
const handleAnalyze = (payload: AnalyzePayload) => {
|
||||||
|
|
@ -45,18 +47,11 @@ export default function TestPrefillPage() {
|
||||||
{' '}<span className="text-slate-400">({index + 1} / {CLINICS.length})</span>
|
{' '}<span className="text-slate-400">({index + 1} / {CLINICS.length})</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<button
|
{/* 현재 PINNED_LABEL 하나만 사용하므로 랜덤 버튼은 숨김.
|
||||||
type="button"
|
필요 시 pickIndex() 를 다시 randomize 하고 이 버튼을 복구. */}
|
||||||
onClick={() => setSeed((s) => s + 1)}
|
|
||||||
className="px-4 py-2 rounded-lg bg-white border border-slate-200 text-sm font-medium text-slate-700 hover:bg-slate-50 shadow-sm"
|
|
||||||
>
|
|
||||||
다른 병원 랜덤
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* key={seed} 로 강제 remount — initialUrls는 mount 시점 1회만 반영되기 때문 */}
|
|
||||||
<MultiChannelInput
|
<MultiChannelInput
|
||||||
key={seed}
|
|
||||||
variant="hero"
|
variant="hero"
|
||||||
initialUrls={clinic.urls}
|
initialUrls={clinic.urls}
|
||||||
onAnalyze={handleAnalyze}
|
onAnalyze={handleAnalyze}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue