카카오 로그인 및 비로그인 플로우 적용 .

This commit is contained in:
HyeongBaeYang committed 2026-01-21 16:09:29 +09:00
1 parent 2acf4e2cb6
commit 662b6b80bc
15 files changed
+1393 -335

No files matched your search

+72 -87
View File
@@ -50,129 +50,114 @@ const formatReportText = (text: string): React.ReactNode[] => {
});
};
// 마크다운 report를 섹션별로 파싱
const parseReport = (report: string) => {
if (!report || report.trim() === '') {
return [];
}
// 셀링 포인트 카드 타입
interface SellingPointCard {
title: string;
items: string[];
}
const sections: { title: string; content: string }[] = [];
const lines = report.split('\n');
let currentTitle = '';
let currentContent: string[] = [];
let hasMarkdownHeaders = report.includes('## ');
// facilities 배열을 셀링 포인트 카드 형태로 변환
const parseSellingPoints = (facilities: string[]): SellingPointCard[] => {
// 기본 카테고리 정의
const categories: SellingPointCard[] = [
{ title: '브랜드 컨셉', items: [] },
{ title: '프라이버시', items: [] },
{ title: '로컬 결합', items: [] },
{ title: '무드/비주얼', items: [] },
{ title: '편의/신뢰', items: [] },
{ title: '체류형 가치', items: [] },
];
// 마크다운 헤더가 없는 경우 전체 텍스트를 하나의 섹션으로 반환
if (!hasMarkdownHeaders) {
return [{ title: '분석 결과', content: report.trim() }];
}
lines.forEach((line) => {
if (line.startsWith('## ')) {
if (currentTitle || currentContent.length > 0) {
sections.push({ title: currentTitle, content: currentContent.join('\n').trim() });
}
currentTitle = line.replace('## ', '').trim();
currentContent = [];
} else if (!line.startsWith('# ')) {
currentContent.push(line);
// facilities를 카테고리에 분배 (최대 2개씩)
facilities.forEach((facility, idx) => {
const categoryIdx = Math.floor(idx / 2) % categories.length;
if (categories[categoryIdx].items.length < 2) {
categories[categoryIdx].items.push(facility);
}
});
if (currentTitle || currentContent.length > 0) {
sections.push({ title: currentTitle, content: currentContent.join('\n').trim() });
}
return sections.filter(s => s.content && !s.title.includes('JSON'));
// 아이템이 있는 카테고리만 반환
return categories.filter(cat => cat.items.length > 0);
};
const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, onGenerate, data }) => {
const { processed_info, marketing_analysis } = data;
const tags = marketing_analysis.tags || [];
const facilities = marketing_analysis.facilities || [];
const reportSections = parseReport(marketing_analysis.report);
const sellingPoints = parseSellingPoints(facilities);
return (
<div className="analysis-container">
{/* Back Button */}
<div className="back-button-container" style={{ marginLeft: 0 }}>
<button onClick={onBack} className="btn-back">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M15 18l-6-6 6-6" />
</svg>
뒤로가기
</button>
</div>
{/* Header Area */}
<div className="analysis-header-area">
{/* Back Button */}
<div className="back-button-container">
<button onClick={onBack} className="btn-back">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M15 18l-6-6 6-6" />
</svg>
뒤로가기
</button>
</div>
{/* Header */}
<div className="analysis-header">
<div className="analysis-icon">
<svg className="w-8 h-8" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2l2.4 7.2L22 12l-7.6 2.4L12 22l-2.4-7.2L2 12l7.6-2.4z" />
</svg>
{/* Header */}
<div className="analysis-header">
<div className="analysis-icon">
<svg className="w-8 h-8" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2l2.4 7.2L22 12l-7.6 2.4L12 22l-2.4-7.2L2 12l7.6-2.4z" />
</svg>
</div>
<h1 className="page-title">브랜드 분석</h1>
<p className="page-subtitle">
쉽고 빠르게, 브랜드 소셜 미디어 캠페인을 만드세요.
</p>
</div>
<h1 className="page-title">브랜드 분석</h1>
<p className="page-subtitle">
쉽고 빠르게, 브랜드 소셜 미디어 캠페인을 만드세요.
</p>
</div>
{/* Main Content Grid */}
<div className="analysis-grid">
{/* Brand Identity */}
{/* Left: Brand Identity (Scrollable) */}
<div className="brand-identity-card">
<div className="brand-header">
<span className="section-title">브랜드 정체성</span>
<span className="brand-subtitle">AI 마케팅 분석 요약</span>
</div>
<div className="brand-info">
<h2 className="brand-name">{processed_info.customer_name}</h2>
<p className="brand-location">{processed_info.region} · {processed_info.detail_region_info}</p>
</div>
<div className="brand-content">
<div className="brand-info">
<h2 className="brand-name">{processed_info.customer_name}</h2>
<p className="brand-location">{processed_info.detail_region_info}</p>
</div>
{/* Marketing Analysis Summary */}
<div className="report-section">
<div className="report-content custom-scrollbar">
{reportSections.length === 0 ? (
<div>
{marketing_analysis.report
? formatReportText(marketing_analysis.report)
: '분석 결과가 없습니다.'}
</div>
) : (
<div className="report-sections">
{reportSections.map((section, idx) => (
<div key={idx}>
{section.title && <h4 className="report-section-title">{section.title}</h4>}
<div>
{formatReportText(section.content)}
</div>
</div>
))}
</div>
)}
<div className="report-content">
{marketing_analysis.report
? formatReportText(marketing_analysis.report)
: '분석 결과가 없습니다.'}
</div>
</div>
</div>
{/* Right Cards */}
{/* Right: Selling Points & Keywords (Fixed) */}
<div className="analysis-cards-column">
{/* Main Selling Points (Facilities) */}
<div className="feature-card">
<span className="section-title-purple">주요 셀링 포인트</span>
<div className="tags-wrapper">
{facilities.map((facility, idx) => (
<span key={idx} className="feature-tag">
{facility}
</span>
{/* Main Selling Points */}
<div className="feature-card selling-points-card">
<span className="section-title">주요 셀링 포인트</span>
<div className="selling-points-grid">
{sellingPoints.map((point, idx) => (
<div key={idx} className="selling-point-item">
<span className="selling-point-title">{point.title}</span>
<div className="selling-point-content">
{point.items.map((item, itemIdx) => (
<p key={itemIdx}>{item}</p>
))}
</div>
</div>
))}
</div>
</div>
{/* Recommended Target Keywords (Tags) */}
<div className="feature-card">
{/* Recommended Target Keywords */}
<div className="feature-card keywords-card">
<span className="section-title">추천 타겟 키워드</span>
<div className="tags-wrapper">
{tags.map((tag, idx) => (