모든 ui / ux 변경 작업 .
This commit is contained in:
1 parent
95928c0b66
commit
f8bebdac52
9 files changed
+505
-445
No files matched your search
@@ -8,12 +8,62 @@ interface AnalysisResultSectionProps {
|
||||
data: CrawlingResponse;
|
||||
}
|
||||
|
||||
// 텍스트를 포맷팅 ([] 기준 줄바꿈, 해시태그 스타일링)
|
||||
const formatReportText = (text: string): React.ReactNode[] => {
|
||||
if (!text) return [];
|
||||
|
||||
// [제목] 패턴을 기준으로 분리
|
||||
const parts = text.split(/(\[[^\]]+\])/g).filter(Boolean);
|
||||
|
||||
return parts.map((part, idx) => {
|
||||
// [제목] 패턴인 경우
|
||||
if (part.match(/^\[[^\]]+\]$/)) {
|
||||
const title = part.slice(1, -1); // [] 제거
|
||||
return (
|
||||
<span key={idx}>
|
||||
{idx > 0 && <br />}
|
||||
<br />
|
||||
<strong style={{ color: '#94FBE0' }}>[{title}]</strong>
|
||||
<br />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
// 해시태그 처리
|
||||
const hashtagParts = part.split(/(#[^\s#]+)/g);
|
||||
return (
|
||||
<span key={idx}>
|
||||
{hashtagParts.map((segment, segIdx) => {
|
||||
if (segment.startsWith('#')) {
|
||||
return (
|
||||
<span key={segIdx} style={{ color: '#A78BFA' }}>
|
||||
{segment}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return segment;
|
||||
})}
|
||||
</span>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
// 마크다운 report를 섹션별로 파싱
|
||||
const parseReport = (report: string) => {
|
||||
if (!report || report.trim() === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
const sections: { title: string; content: string }[] = [];
|
||||
const lines = report.split('\n');
|
||||
let currentTitle = '';
|
||||
let currentContent: string[] = [];
|
||||
let hasMarkdownHeaders = report.includes('## ');
|
||||
|
||||
// 마크다운 헤더가 없는 경우 전체 텍스트를 하나의 섹션으로 반환
|
||||
if (!hasMarkdownHeaders) {
|
||||
return [{ title: '분석 결과', content: report.trim() }];
|
||||
}
|
||||
|
||||
lines.forEach((line) => {
|
||||
if (line.startsWith('## ')) {
|
||||
@@ -31,11 +81,11 @@ const parseReport = (report: string) => {
|
||||
sections.push({ title: currentTitle, content: currentContent.join('\n').trim() });
|
||||
}
|
||||
|
||||
return sections.filter(s => s.title && s.content && !s.title.includes('JSON'));
|
||||
return sections.filter(s => s.content && !s.title.includes('JSON'));
|
||||
};
|
||||
|
||||
const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, onGenerate, data }) => {
|
||||
const { processed_info, marketing_analysis, image_list } = data;
|
||||
const { processed_info, marketing_analysis } = data;
|
||||
const tags = marketing_analysis.tags || [];
|
||||
const facilities = marketing_analysis.facilities || [];
|
||||
const [showFullReport, setShowFullReport] = useState(false);
|
||||
@@ -71,57 +121,53 @@ const AnalysisResultSection: React.FC<AnalysisResultSectionProps> = ({ onBack, o
|
||||
{/* Brand Identity */}
|
||||
<div className="brand-identity-card">
|
||||
<div className="brand-header">
|
||||
<span className="section-title mb-0">브랜드 정체성</span>
|
||||
<span className="text-gray-500 text-sm">AI 마케팅 분석 요약</span>
|
||||
<span className="section-title">브랜드 정체성</span>
|
||||
<span className="brand-subtitle">AI 마케팅 분석 요약</span>
|
||||
</div>
|
||||
|
||||
<h2 className="brand-name">{processed_info.customer_name}</h2>
|
||||
<p className="brand-location">{processed_info.region} · {processed_info.detail_region_info}</p>
|
||||
<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>
|
||||
|
||||
{/* Marketing Analysis Summary */}
|
||||
<div className="flex-1">
|
||||
<div className="flex-between mb-3">
|
||||
<button
|
||||
onClick={() => setShowFullReport(!showFullReport)}
|
||||
className="report-toggle"
|
||||
>
|
||||
{showFullReport ? '간략히 보기' : '자세히 보기'}
|
||||
</button>
|
||||
</div>
|
||||
<div className="report-section">
|
||||
<button
|
||||
onClick={() => setShowFullReport(!showFullReport)}
|
||||
className="report-toggle"
|
||||
>
|
||||
{showFullReport ? '간략히 보기' : '자세히 보기'}
|
||||
</button>
|
||||
<div className="report-content custom-scrollbar">
|
||||
{showFullReport ? (
|
||||
<div className="space-y-4">
|
||||
{reportSections.length === 0 ? (
|
||||
<div>
|
||||
{marketing_analysis.report
|
||||
? formatReportText(marketing_analysis.report)
|
||||
: '분석 결과가 없습니다.'}
|
||||
</div>
|
||||
) : showFullReport ? (
|
||||
<div className="report-sections">
|
||||
{reportSections.map((section, idx) => (
|
||||
<div key={idx}>
|
||||
<h4 className="report-section-title">{section.title}</h4>
|
||||
<p className="text-gray-300" style={{ lineHeight: 1.625 }}>{section.content}</p>
|
||||
{section.title && <h4 className="report-section-title">{section.title}</h4>}
|
||||
<div>
|
||||
{formatReportText(section.content)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-gray-300">
|
||||
{reportSections[0]?.content.slice(0, 150)}...
|
||||
</p>
|
||||
<div>
|
||||
{formatReportText(
|
||||
reportSections[0]?.content.length > 150
|
||||
? `${reportSections[0].content.slice(0, 150)}...`
|
||||
: reportSections[0]?.content || ''
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Image Preview */}
|
||||
{image_list.length > 0 && (
|
||||
<div className="image-preview-section">
|
||||
<span className="image-preview-title">수집된 이미지 ({image_list.length}장)</span>
|
||||
<div className="image-preview-grid">
|
||||
{image_list.slice(0, 8).map((img, idx) => (
|
||||
<div key={idx} className="image-preview-item">
|
||||
<img src={img} alt={`이미지 ${idx + 1}`} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{image_list.length > 8 && (
|
||||
<p className="image-preview-more">+{image_list.length - 8}장 더 있음</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Right Cards */}
|
||||
|
||||
Reference in new issue
Block a user