Merge pull request '260921_03_ENH: survey short url 쓸모가 없어서 폐기' (#40) from develop into master

Reviewed-on: #40
This commit is contained in:
2026-09-21 14:05:41 +09:00
3 changed files with 49 additions and 31 deletions

View File

@@ -13,7 +13,7 @@ import {useDialog} from '@/hooks/useDialog'
import ResultCodeDialog from '@/components/dialog/ResultCodeDialog' import ResultCodeDialog from '@/components/dialog/ResultCodeDialog'
import { useDebouncedValue, useMounted } from "@kri/common/hooks"; import { useDebouncedValue, useMounted } from "@kri/common/hooks";
import { LoadingOverlayAdapter } from '@/components/app-shell/LoadingOverlayAdapter' import { LoadingOverlayAdapter } from '@/components/app-shell/LoadingOverlayAdapter'
import { X } from 'lucide-react' import { X, Copy, Check } from 'lucide-react'
import { import {
ProjectInfo, ProjectSurvey, ProjectUpdateRequest, ResultCode, ProjectInfo, ProjectSurvey, ProjectUpdateRequest, ResultCode,
ProjectStatus, ResultCodeType, SurveyType ProjectStatus, ResultCodeType, SurveyType
@@ -123,7 +123,6 @@ const createSurveyDraft = (surveyOrder: number): SurveyDraft => ({
surveyPrjctCd: '', surveyPrjctCd: '',
surveyUrl: '', surveyUrl: '',
surveyFullUrl: null, surveyFullUrl: null,
surveyShortUrl: null,
surveyDashboardUrl: '', surveyDashboardUrl: '',
}) })
@@ -168,7 +167,6 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
surveyPrjctCd: '', surveyPrjctCd: '',
surveyUrl: '', surveyUrl: '',
surveyFullUrl: null, surveyFullUrl: null,
surveyShortUrl: null,
surveyDashboardUrl: '', surveyDashboardUrl: '',
}) })
} }
@@ -178,7 +176,6 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
surveyPrjctCd: value, surveyPrjctCd: value,
surveyUrl: buildKonKiwiSurveyUrl(survey.surveyTy), surveyUrl: buildKonKiwiSurveyUrl(survey.surveyTy),
surveyFullUrl: null, surveyFullUrl: null,
surveyShortUrl: null,
}) })
} }
@@ -198,10 +195,22 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
onChange(survey.uiKey, { onChange(survey.uiKey, {
surveyUrl: `${konKiwiPlaceholderPrefix}?${query}`, surveyUrl: `${konKiwiPlaceholderPrefix}?${query}`,
surveyFullUrl: null, 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 ( 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">
@@ -268,34 +277,45 @@ 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>
{isKonKiwi ? ( <div className="flex items-center gap-2">
<div className="flex items-center"> {isKonKiwi ? (
<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"> <div className="flex flex-1 items-center">
{konKiwiDisplayPrefix}? <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">
</span> {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 <Input
ref={onRegisterFieldRef(survey.uiKey, 'surveyUrl')} ref={onRegisterFieldRef(survey.uiKey, 'surveyUrl')}
value={konKiwiQuery} value={survey.surveyUrl || ''}
onChange={(e) => handleKonKiwiQueryChange(e.target.value)} onChange={(e) => onChange(survey.uiKey, {
placeholder="sid=[$SID]" surveyUrl: e.target.value,
className="h-9 rounded-l-none" surveyFullUrl: null,
})}
placeholder="https://"
className="h-9 flex-1"
aria-invalid={invalidField === 'surveyUrl'} aria-invalid={invalidField === 'surveyUrl'}
/> />
</div> )}
) : ( <Button
<Input type="button"
ref={onRegisterFieldRef(survey.uiKey, 'surveyUrl')} variant="outline"
value={survey.surveyUrl || ''} onClick={handleCopyUrl}
onChange={(e) => onChange(survey.uiKey, { disabled={!survey.surveyUrl?.trim()}
surveyUrl: e.target.value, aria-label="설문 URL 복사"
surveyFullUrl: null, className="h-9 w-9 shrink-0 p-0"
surveyShortUrl: null, >
})} {urlCopied ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
placeholder="https://" </Button>
className="h-9" </div>
aria-invalid={invalidField === 'surveyUrl'}
/>
)}
</div> </div>
{survey.surveyTy === SurveyType.EXTERNAL && ( {survey.surveyTy === SurveyType.EXTERNAL && (

View File

@@ -41,7 +41,6 @@ export const QrCodeToolbar = ({ editor, surveys }: QrCodeToolbarProps) => {
.map((survey, index) => { .map((survey, index) => {
const value = const value =
survey.surveyUrl?.trim() || survey.surveyUrl?.trim() ||
survey.surveyShortUrl?.trim() ||
survey.surveyFullUrl?.trim() || survey.surveyFullUrl?.trim() ||
'' ''

View File

@@ -35,7 +35,6 @@ export type ProjectSurvey = {
surveyPrjctCd?: string | null; surveyPrjctCd?: string | null;
surveyUrl?: string | null; surveyUrl?: string | null;
surveyFullUrl?: string | null; surveyFullUrl?: string | null;
surveyShortUrl?: string | null;
surveyDashboardUrl?: string | null; surveyDashboardUrl?: string | null;
}; };