260921_02_ENH: KON, KIWI 설문 URL 앞부분 수정 못하게 막기
This commit is contained in:
@@ -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 (
|
return (
|
||||||
<div className="space-y-3 rounded-lg border p-4">
|
<div className="space-y-3 rounded-lg border p-4">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
@@ -248,18 +268,34 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
|
|||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label className="text-base">설문 URL</Label>
|
<Label className="text-base">설문 URL</Label>
|
||||||
<Input
|
{isKonKiwi ? (
|
||||||
ref={onRegisterFieldRef(survey.uiKey, 'surveyUrl')}
|
<div className="flex items-center">
|
||||||
value={survey.surveyUrl || ''}
|
<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">
|
||||||
onChange={(e) => onChange(survey.uiKey, {
|
{konKiwiDisplayPrefix}?
|
||||||
surveyUrl: e.target.value,
|
</span>
|
||||||
surveyFullUrl: null,
|
<Input
|
||||||
surveyShortUrl: null,
|
ref={onRegisterFieldRef(survey.uiKey, 'surveyUrl')}
|
||||||
})}
|
value={konKiwiQuery}
|
||||||
placeholder="https://"
|
onChange={(e) => handleKonKiwiQueryChange(e.target.value)}
|
||||||
className="h-9"
|
placeholder="sid=[$SID]"
|
||||||
aria-invalid={invalidField === 'surveyUrl'}
|
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>
|
</div>
|
||||||
|
|
||||||
{survey.surveyTy === SurveyType.EXTERNAL && (
|
{survey.surveyTy === SurveyType.EXTERNAL && (
|
||||||
|
|||||||
Reference in New Issue
Block a user