재로그인 버그 수정, test 버튼 추가, 브랜드 분석페이지 수정 .

This commit is contained in:
HyeongBaeYang committed 2026-02-03 16:24:04 +09:00
1 parent 61892a5d93
commit e66eca1aca
10 files changed
+804 -173

No files matched your search

+86 -136
View File
@@ -15,14 +15,14 @@ const SparklesIcon = ({ className = '' }: { className?: string }) => (
);
const MapPinIcon = () => (
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M12 22s7-6.1 7-12a7 7 0 10-14 0c0 5.9 7 12 7 12z" />
<circle cx="12" cy="10" r="3" />
</svg>
);
const TargetIcon = () => (
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<circle cx="12" cy="12" r="8" />
<circle cx="12" cy="12" r="3" />
<path d="M12 2v4M22 12h-4M12 22v-4M2 12h4" />
@@ -30,7 +30,7 @@ const TargetIcon = () => (
);
const UsersIcon = () => (
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M16 11a4 4 0 10-8 0" />
<path d="M4 20c0-3.3 3.6-6 8-6s8 2.7 8 6" />
<circle cx="12" cy="7" r="3" />
@@ -38,7 +38,7 @@ const UsersIcon = () => (
);
const LayoutGridIcon = () => (
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<rect x="3" y="3" width="7" height="7" />
<rect x="14" y="3" width="7" height="7" />
<rect x="14" y="14" width="7" height="7" />
@@ -47,7 +47,7 @@ const LayoutGridIcon = () => (
);
const ChartIcon = () => (
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M18 20V10M12 20V4M6 20v-6" />
</svg>
);
@@ -84,14 +84,14 @@ const AnimatedItem: React.FC<AnimatedItemProps> = ({ children, index, baseDelay
// 애니메이션 USP 아이템 컴포넌트
interface AnimatedUSPItemProps {
usp: { category: string; description: string; score: number };
usp: SellingPoint;
index: number;
isTop?: boolean;
}
const AnimatedUSPItem: React.FC<AnimatedUSPItemProps> = ({ usp, index, isTop = false }) => {
const [isVisible, setIsVisible] = useState(false);
const delay = index * 150; // 각 아이템마다 150ms 딜레이
const delay = index * 150;
useEffect(() => {
const timer = setTimeout(() => {
@@ -103,60 +103,51 @@ const AnimatedUSPItem: React.FC<AnimatedUSPItemProps> = ({ usp, index, isTop = f
if (isTop) {
return (
<div
className={`mb-6 p-5 rounded-xl bg-gradient-to-r from-brand-accent/10 to-brand-purple/10 border border-brand-accent/30 relative overflow-hidden transition-all duration-500 ${
className={`bi-usp-top transition-all duration-500 ${
isVisible ? 'opacity-100 translate-y-0' : 'opacity-0 -translate-y-4'
}`}
>
<div className="absolute top-0 right-0 w-20 h-20 bg-brand-accent/5 rounded-full -translate-y-1/2 translate-x-1/2"></div>
<div className="relative z-10 flex justify-between items-center">
<div>
<div className="flex items-center gap-2 mb-2">
<span className="text-xs text-brand-accent font-bold uppercase tracking-wider">{usp.category}</span>
<span className="text-xs bg-brand-accent/20 text-brand-accent px-2 py-0.5 rounded font-semibold">TOP</span>
</div>
<div className="text-lg font-bold text-white">{usp.description}</div>
</div>
<div className="flex items-center gap-3 mb-3">
<span className="bi-usp-category bi-usp-category-accent">{usp.english_category}</span>
<span className="bi-usp-badge">TOP</span>
</div>
<div className="bi-usp-korean-category">{usp.korean_category}</div>
<div className="bi-usp-description">{usp.description}</div>
</div>
);
}
return (
<div
className={`p-4 rounded-xl bg-brand-bg/40 border border-white/5 hover:bg-brand-bg/60 transition-all duration-500 ${
className={`bi-usp-item transition-all duration-500 ${
isVisible ? 'opacity-100 translate-y-0' : 'opacity-0 -translate-y-4'
}`}
>
<div>
<div className="text-xs text-brand-muted font-bold uppercase tracking-tight mb-1">{usp.category}</div>
<div className="text-base font-bold text-white">{usp.description}</div>
</div>
<div className="bi-usp-english-category mb-2">{usp.english_category}</div>
<div className="bi-usp-korean-category">{usp.korean_category}</div>
<div className="bi-usp-description">{usp.description}</div>
</div>
);
};
// 레이더 차트 컴포넌트
interface RadarChartProps {
data: { category: string; description: string; score: number }[];
data: SellingPoint[];
size?: number;
}
const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
// 애니메이션을 위한 현재 점수 상태 (0에서 시작)
const [animatedScores, setAnimatedScores] = useState<number[]>(data.map(() => 0));
const [isAnimating, setIsAnimating] = useState(true);
// 애니메이션 효과
useEffect(() => {
const targetScores = data.map(item => item.score);
const duration = 1500; // 1.5초
const duration = 1500;
const startTime = Date.now();
const animate = () => {
const elapsed = Date.now() - startTime;
const progress = Math.min(elapsed / duration, 1);
// easeOutCubic 이징 함수 적용
const easeProgress = 1 - Math.pow(1 - progress, 3);
const newScores = targetScores.map(target => target * easeProgress);
@@ -172,18 +163,14 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
requestAnimationFrame(animate);
}, [data]);
// 라벨 공간을 위해 여유 공간 추가
const padding = 60;
const center = size / 2 + padding; // padding 만큼 오프셋
const maxRadius = size / 2 - 20; // 차트 반지름
const levels = 5; // 동심원 개수
// 각 축의 각도 계산
const center = size / 2 + padding;
const maxRadius = size / 2 - 20;
const levels = 5;
const angleStep = (2 * Math.PI) / data.length;
// 점수를 좌표로 변환 (0-100 점수를 반지름으로)
const getPoint = (index: number, score: number) => {
const angle = angleStep * index - Math.PI / 2; // -90도에서 시작 (12시 방향)
const angle = angleStep * index - Math.PI / 2;
const radius = (score / 100) * maxRadius;
return {
x: center + radius * Math.cos(angle),
@@ -191,21 +178,18 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
};
};
// 라벨 위치 계산
const getLabelPosition = (index: number) => {
const angle = angleStep * index - Math.PI / 2;
const radius = maxRadius + 20;
const radius = maxRadius + 25;
return {
x: center + radius * Math.cos(angle),
y: center + radius * Math.sin(angle),
};
};
// 애니메이션된 점수로 데이터 포인트 계산
const dataPoints = animatedScores.map((score, i) => getPoint(i, score));
const dataPath = dataPoints.map((p, i) => (i === 0 ? `M ${p.x} ${p.y}` : `L ${p.x} ${p.y}`)).join(' ') + ' Z';
// 동심원 경로 생성
const levelPaths = Array.from({ length: levels }, (_, levelIndex) => {
const levelRadius = ((levelIndex + 1) / levels) * maxRadius;
const points = data.map((_, i) => {
@@ -218,7 +202,6 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
return points.map((p, i) => (i === 0 ? `M ${p.x} ${p.y}` : `L ${p.x} ${p.y}`)).join(' ') + ' Z';
});
// 축 라인 경로
const axisLines = data.map((_, i) => {
const angle = angleStep * i - Math.PI / 2;
const endX = center + maxRadius * Math.cos(angle);
@@ -226,7 +209,6 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
return `M ${center} ${center} L ${endX} ${endY}`;
});
// SVG 전체 크기 (padding 포함)
const svgSize = size + padding * 2;
return (
@@ -237,7 +219,6 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
viewBox={`0 0 ${svgSize} ${svgSize}`}
style={{ overflow: 'visible' }}
>
{/* 동심원 (레벨) */}
{levelPaths.map((path, i) => (
<path
key={`level-${i}`}
@@ -248,7 +229,6 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
/>
))}
{/* 축 라인 */}
{axisLines.map((path, i) => (
<path
key={`axis-${i}`}
@@ -259,7 +239,6 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
/>
))}
{/* 데이터 영역 */}
<path
d={dataPath}
fill="rgba(45, 212, 191, 0.2)"
@@ -270,7 +249,6 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
}}
/>
{/* 데이터 포인트 */}
{dataPoints.map((point, i) => (
<circle
key={`point-${i}`}
@@ -283,7 +261,6 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
/>
))}
{/* 라벨 (한글 설명 + 영어 카테고리) */}
{data.map((item, i) => {
const pos = getLabelPosition(i);
const isLeft = pos.x < center - 10;
@@ -302,29 +279,23 @@ const RadarChart: React.FC<RadarChartProps> = ({ data, size = 280 }) => {
return (
<g key={`label-${i}`}>
{/* 한글 설명 (메인 라벨) */}
<text
x={pos.x}
y={pos.y}
dy={dy}
textAnchor={textAnchor}
fill="rgba(255,255,255,0.9)"
fontSize="11"
fontWeight="600"
className="bi-chart-label"
>
{item.description}
{item.korean_category}
</text>
{/* 영어 카테고리 (서브 라벨) */}
<text
x={pos.x}
y={pos.y}
dy={dy + 12}
dy={dy + 16}
textAnchor={textAnchor}
fill="rgba(255,255,255,0.4)"
fontSize="8"
fontWeight="400"
className="bi-chart-sublabel"
>
{item.category}
{item.english_category}
</text>
</g>
);
@@ -345,7 +316,6 @@ const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, o
const sellingPoints = marketing_analysis?.selling_points || [];
const targetKeywords = marketing_analysis?.target_keywords || [];
// 컨테이너 기준으로 버튼 위치 계산
useEffect(() => {
const updateButtonPosition = () => {
if (containerRef.current) {
@@ -357,7 +327,6 @@ const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, o
updateButtonPosition();
window.addEventListener('resize', updateButtonPosition);
// MutationObserver로 사이드바 변화 감지
const observer = new MutationObserver(updateButtonPosition);
observer.observe(document.body, { attributes: true, subtree: true, attributeFilter: ['class'] });
@@ -367,14 +336,13 @@ const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, o
};
}, []);
// 가장 높은 점수의 USP 찾기
const topUSP = sellingPoints.length > 0
? [...sellingPoints].sort((a, b) => b.score - a.score)[0]
: null;
return (
<div className="min-h-screen bg-brand-bg text-brand-text pb-24 selection:bg-brand-accent/30 font-sans">
{/* Header */}
<div className="asset-header">
<button onClick={onBack} className="btn-back-new">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
@@ -384,110 +352,99 @@ const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, o
</button>
</div>
<div className="text-center mb-10 px-4">
<div className="flex justify-center mb-4">
<div className="relative">
<SparklesIcon className="text-brand-accent w-8 h-8 animate-pulse relative z-10" />
</div>
{/* Page Header */}
<div className="bi-page-header">
<div className="bi-page-icon">
<SparklesIcon className="w-10 h-10 animate-pulse" />
</div>
<h1 className="text-4xl font-bold mb-3 tracking-tight text-white">브랜드 인텔리전스</h1>
<p className="text-brand-muted text-lg max-w-xl mx-auto">
<span className="text-brand-accent font-semibold">AI 데이터 분석</span>을 통해 도출된 {processed_info?.customer_name || '브랜드'}의 핵심 전략입니다.
<h1 className="bi-page-title">브랜드 인텔리전스</h1>
<p className="bi-page-desc">
<span className="highlight">AI 데이터 분석</span>을 통해 도출된 {processed_info?.customer_name || '브랜드'}의 핵심 전략입니다.
</p>
</div>
{/* Main Grid */}
<div ref={containerRef} className="max-w-7xl mx-auto px-4 md:px-8 grid grid-cols-1 lg:grid-cols-2 gap-8">
{/* 왼쪽 컬럼 */}
<div className="space-y-6">
{/* 브랜드 정체성 카드 */}
<div className="bg-brand-card rounded-3xl p-8 border border-brand-muted/10 shadow-lg relative overflow-hidden group hover:border-brand-accent/20 transition-all duration-500">
<div className="absolute top-0 left-0 w-1.5 h-full bg-gradient-to-b from-brand-accent to-brand-purple"></div>
<div className="mb-4 flex items-center gap-2">
<span className="text-brand-accent font-bold text-sm uppercase tracking-wider flex items-center gap-2">
<LayoutGridIcon /> 브랜드 정체성
</span>
<div className="bi-card relative overflow-hidden">
<div className="absolute top-0 left-0 w-1.5 h-full bg-gradient-to-b from-[#2dd4bf] to-[#AE72F9]"></div>
<div className="bi-section-label mb-4">
<LayoutGridIcon /> 브랜드 정체성
</div>
<h2 className="text-3xl font-bold mb-2 text-white tracking-tight">{processed_info?.customer_name || '브랜드명'}</h2>
<div className="flex items-start gap-2 text-brand-muted text-sm mb-6">
<h2 className="bi-brand-name">{processed_info?.customer_name || '브랜드명'}</h2>
<div className="bi-location mb-6">
<MapPinIcon />
<div>
<p>{processed_info?.detail_region_info || '주소 정보 없음'}</p>
<p className="opacity-70">{processed_info?.region || ''}</p>
<p style={{ opacity: 0.7, marginTop: '4px' }}>{processed_info?.region || ''}</p>
</div>
</div>
<div className="space-y-5 text-gray-300 leading-relaxed border-t border-white/5 pt-5">
<div className="space-y-6 border-t border-white/5 pt-6">
<AnimatedItem index={0} baseDelay={100}>
<h3 className="text-white font-semibold mb-2 text-sm text-brand-muted">입지 특성 분석</h3>
<p className="text-sm opacity-90">{brandIdentity?.location_feature_analysis || '정보 없음'}</p>
<div className="bi-subsection-title">입지 특성 분석</div>
<p className="bi-body-text">{brandIdentity?.location_feature_analysis || '정보 없음'}</p>
</AnimatedItem>
<AnimatedItem index={1} baseDelay={100}>
<h3 className="text-white font-semibold mb-2 text-sm text-brand-muted">컨셉 확장성</h3>
<p className="text-sm opacity-90">{brandIdentity?.concept_scalability || '정보 없음'}</p>
<div className="bi-subsection-title">컨셉 확장성</div>
<p className="bi-body-text">{brandIdentity?.concept_scalability || '정보 없음'}</p>
</AnimatedItem>
</div>
</div>
{/* 시장 포지셔닝 카드 */}
<div className="bg-brand-card rounded-3xl p-8 border border-brand-muted/10">
<h3 className="text-xl font-bold mb-6 flex items-center gap-2 text-white">
<div className="bi-card">
<h3 className="bi-card-title">
<TargetIcon /> 시장 포지셔닝
</h3>
<div className="grid grid-cols-1 gap-4">
<div className="space-y-4">
<AnimatedItem index={0} baseDelay={200}>
<div className="bg-gradient-to-r from-brand-bg/50 to-brand-cardHover p-5 rounded-xl border border-brand-muted/20 border-l-4 border-l-brand-accent">
<span className="block text-xs text-brand-accent mb-1 font-semibold">핵심 가치 (Core Value)</span>
<div className="font-semibold text-white">{marketPositioning?.core_value || '정보 없음'}</div>
<div className="bi-inner-box bi-inner-box-accent">
<div className="bi-subsection-title">핵심 가치 (Core Value)</div>
<div className="bi-value">{marketPositioning?.core_value || '정보 없음'}</div>
</div>
</AnimatedItem>
<AnimatedItem index={1} baseDelay={200}>
<div className="bg-brand-bg/50 p-5 rounded-xl border border-brand-muted/20 hover:border-brand-accent/30 transition-colors group">
<span className="block text-xs text-brand-muted mb-1 group-hover:text-brand-accent transition-colors">
카테고리 정의
</span>
<div className="font-bold text-lg text-white">{marketPositioning?.category_definition || '정보 없음'}</div>
<div className="bi-inner-box">
<div className="bi-subsection-title" style={{ color: '#6AB0B3' }}>카테고리 정의</div>
<div className="bi-value-large">{marketPositioning?.category_definition || '정보 없음'}</div>
</div>
</AnimatedItem>
</div>
</div>
{/* 타겟 페르소나 카드 */}
<div className="bg-brand-card rounded-3xl p-8 border border-brand-muted/10">
<h3 className="text-xl font-bold mb-6 flex items-center gap-2 text-white">
<div className="bi-card">
<h3 className="bi-card-title">
<UsersIcon /> 타겟 페르소나
</h3>
<div className="space-y-4">
{targetPersonas.length === 0 && <p className="text-sm text-brand-muted">정보 없음</p>}
{targetPersonas.length === 0 && <p className="bi-body-text" style={{ color: '#6AB0B3' }}>정보 없음</p>}
{targetPersonas.map((persona: TargetPersona, idx: number) => (
<AnimatedItem key={idx} index={idx} baseDelay={300}>
<div className="p-4 bg-brand-bg/30 rounded-xl border border-white/5 hover:border-brand-accent/20 transition-all group">
<div className="mb-3">
<div className="font-bold text-white group-hover:text-brand-accent transition-colors mb-1">
{persona.persona}
</div>
<div className="text-xs text-brand-muted">
{persona.age.min_age}~{persona.age.max_age}세
</div>
<div className="bi-inner-box">
<div className="mb-4">
<div className="bi-persona-name">{persona.persona}</div>
<div className="bi-persona-age">{persona.age.min_age}~{persona.age.max_age}세</div>
</div>
{persona.favor_target.length > 0 && (
<div className="flex flex-wrap gap-1.5 mb-3">
<div className="flex flex-wrap gap-2 mb-4">
{persona.favor_target.map((favor: string, i: number) => (
<span
key={i}
className="text-[10px] px-2 py-0.5 bg-brand-accent/10 text-brand-accent rounded-sm font-medium"
>
{favor}
</span>
<span key={i} className="bi-tag">{favor}</span>
))}
</div>
)}
{persona.decision_trigger && (
<p className="text-xs text-gray-400 border-t border-white/5 pt-2 mt-2">
<span className="text-brand-muted font-semibold">Trigger:</span> {persona.decision_trigger}
<p className="bi-persona-trigger">
<strong>Trigger:</strong> {persona.decision_trigger}
</p>
)}
</div>
@@ -500,16 +457,14 @@ const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, o
{/* 오른쪽 컬럼 */}
<div className="space-y-6">
{/* 주요 셀링 포인트 카드 */}
<div className="bg-brand-card rounded-3xl p-8 border border-brand-muted/10 min-h-[500px] flex flex-col relative overflow-hidden">
<div className="flex justify-between items-center mb-6 z-10">
<h3 className="text-xl font-bold text-white flex items-center gap-2">
<ChartIcon /> 주요 셀링 포인트 (USP)
</h3>
</div>
<div className="bi-card min-h-[500px] flex flex-col">
<h3 className="bi-card-title mb-6">
<ChartIcon /> 주요 셀링 포인트 (USP)
</h3>
{/* 레이더 차트 */}
{sellingPoints.length > 0 && (
<div className="mb-6">
<div className="mb-8">
<RadarChart data={sellingPoints} size={320} />
</div>
)}
@@ -524,10 +479,10 @@ const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, o
)}
{/* 나머지 USP 리스트 */}
<div className="space-y-3 z-10 flex-1">
{sellingPoints.length === 0 && <p className="text-sm text-brand-muted">정보 없음</p>}
<div className="space-y-4 flex-1">
{sellingPoints.length === 0 && <p className="bi-body-text" style={{ color: '#6AB0B3' }}>정보 없음</p>}
{sellingPoints
.filter((usp: SellingPoint) => usp.category !== topUSP?.category)
.filter((usp: SellingPoint) => usp.english_category !== topUSP?.english_category)
.map((usp: SellingPoint, idx: number) => (
<AnimatedUSPItem
key={idx}
@@ -542,18 +497,13 @@ const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, o
</div>
{/* 추천 타겟 키워드 */}
<div className="max-w-7xl mx-auto px-4 md:px-8 mt-8">
<div className="bg-brand-card rounded-3xl p-8 border border-brand-muted/10 relative overflow-hidden">
<h3 className="text-xl font-bold mb-6 text-white">추천 타겟 키워드</h3>
<div className="flex flex-wrap gap-3 relative z-10">
{targetKeywords.length === 0 && <span className="text-sm text-brand-muted">정보 없음</span>}
<div className="max-w-7xl mx-auto px-4 md:px-8 mt-10">
<div className="bi-card">
<h3 className="bi-card-title">추천 타겟 키워드</h3>
<div className="flex flex-wrap gap-3">
{targetKeywords.length === 0 && <span className="bi-body-text" style={{ color: '#6AB0B3' }}>정보 없음</span>}
{targetKeywords.map((keyword: string, idx: number) => (
<span
key={idx}
className="px-5 py-2.5 rounded-full bg-brand-card border border-brand-muted/30 text-white text-sm hover:border-brand-accent/50 transition-colors"
>
# {keyword}
</span>
<span key={idx} className="bi-tag-outline"># {keyword}</span>
))}
</div>
</div>