"use client";
import {
Ban,
ExternalLink,
HelpCircle,
Layers,
Target,
UserCircle,
Users,
} from "lucide-react";
import { Badge } from "@/components/ui/badge";
import {
SIMILAR_ACCOUNT_CONFIDENCE_LABELS,
SIMILAR_ACCOUNT_SOURCE_LABELS,
threadsProfileUrl,
type ResearchMap,
} from "@/lib/types/research";
import { cn } from "@/lib/utils";
interface ResearchMapViewProps {
map: ResearchMap;
/** 置入模式不顯示相似帳號(僅爆款模仿需要) */
showSimilarAccounts?: boolean;
}
function HeroBlock({
icon,
label,
children,
}: {
icon: React.ReactNode;
label: string;
children: React.ReactNode;
}) {
return (
);
}
function MapBlock({
icon,
title,
count,
children,
className,
tone = "default",
}: {
icon: React.ReactNode;
title: string;
count?: number;
children: React.ReactNode;
className?: string;
tone?: "default" | "exclude";
}) {
return (
{icon}
{title}
{count !== undefined && count > 0 && (
{count}
)}
{children}
);
}
export function ResearchMapView({ map, showSimilarAccounts = true }: ResearchMapViewProps) {
const accounts = showSimilarAccounts ? (map.similarAccounts ?? []) : [];
return (
} label="受眾是誰">
{map.audienceSummary}
} label="內容目標">
{map.contentGoal}
{map.questions.length > 0 && (
}
title="受眾會問什麼"
count={map.questions.length}
className="md:col-span-1 xl:col-span-1"
>
{map.questions.map((q, i) => (
-
{i + 1}
{q}
))}
)}
{map.pillars.length > 0 && (
}
title="內容支柱"
count={map.pillars.length}
>
{map.pillars.map((p) => (
{p}
))}
)}
{map.exclusions.length > 0 && (
}
title="不要碰"
count={map.exclusions.length}
tone="exclude"
>
{map.exclusions.map((ex) => (
-
×
{ex}
))}
)}
{showSimilarAccounts && (
}
title="相似帳號"
count={accounts.length}
>
{accounts.length > 0 ? (
{accounts.map((a) => {
const profileUrl = a.profileUrl ?? threadsProfileUrl(a.username);
const sourceLabel = a.source ? SIMILAR_ACCOUNT_SOURCE_LABELS[a.source] : null;
const confidenceLabel = a.confidence ? SIMILAR_ACCOUNT_CONFIDENCE_LABELS[a.confidence] : null;
const confidenceColor =
a.confidence === "high"
? "bg-emerald-500/10 text-emerald-600 border-emerald-200"
: a.confidence === "medium"
? "bg-amber-500/10 text-amber-600 border-amber-200"
: "bg-muted text-muted-foreground border-border";
const daysSinceActive = a.lastActiveAt
? Math.floor((Date.now() - new Date(a.lastActiveAt).getTime()) / 86400000)
: null;
return (
{profileUrl ? (
@{a.username}
) : (
@{a.username}
)}
{confidenceLabel && (
{confidenceLabel}
)}
{sourceLabel && (
{sourceLabel}
)}
{daysSinceActive !== null && (
{daysSinceActive <= 1 ? "最近活躍" : `${daysSinceActive} 天前活躍`}
)}
{a.postUrl ? (
{a.reason}
) : (
{a.reason}
)}
);
})}
) : (
尚未找到相似帳號(沒有高品質也無中低品質候選),可重試分析或在微調面板手動加入 @帳號
)}
)}
);
}