260921_02_ENH: KON, KIWI 설문 URL 앞부분 수정 못하게 막기

This commit is contained in:
2026-09-21 12:48:10 +09:00
parent 3181535e16
commit 96d9b3baf8

View File

@@ -182,6 +182,26 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
})
}
// KON/KIWI는 호스트 placeholder까지 고정하고 '?' 이후 쿼리스트링만 편집 가능하게 한다.
const konKiwiPlaceholderPrefix = survey.surveyTy === SurveyType.KIWI ? 'https://[$KIWI-URL]' : 'https://[$KON-URL]'
// 저장 후 생성된 실제 URL(surveyFullUrl)이 있으면 placeholder 대신 실제 호스트를 접두어로 노출한다.
const konKiwiDisplayPrefix = survey.surveyUrl?.trim()
? survey.surveyUrl.split('?')[0]
: konKiwiPlaceholderPrefix
const konKiwiQuery = (() => {
const url = survey.surveyUrl ?? ''
const idx = url.indexOf('?')
return idx >= 0 ? url.slice(idx + 1) : ''
})()
const handleKonKiwiQueryChange = (query: string) => {
onChange(survey.uiKey, {
surveyUrl: `${konKiwiPlaceholderPrefix}?${query}`,
surveyFullUrl: null,
surveyShortUrl: null,
})
}
return (
<div className="space-y-3 rounded-lg border p-4">
<div className="flex items-center justify-between">
@@ -248,18 +268,34 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
<div className="space-y-2">
<Label className="text-base">설문 URL</Label>
<Input
ref={onRegisterFieldRef(survey.uiKey, 'surveyUrl')}
value={survey.surveyUrl || ''}
onChange={(e) => onChange(survey.uiKey, {
surveyUrl: e.target.value,
surveyFullUrl: null,
surveyShortUrl: null,
})}
placeholder="https://"
className="h-9"
aria-invalid={invalidField === 'surveyUrl'}
/>
{isKonKiwi ? (
<div className="flex items-center">
<span className="inline-flex h-9 items-center whitespace-nowrap rounded-l-md border border-r-0 bg-gray-100 px-3 text-sm text-muted-foreground">
{konKiwiDisplayPrefix}?
</span>
<Input
ref={onRegisterFieldRef(survey.uiKey, 'surveyUrl')}
value={konKiwiQuery}
onChange={(e) => handleKonKiwiQueryChange(e.target.value)}
placeholder="sid=[$SID]"
className="h-9 rounded-l-none"
aria-invalid={invalidField === 'surveyUrl'}
/>
</div>
) : (
<Input
ref={onRegisterFieldRef(survey.uiKey, 'surveyUrl')}
value={survey.surveyUrl || ''}
onChange={(e) => onChange(survey.uiKey, {
surveyUrl: e.target.value,
surveyFullUrl: null,
surveyShortUrl: null,
})}
placeholder="https://"
className="h-9"
aria-invalid={invalidField === 'surveyUrl'}
/>
)}
</div>
{survey.surveyTy === SurveyType.EXTERNAL && (