|
|
|
|
@@ -13,7 +13,7 @@ import {useDialog} from '@/hooks/useDialog'
|
|
|
|
|
import ResultCodeDialog from '@/components/dialog/ResultCodeDialog'
|
|
|
|
|
import { useDebouncedValue, useMounted } from "@kri/common/hooks";
|
|
|
|
|
import { LoadingOverlayAdapter } from '@/components/app-shell/LoadingOverlayAdapter'
|
|
|
|
|
import { X } from 'lucide-react'
|
|
|
|
|
import { X, Copy, Check } from 'lucide-react'
|
|
|
|
|
import {
|
|
|
|
|
ProjectInfo, ProjectSurvey, ProjectUpdateRequest, ResultCode,
|
|
|
|
|
ProjectStatus, ResultCodeType, SurveyType
|
|
|
|
|
@@ -123,7 +123,6 @@ const createSurveyDraft = (surveyOrder: number): SurveyDraft => ({
|
|
|
|
|
surveyPrjctCd: '',
|
|
|
|
|
surveyUrl: '',
|
|
|
|
|
surveyFullUrl: null,
|
|
|
|
|
surveyShortUrl: null,
|
|
|
|
|
surveyDashboardUrl: '',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
@@ -168,7 +167,6 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
|
|
|
|
|
surveyPrjctCd: '',
|
|
|
|
|
surveyUrl: '',
|
|
|
|
|
surveyFullUrl: null,
|
|
|
|
|
surveyShortUrl: null,
|
|
|
|
|
surveyDashboardUrl: '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@@ -178,7 +176,6 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
|
|
|
|
|
surveyPrjctCd: value,
|
|
|
|
|
surveyUrl: buildKonKiwiSurveyUrl(survey.surveyTy),
|
|
|
|
|
surveyFullUrl: null,
|
|
|
|
|
surveyShortUrl: null,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -198,10 +195,22 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
|
|
|
|
|
onChange(survey.uiKey, {
|
|
|
|
|
surveyUrl: `${konKiwiPlaceholderPrefix}?${query}`,
|
|
|
|
|
surveyFullUrl: null,
|
|
|
|
|
surveyShortUrl: null,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const [urlCopied, setUrlCopied] = useState(false)
|
|
|
|
|
const handleCopyUrl = async () => {
|
|
|
|
|
const url = survey.surveyUrl?.trim() ?? ''
|
|
|
|
|
if (!url) return
|
|
|
|
|
try {
|
|
|
|
|
await navigator.clipboard.writeText(url)
|
|
|
|
|
setUrlCopied(true)
|
|
|
|
|
setTimeout(() => setUrlCopied(false), 1500)
|
|
|
|
|
} catch {
|
|
|
|
|
// 클립보드 접근 실패 시 무시
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-3 rounded-lg border p-4">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
@@ -268,34 +277,45 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
|
|
|
|
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<Label className="text-base">설문 URL</Label>
|
|
|
|
|
{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>
|
|
|
|
|
<div className="flex items-center gap-2">
|
|
|
|
|
{isKonKiwi ? (
|
|
|
|
|
<div className="flex flex-1 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={konKiwiQuery}
|
|
|
|
|
onChange={(e) => handleKonKiwiQueryChange(e.target.value)}
|
|
|
|
|
placeholder="sid=[$SID]"
|
|
|
|
|
className="h-9 rounded-l-none"
|
|
|
|
|
value={survey.surveyUrl || ''}
|
|
|
|
|
onChange={(e) => onChange(survey.uiKey, {
|
|
|
|
|
surveyUrl: e.target.value,
|
|
|
|
|
surveyFullUrl: null,
|
|
|
|
|
})}
|
|
|
|
|
placeholder="https://"
|
|
|
|
|
className="h-9 flex-1"
|
|
|
|
|
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'}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
)}
|
|
|
|
|
<Button
|
|
|
|
|
type="button"
|
|
|
|
|
variant="outline"
|
|
|
|
|
onClick={handleCopyUrl}
|
|
|
|
|
disabled={!survey.surveyUrl?.trim()}
|
|
|
|
|
aria-label="설문 URL 복사"
|
|
|
|
|
className="h-9 w-9 shrink-0 p-0"
|
|
|
|
|
>
|
|
|
|
|
{urlCopied ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{survey.surveyTy === SurveyType.EXTERNAL && (
|
|
|
|
|
|