인디케이터 추가 및 css코드 분리
This commit is contained in:
1 parent
429c8d4708
commit
888ac4fa5e
45 files changed
+13009
-14040
No files matched your search
@@ -60,6 +60,7 @@ const BusinessNameInputModal: React.FC<BusinessNameInputModalProps> = ({ onClose
|
||||
<span className="manual-modal-title">{t('landing.hero.manualModalTitle')}</span>
|
||||
<button className="manual-modal-close" onClick={onClose}>✕</button>
|
||||
</div>
|
||||
<p className="manual-modal-subtitle">{t('landing.hero.manualModalSubtitle')}</p>
|
||||
|
||||
<div className="manual-modal-body">
|
||||
<div className="manual-modal-field">
|
||||
@@ -113,7 +114,7 @@ const BusinessNameInputModal: React.FC<BusinessNameInputModalProps> = ({ onClose
|
||||
onClick={handleSubmit}
|
||||
disabled={!isValid}
|
||||
>
|
||||
{t('landing.hero.analyzeButton')}
|
||||
{t('landing.hero.manualAnalyzeButton')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -36,8 +36,7 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [inputValue, setInputValue] = useState('');
|
||||
const [searchType, setSearchType] = useState<SearchType>('name');
|
||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
||||
const [searchType] = useState<SearchType>('name');
|
||||
const [isFocused, setIsFocused] = useState(false);
|
||||
const [isManualModalOpen, setIsManualModalOpen] = useState(false);
|
||||
const [localError, setLocalError] = useState('');
|
||||
@@ -47,16 +46,12 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
const [selectedItem, setSelectedItem] = useState<AccommodationSearchItem | null>(null);
|
||||
const [highlightedIndex, setHighlightedIndex] = useState<number>(-1);
|
||||
|
||||
const { filteredHistory, showHistory, openHistory, closeHistory, hideOnInput, deleteItem } = useSearchHistory(searchType === 'manual' ? 'name' : searchType);
|
||||
const { filteredHistory, showHistory, openHistory, closeHistory, hideOnInput, deleteItem } = useSearchHistory('name');
|
||||
const debounceRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const dropdownRef = useRef<HTMLDivElement>(null);
|
||||
const autocompleteRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
|
||||
setIsDropdownOpen(false);
|
||||
}
|
||||
if (autocompleteRef.current && !autocompleteRef.current.contains(event.target as Node)) {
|
||||
setShowAutocomplete(false);
|
||||
}
|
||||
@@ -65,19 +60,8 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
return () => document.removeEventListener('mousedown', handleClickOutside);
|
||||
}, []);
|
||||
|
||||
const searchTypeOptions = [
|
||||
{ value: 'url' as SearchType, label: 'URL' },
|
||||
{ value: 'name' as SearchType, label: t('landing.hero.searchTypeBusinessName') },
|
||||
];
|
||||
|
||||
const getPlaceholder = () =>
|
||||
searchType === 'url' ? 'https://naver.me/abcdef' : t('landing.hero.placeholderBusinessName');
|
||||
|
||||
const getGuideText = () =>
|
||||
searchType === 'url' ? t('landing.hero.guideUrl') : t('landing.hero.guideBusinessName');
|
||||
|
||||
const handleAutocompleteSearch = useCallback(async (query: string) => {
|
||||
if (!query.trim() || searchType !== 'name') {
|
||||
if (!query.trim()) {
|
||||
setAutocompleteResults([]);
|
||||
setShowAutocomplete(false);
|
||||
return;
|
||||
@@ -93,7 +77,7 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
} finally {
|
||||
setIsAutocompleteLoading(false);
|
||||
}
|
||||
}, [searchType]);
|
||||
}, []);
|
||||
|
||||
const handleSelectAutocomplete = (item: AccommodationSearchItem) => {
|
||||
setInputValue(item.title.replace(/<[^>]*>/g, ''));
|
||||
@@ -133,18 +117,20 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
};
|
||||
|
||||
const handleStart = () => {
|
||||
if (!inputValue.trim()) {
|
||||
setLocalError(searchType === 'url' ? t('landing.hero.errorUrlRequired') : t('landing.hero.errorNameRequired'));
|
||||
const trimmed = inputValue.trim();
|
||||
if (!trimmed) {
|
||||
setLocalError(t('landing.hero.errorInputRequired'));
|
||||
return;
|
||||
}
|
||||
if (searchType === 'url' && !isValidUrl(inputValue.trim())) {
|
||||
setLocalError(t('landing.hero.errorInvalidUrl'));
|
||||
if (isValidUrl(trimmed)) {
|
||||
setLocalError('');
|
||||
onAnalyze?.(trimmed, 'url');
|
||||
return;
|
||||
}
|
||||
|
||||
setLocalError('');
|
||||
|
||||
if (searchType === 'name' && selectedItem && onAutocomplete) {
|
||||
if (selectedItem && onAutocomplete) {
|
||||
onAutocomplete({
|
||||
address: selectedItem.address,
|
||||
roadAddress: selectedItem.roadAddress,
|
||||
@@ -168,44 +154,14 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
return (
|
||||
<div className="hero-form">
|
||||
<div className={`hero-input-wrapper ${isFocused ? 'focused' : ''} ${error ? 'error' : ''} ${inputValue && !isFocused ? 'filled' : ''}`}>
|
||||
{/* 드롭다운 */}
|
||||
<div className="hero-dropdown-container" ref={dropdownRef}>
|
||||
<button
|
||||
type="button"
|
||||
className="hero-dropdown-trigger"
|
||||
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
|
||||
>
|
||||
<span>{searchTypeOptions.find(opt => opt.value === searchType)?.label}</span>
|
||||
<svg
|
||||
width="12"
|
||||
height="12"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
className={`hero-dropdown-arrow ${isDropdownOpen ? 'open' : ''}`}
|
||||
>
|
||||
<path d="M6 9l6 6 6-6" />
|
||||
</svg>
|
||||
</button>
|
||||
{isDropdownOpen && (
|
||||
<div className="hero-dropdown-menu">
|
||||
{searchTypeOptions.map((option) => (
|
||||
<button
|
||||
key={option.value}
|
||||
type="button"
|
||||
className={`hero-dropdown-item ${searchType === option.value ? 'active' : ''}`}
|
||||
onClick={() => {
|
||||
setSearchType(option.value);
|
||||
setIsDropdownOpen(false);
|
||||
}}
|
||||
>
|
||||
{option.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{/* 유형 라벨 */}
|
||||
{/* <div className="hero-dropdown-container">
|
||||
<div className="hero-dropdown-trigger">
|
||||
<span className="hero-dropdown-main">
|
||||
{t('landing.hero.searchTypeLabel')}
|
||||
</span>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
{/* 입력 필드 */}
|
||||
<div className="hero-input-container" ref={autocompleteRef}>
|
||||
@@ -213,39 +169,28 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
type="text"
|
||||
value={inputValue}
|
||||
onChange={(e) => {
|
||||
let value = e.target.value;
|
||||
if (searchType === 'url') {
|
||||
const urlMatch = value.match(/https?:\/\/\S+/);
|
||||
if (urlMatch && urlMatch[0] !== value) value = urlMatch[0];
|
||||
}
|
||||
const value = e.target.value;
|
||||
setInputValue(value);
|
||||
setSelectedItem(null);
|
||||
setHighlightedIndex(-1);
|
||||
hideOnInput(value);
|
||||
if (localError) setLocalError('');
|
||||
if (searchType === 'name') {
|
||||
if (debounceRef.current) clearTimeout(debounceRef.current);
|
||||
if (debounceRef.current) clearTimeout(debounceRef.current);
|
||||
if (isValidUrl(value)) {
|
||||
setAutocompleteResults([]);
|
||||
setShowAutocomplete(false);
|
||||
} else {
|
||||
debounceRef.current = setTimeout(() => handleAutocompleteSearch(value), 300);
|
||||
}
|
||||
}}
|
||||
onPaste={(e: React.ClipboardEvent<HTMLInputElement>) => {
|
||||
if (searchType !== 'url') return;
|
||||
const pasted = e.clipboardData.getData('text');
|
||||
const urlMatch = pasted.match(/https?:\/\/[^\s]+/);
|
||||
if (urlMatch) {
|
||||
e.preventDefault();
|
||||
setInputValue(urlMatch[0]);
|
||||
if (localError) setLocalError('');
|
||||
}
|
||||
}}
|
||||
onFocus={() => {
|
||||
setIsFocused(true);
|
||||
if (searchType === 'name' && autocompleteResults.length > 0) setShowAutocomplete(true);
|
||||
if (autocompleteResults.length > 0) setShowAutocomplete(true);
|
||||
openHistory(inputValue);
|
||||
}}
|
||||
onBlur={() => { setIsFocused(false); setTimeout(() => closeHistory(), 150); }}
|
||||
onKeyDown={handleKeyDown}
|
||||
placeholder={getPlaceholder()}
|
||||
placeholder={t('landing.hero.placeholderCombined')}
|
||||
className={`hero-input ${inputValue ? 'has-value' : ''}`}
|
||||
/>
|
||||
|
||||
@@ -255,12 +200,8 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
items={filteredHistory}
|
||||
onSelect={(item) => {
|
||||
closeHistory();
|
||||
if (item.type === 'url') {
|
||||
setSearchType('url');
|
||||
setInputValue(item.value);
|
||||
} else {
|
||||
setSearchType('name');
|
||||
setInputValue(item.value);
|
||||
setInputValue(item.value);
|
||||
if (item.type === 'name') {
|
||||
setSelectedItem({ title: item.value, address: item.address || '', roadAddress: item.roadAddress || '' });
|
||||
}
|
||||
}}
|
||||
@@ -273,7 +214,7 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
)}
|
||||
|
||||
{/* 자동완성 결과 */}
|
||||
{showAutocomplete && searchType === 'name' && (
|
||||
{showAutocomplete && (
|
||||
<div className="hero-autocomplete-dropdown">
|
||||
{isAutocompleteLoading ? (
|
||||
<div className="hero-autocomplete-loading">{t('landing.hero.searching')}</div>
|
||||
@@ -313,7 +254,7 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
)}
|
||||
</div>
|
||||
|
||||
<span className="hero-input-hint">{getGuideText()}</span>
|
||||
<span className="hero-input-hint">{t('landing.hero.guideCombined')}</span>
|
||||
|
||||
{error && <p className="hero-error">{error}</p>}
|
||||
|
||||
@@ -321,9 +262,13 @@ const SearchInputForm: React.FC<SearchInputFormProps> = ({
|
||||
{t('landing.hero.analyzeButton')}
|
||||
</button>
|
||||
|
||||
<button type="button" className="hero-manual-button" onClick={handleManualButtonClick}>
|
||||
{t('landing.hero.searchTypeManual')}
|
||||
</button>
|
||||
<div className="hero-divider"><span>또는</span></div>
|
||||
|
||||
<div className="hero-manual-card" onClick={handleManualButtonClick} role="button" tabIndex={0}
|
||||
onKeyDown={(e) => e.key === 'Enter' && handleManualButtonClick()}>
|
||||
<span className="hero-manual-card-title">{t('landing.hero.searchTypeManual')}</span>
|
||||
<p className="hero-manual-button-desc">{t('landing.hero.manualButtonDesc')}</p>
|
||||
</div>
|
||||
|
||||
{/* onManualButtonClick 미제공 시 모달을 내부에서 관리 */}
|
||||
{!onManualButtonClick && isManualModalOpen && (
|
||||
|
||||
@@ -46,15 +46,6 @@ export const tutorialSteps: TutorialStepDef[] = [
|
||||
{
|
||||
key: TUTORIAL_KEYS.LANDING,
|
||||
hints: [
|
||||
{
|
||||
targetSelector: '.hero-dropdown-trigger',
|
||||
titleKey: 'tutorial.landing.dropdown.title',
|
||||
descriptionKey: 'tutorial.landing.dropdown.desc',
|
||||
position: 'top',
|
||||
clickToAdvance: false,
|
||||
noSpotlight: true,
|
||||
variant: 'bubble',
|
||||
},
|
||||
{
|
||||
targetSelector: '.hero-input-wrapper',
|
||||
titleKey: 'tutorial.landing.field.title',
|
||||
@@ -65,10 +56,10 @@ export const tutorialSteps: TutorialStepDef[] = [
|
||||
variant: 'bubble',
|
||||
},
|
||||
{
|
||||
targetSelector: '.hero-manual-button',
|
||||
targetSelector: '.hero-manual-card-title',
|
||||
titleKey: 'tutorial.landing.manual.title',
|
||||
descriptionKey: 'tutorial.landing.manual.desc',
|
||||
position: 'bottom',
|
||||
position: 'top',
|
||||
clickToAdvance: false,
|
||||
noSpotlight: true,
|
||||
variant: 'bubble',
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
interface WizardStepperProps {
|
||||
currentStep: number; // 0~3, matching wizardStep in GenerationFlow
|
||||
}
|
||||
|
||||
const WizardStepper: React.FC<WizardStepperProps> = ({ currentStep }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const steps = [
|
||||
t('wizardSteps.brandAnalysis'),
|
||||
t('wizardSteps.asset'),
|
||||
t('wizardSteps.sound'),
|
||||
t('wizardSteps.video'),
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="wizard-stepper">
|
||||
{steps.map((label, index) => {
|
||||
const isDone = index < currentStep;
|
||||
const isCurrent = index === currentStep;
|
||||
const stateClass = isDone ? ' done' : isCurrent ? ' current' : ' pending';
|
||||
|
||||
return (
|
||||
<React.Fragment key={index}>
|
||||
{/* 노드: 2rem 고정 너비. 라벨은 absolute로 노드 중심 아래에 붙음 */}
|
||||
<div className={`wizard-step${stateClass}`}>
|
||||
<div className="wizard-stepper-node">
|
||||
{isDone ? (
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
||||
<path d="M2.5 7L5.5 10L11.5 4" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||
</svg>
|
||||
) : (
|
||||
<span>{index + 1}</span>
|
||||
)}
|
||||
</div>
|
||||
<span className="wizard-stepper-label">{label}</span>
|
||||
</div>
|
||||
|
||||
{/* 연결선: flex:1로 남은 공간을 균등하게 채움 */}
|
||||
{index < steps.length - 1 && (
|
||||
<div className={`wizard-step-line${isDone ? ' done' : ''}`} />
|
||||
)}
|
||||
</React.Fragment>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default WizardStepper;
|
||||
Reference in new issue
Block a user