feat: Naver Search API + multi-account Instagram + button UX fix
- Naver Blog search: collect blog post results for clinic name (total count + top 10 posts) - Naver Place search: collect place info (name, category, address, telephone) - Multi-account Instagram: AI prompt requests all IG accounts (국내/해외) - enrich-channels: process multiple IG handles with fallback per handle - transformReport: merge multiple IG accounts into instagramAudit.accounts[] - generate-report: socialHandles.instagram now array of handles - Hero/CTA: transition-all → transition-shadow for instant click response - Hero/CTA: disabled state when URL is empty (opacity-50 + cursor-not-allowed) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
cf482d1bd7
commit
72ea8f4a2d
8 files changed
+240
-68
No files matched your search
@@ -52,9 +52,13 @@ export default function CTA() {
|
||||
onKeyDown={(e) => e.key === 'Enter' && handleAnalyze()}
|
||||
className="w-full px-8 py-4 text-base font-medium bg-gradient-to-r from-[#fff3eb] via-[#e4cfff] to-[#f5f9ff] border border-white/20 rounded-full focus:outline-none focus:ring-2 focus:ring-white/50 shadow-sm text-center text-primary-900 placeholder:text-primary-900/60"
|
||||
/>
|
||||
<button onClick={handleAnalyze} className="w-full px-10 py-4 text-lg font-medium text-white rounded-full transition-all shadow-xl hover:shadow-2xl flex items-center justify-center gap-2 group bg-gradient-to-r from-[#4F1DA1] to-[#021341] hover:from-[#AF90FF] hover:to-[#AF90FF]">
|
||||
<button
|
||||
onClick={handleAnalyze}
|
||||
disabled={!url.trim()}
|
||||
className={`w-full px-10 py-4 text-lg font-medium text-white rounded-full transition-shadow duration-150 shadow-xl hover:shadow-2xl flex items-center justify-center gap-2 group bg-gradient-to-r from-[#4F1DA1] to-[#021341] hover:from-[#AF90FF] hover:to-[#AF90FF] active:scale-[0.98] ${!url.trim() ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||
>
|
||||
Analyze
|
||||
<ArrowRight className="w-5 h-5 group-hover:translate-x-1 transition-transform" />
|
||||
<ArrowRight className="w-5 h-5 group-hover:translate-x-1" />
|
||||
</button>
|
||||
<p className="text-sm text-purple-200/80 mt-2">
|
||||
네이버 블로그, 플레이스, 소셜미디어 종합 분석 리포트 받아보기
|
||||
|
||||
@@ -64,9 +64,13 @@ export default function Hero() {
|
||||
className="w-full px-8 py-5 text-base font-medium bg-white/80 backdrop-blur-sm border border-slate-200 rounded-2xl focus:outline-none focus:ring-2 focus:ring-accent/20 focus:border-accent/40 shadow-sm text-center text-primary-900 placeholder:text-slate-400 transition-all group-hover:border-slate-300"
|
||||
/>
|
||||
</div>
|
||||
<button onClick={handleAnalyze} className="w-full px-8 py-5 text-base font-bold text-white rounded-2xl transition-all shadow-xl hover:shadow-2xl flex items-center justify-center gap-3 group bg-gradient-to-r from-[#4F1DA1] to-[#021341] hover:scale-[1.02] active:scale-[0.98]">
|
||||
<button
|
||||
onClick={handleAnalyze}
|
||||
disabled={!url.trim()}
|
||||
className={`w-full px-8 py-5 text-base font-bold text-white rounded-2xl transition-shadow duration-150 shadow-xl hover:shadow-2xl flex items-center justify-center gap-3 group bg-gradient-to-r from-[#4F1DA1] to-[#021341] active:scale-[0.98] ${!url.trim() ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||
>
|
||||
Analyze Marketing Performance
|
||||
<ArrowRight className="w-5 h-5 group-hover:translate-x-1 transition-transform" />
|
||||
<ArrowRight className="w-5 h-5 group-hover:translate-x-1" />
|
||||
</button>
|
||||
<p className="text-xs font-medium text-slate-500 mt-2">
|
||||
네이버 블로그, 플레이스, 소셜미디어 등 Online Presence 종합 분석 리포트를 제공합니다.
|
||||
|
||||
@@ -14,6 +14,7 @@ interface EnrichmentParams {
|
||||
reportId: string | null;
|
||||
clinicName: string;
|
||||
instagramHandle?: string;
|
||||
instagramHandles?: string[];
|
||||
youtubeChannelId?: string;
|
||||
address?: string;
|
||||
}
|
||||
@@ -34,7 +35,7 @@ export function useEnrichment(
|
||||
useEffect(() => {
|
||||
if (!baseReport || !params?.reportId || hasTriggered.current) return;
|
||||
// Don't enrich if no social handles are available
|
||||
if (!params.instagramHandle && !params.youtubeChannelId) return;
|
||||
if (!params.instagramHandle && !params.instagramHandles?.length && !params.youtubeChannelId) return;
|
||||
|
||||
hasTriggered.current = true;
|
||||
setStatus('loading');
|
||||
@@ -43,6 +44,7 @@ export function useEnrichment(
|
||||
reportId: params.reportId,
|
||||
clinicName: params.clinicName,
|
||||
instagramHandle: params.instagramHandle,
|
||||
instagramHandles: params.instagramHandles,
|
||||
youtubeChannelId: params.youtubeChannelId,
|
||||
address: params.address,
|
||||
})
|
||||
|
||||
@@ -37,6 +37,7 @@ export interface EnrichChannelsRequest {
|
||||
reportId: string;
|
||||
clinicName: string;
|
||||
instagramHandle?: string;
|
||||
instagramHandles?: string[];
|
||||
youtubeChannelId?: string;
|
||||
address?: string;
|
||||
}
|
||||
|
||||
+79
-13
@@ -347,6 +347,15 @@ export function transformApiReport(
|
||||
* Enrichment data shape from enrich-channels Edge Function.
|
||||
*/
|
||||
export interface EnrichmentData {
|
||||
instagramAccounts?: {
|
||||
username?: string;
|
||||
followers?: number;
|
||||
following?: number;
|
||||
posts?: number;
|
||||
bio?: string;
|
||||
isBusinessAccount?: boolean;
|
||||
externalUrl?: string;
|
||||
}[];
|
||||
instagram?: {
|
||||
username?: string;
|
||||
followers?: number;
|
||||
@@ -410,6 +419,26 @@ export interface EnrichmentData {
|
||||
badges?: string[];
|
||||
sourceUrl?: string;
|
||||
};
|
||||
naverBlog?: {
|
||||
totalResults?: number;
|
||||
searchQuery?: string;
|
||||
posts?: {
|
||||
title?: string;
|
||||
description?: string;
|
||||
link?: string;
|
||||
bloggerName?: string;
|
||||
postDate?: string;
|
||||
}[];
|
||||
};
|
||||
naverPlace?: {
|
||||
name?: string;
|
||||
category?: string;
|
||||
address?: string;
|
||||
telephone?: string;
|
||||
link?: string;
|
||||
mapx?: string;
|
||||
mapy?: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -422,20 +451,18 @@ export function mergeEnrichment(
|
||||
): MarketingReport {
|
||||
const merged = { ...report };
|
||||
|
||||
// Instagram enrichment
|
||||
if (enrichment.instagram) {
|
||||
const ig = enrichment.instagram;
|
||||
const existingAccount = merged.instagramAudit.accounts[0];
|
||||
|
||||
// Instagram enrichment — multi-account support
|
||||
const igAccounts = enrichment.instagramAccounts || (enrichment.instagram ? [enrichment.instagram] : []);
|
||||
if (igAccounts.length > 0) {
|
||||
merged.instagramAudit = {
|
||||
...merged.instagramAudit,
|
||||
accounts: [{
|
||||
handle: ig.username || existingAccount?.handle || '',
|
||||
language: 'KR',
|
||||
label: '메인',
|
||||
posts: ig.posts ?? existingAccount?.posts ?? 0,
|
||||
followers: ig.followers ?? existingAccount?.followers ?? 0,
|
||||
following: ig.following ?? existingAccount?.following ?? 0,
|
||||
accounts: igAccounts.map((ig, idx) => ({
|
||||
handle: ig.username || '',
|
||||
language: (idx === 0 ? 'KR' : 'EN') as 'KR' | 'EN',
|
||||
label: igAccounts.length === 1 ? '메인' : idx === 0 ? '국내' : `해외 ${idx}`,
|
||||
posts: ig.posts ?? 0,
|
||||
followers: ig.followers ?? 0,
|
||||
following: ig.following ?? 0,
|
||||
category: '의료/건강',
|
||||
profileLink: ig.username ? `https://instagram.com/${ig.username}` : '',
|
||||
highlights: [],
|
||||
@@ -443,7 +470,7 @@ export function mergeEnrichment(
|
||||
contentFormat: ig.isBusinessAccount ? '비즈니스 계정' : '일반 계정',
|
||||
profilePhoto: '',
|
||||
bio: ig.bio || '',
|
||||
}],
|
||||
})),
|
||||
};
|
||||
|
||||
// Update KPI with real follower data
|
||||
@@ -589,5 +616,44 @@ export function mergeEnrichment(
|
||||
}
|
||||
}
|
||||
|
||||
// 네이버 블로그 enrichment
|
||||
if (enrichment.naverBlog) {
|
||||
const nb = enrichment.naverBlog;
|
||||
const nbChannelIdx = merged.otherChannels.findIndex(c => c.name === '네이버 블로그');
|
||||
const nbChannel = {
|
||||
name: '네이버 블로그',
|
||||
status: 'active' as const,
|
||||
details: `검색 결과: ${nb.totalResults?.toLocaleString() ?? '-'}건 / 최근 포스트 ${nb.posts?.length ?? 0}개`,
|
||||
url: '',
|
||||
};
|
||||
if (nbChannelIdx >= 0) {
|
||||
merged.otherChannels[nbChannelIdx] = nbChannel;
|
||||
} else {
|
||||
merged.otherChannels = [...merged.otherChannels, nbChannel];
|
||||
}
|
||||
}
|
||||
|
||||
// 네이버 플레이스 enrichment
|
||||
if (enrichment.naverPlace) {
|
||||
const np = enrichment.naverPlace;
|
||||
const npChannelIdx = merged.otherChannels.findIndex(c => c.name === '네이버 플레이스');
|
||||
const npChannel = {
|
||||
name: '네이버 플레이스',
|
||||
status: 'active' as const,
|
||||
details: np.category || '',
|
||||
url: np.link || '',
|
||||
};
|
||||
if (npChannelIdx >= 0) {
|
||||
merged.otherChannels[npChannelIdx] = npChannel;
|
||||
} else {
|
||||
merged.otherChannels = [...merged.otherChannels, npChannel];
|
||||
}
|
||||
|
||||
// Update clinic phone/address from Naver Place if available
|
||||
if (np.telephone) {
|
||||
merged.clinicSnapshot = { ...merged.clinicSnapshot, phone: np.telephone };
|
||||
}
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
@@ -53,10 +53,10 @@ export default function ReportPage() {
|
||||
|
||||
const handles = stateSocialHandles || dbSocialHandles;
|
||||
|
||||
const igHandle =
|
||||
handles?.instagram ||
|
||||
baseData.instagramAudit?.accounts?.[0]?.handle ||
|
||||
undefined;
|
||||
// Instagram: support array of handles (multi-account) or single handle
|
||||
const igHandles: string[] = Array.isArray(handles?.instagram)
|
||||
? handles.instagram.filter(Boolean) as string[]
|
||||
: handles?.instagram ? [handles.instagram as string] : [];
|
||||
|
||||
const ytHandle =
|
||||
handles?.youtube ||
|
||||
@@ -66,7 +66,7 @@ export default function ReportPage() {
|
||||
return {
|
||||
reportId: baseData.id,
|
||||
clinicName: baseData.clinicSnapshot.name,
|
||||
instagramHandle: igHandle || undefined,
|
||||
instagramHandles: igHandles.length > 0 ? igHandles : undefined,
|
||||
youtubeChannelId: ytHandle || undefined,
|
||||
address: baseData.clinicSnapshot.location || undefined,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user