feat: add API Dashboard + filled icons + pipeline improvements
- Add /api-dashboard page with API connection status, env var checker, pipeline flow diagram, and cost estimator - Add 15 new filled SVG icons (Shield, Database, Server, Bolt, Eye, Copy, Check, Cross, Warning, Refresh, Flow, Coin, LinkExternal etc.) - Follow INFINITH design system: no emoji, no line icons, semantic status colors, diagonal shadows, brand gradients, font-serif headings - Improve Vision Analysis with base64 encoding fix - Add SectionErrorBoundary for graceful section-level error handling - Add Google Places API utility (prepared for future migration) - Fix Edge Function auth headers and report generation pipeline Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2ca9ec0306
commit
ec991057e6
20 files changed
+1397
-109
No files matched your search
@@ -124,10 +124,12 @@ function buildDiagnosis(report: ApiReport): DiagnosisItem[] {
|
||||
// AI-generated per-channel diagnosis array (new format)
|
||||
if (ch.diagnosis) {
|
||||
for (const d of ch.diagnosis) {
|
||||
if (d.issue) {
|
||||
const issue = typeof d.issue === 'string' ? d.issue : typeof d === 'string' ? d : JSON.stringify(d.issue ?? d);
|
||||
if (issue) {
|
||||
const rec = typeof d.recommendation === 'string' ? d.recommendation : '';
|
||||
items.push({
|
||||
category: CHANNEL_ICONS[channel] ? channel : channel,
|
||||
detail: d.recommendation ? `${d.issue} — ${d.recommendation}` : d.issue,
|
||||
detail: rec ? `${issue} — ${rec}` : issue,
|
||||
severity: (d.severity as Severity) || 'warning',
|
||||
});
|
||||
}
|
||||
@@ -143,7 +145,7 @@ function buildDiagnosis(report: ApiReport): DiagnosisItem[] {
|
||||
}
|
||||
if (ch.issues) {
|
||||
for (const issue of ch.issues) {
|
||||
items.push({ category: channel, detail: issue, severity: 'warning' });
|
||||
items.push({ category: channel, detail: typeof issue === 'string' ? issue : JSON.stringify(issue), severity: 'warning' });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,6 +276,13 @@ function buildTransformation(r: ApiReport): import('../types/report').Transforma
|
||||
return { brandIdentity, contentStrategy, platformStrategies, websiteImprovements, newChannelProposals };
|
||||
}
|
||||
|
||||
/** Safely format KPI values — handles numbers, strings, and nulls from AI output */
|
||||
function fmtKpi(v: unknown): string {
|
||||
if (v == null) return '-';
|
||||
if (typeof v === 'number') return fmt(v);
|
||||
return String(v);
|
||||
}
|
||||
|
||||
function fmt(n: number): string {
|
||||
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
|
||||
if (n >= 1_000) return `${(n / 1_000).toFixed(n >= 10_000 ? 0 : 1)}K`;
|
||||
@@ -468,15 +477,15 @@ function buildKpiDashboard(r: ApiReport): import('../types/report').KPIMetric[]
|
||||
// Use AI's gangnamunni data — update existing or add
|
||||
const guIdx = metrics.findIndex(m => m.metric.includes('강남언니'));
|
||||
if (guIdx >= 0) {
|
||||
metrics[guIdx] = { metric: k.metric, current: k.current || '-', target3Month: k.target3Month || '-', target12Month: k.target12Month || '-' };
|
||||
metrics[guIdx] = { metric: k.metric, current: fmtKpi(k.current), target3Month: fmtKpi(k.target3Month), target12Month: fmtKpi(k.target12Month) };
|
||||
continue;
|
||||
}
|
||||
}
|
||||
metrics.push({
|
||||
metric: k.metric,
|
||||
current: k.current || '-',
|
||||
target3Month: k.target3Month || '-',
|
||||
target12Month: k.target12Month || '-',
|
||||
current: fmtKpi(k.current),
|
||||
target3Month: fmtKpi(k.target3Month),
|
||||
target12Month: fmtKpi(k.target12Month),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user