diff --git a/components/GoogleAdsGenerator.tsx b/components/GoogleAdsGenerator.tsx
index 20106ea..5576abd 100644
--- a/components/GoogleAdsGenerator.tsx
+++ b/components/GoogleAdsGenerator.tsx
@@ -10,7 +10,7 @@ import modelAdapter from "@/lib/services/adapter-instance";
import { Megaphone, Copy, Loader2, CheckCircle2, Settings, Plus, X, ChevronDown, ChevronUp, Wand2, Target, TrendingUp, ShieldAlert, BarChart3, Users, Rocket, Download, FileSpreadsheet } from "lucide-react";
import { cn } from "@/lib/utils";
import { GoogleAdsResult } from "@/types";
-import { downloadFile, generateGoogleAdsCSV, generateGoogleAdsHTML } from "@/lib/export-utils";
+import { downloadFile, generateGoogleAdsCSV, generateGoogleAdsHTML, generateGoogleAdsExcel } from "@/lib/export-utils";
import { translations } from "@/lib/i18n/translations";
export default function GoogleAdsGenerator() {
@@ -364,149 +364,16 @@ export default function GoogleAdsGenerator() {
}
};
- const exportCSV = () => {
+ const exportExcel = () => {
if (!googleAdsResult && !magicWandResult) return;
- const csvContent = generateGoogleAdsCSV(googleAdsResult || undefined, magicWandResult || undefined);
- downloadFile(`google-ads-report-${new Date().toISOString().split('T')[0]}.csv`, csvContent, 'text/csv;charset=utf-8;');
+ const excelBlob = generateGoogleAdsExcel(googleAdsResult || undefined, magicWandResult || undefined);
+ downloadFile(`google-ads-full-intel-${new Date().toISOString().split('T')[0]}.xlsx`, excelBlob, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
};
const exportHTML = () => {
if (!googleAdsResult && !magicWandResult) return;
-
const htmlContent = generateGoogleAdsHTML(googleAdsResult || undefined, magicWandResult || undefined);
- downloadFile(`google-ads-report-${new Date().toISOString().split('T')[0]}.html`, htmlContent, 'text/html');
- return; /*
- parts.push(`
Google Ads Strategy Report`);
- parts.push(``);
-
- parts.push(`
Google Ads Strategy Report
Generated by PromptArch on ${new Date().toLocaleDateString()}
`);
-
- if (googleAdsResult) {
- // Keywords
- parts.push(`
🎯 Keyword Research
`);
- if (googleAdsResult.keywords) {
- if (Array.isArray(googleAdsResult.keywords.primary)) {
- parts.push(`
Primary Keywords
`);
- for (const k of googleAdsResult.keywords.primary) {
- parts.push(`${k.keyword} (${k.cpc || 'N/A'})`);
- }
- parts.push(`
`);
- }
- if (Array.isArray(googleAdsResult.keywords.longTail)) {
- parts.push(`
Long-tail Opportunities
`);
- for (const k of googleAdsResult.keywords.longTail) {
- parts.push(`${k.keyword} (${k.cpc || 'N/A'})`);
- }
- parts.push(`
`);
- }
- if (Array.isArray(googleAdsResult.keywords.negative)) {
- parts.push(`
Negative Keywords
`);
- for (const k of googleAdsResult.keywords.negative) {
- parts.push(`${k.keyword} (${k.cpc || 'N/A'})`);
- }
- parts.push(`
`);
- }
- }
- parts.push(`
`);
-
- // Ad Copies
- if (Array.isArray(googleAdsResult.adCopies)) {
- parts.push(`
✍️ Ad Copy Variations
`);
- let i = 0;
- for (const ad of googleAdsResult.adCopies) {
- i++;
- parts.push(`
Variation ${i}
`);
- if (Array.isArray(ad.headlines)) {
- for (const h of ad.headlines) {
- parts.push(`
${h}
`);
- }
- }
- if (Array.isArray(ad.descriptions)) {
- parts.push(`
${(ad.descriptions || []).join('
')}
`);
- }
- if (ad.callToAction) {
- parts.push(`
${ad.callToAction}
`);
- }
- parts.push(`
`);
- }
- parts.push(`
`);
- }
-
- // Campaigns
- if (Array.isArray(googleAdsResult.campaigns)) {
- parts.push(`
🏗️ Campaign Structure
`);
- for (const c of googleAdsResult.campaigns) {
- parts.push(`
${c.name}
`);
- parts.push(`
${c.type.toUpperCase()} • ${c.budget?.daily} ${c.budget?.currency}/day
`);
- const locs = c.targeting?.locations ? c.targeting.locations.join(', ') : 'Global';
- parts.push(`
Locations: ${locs}
Ad Groups: ${c.adGroups ? c.adGroups.length : 0}
`);
- }
- parts.push(`
`);
- }
-
- // Implementation & Predictions
- parts.push(`
🚀 Implementation & Forecast
`);
- if (googleAdsResult.implementation && Array.isArray(googleAdsResult.implementation.setupSteps)) {
- parts.push(`
Setup Steps
`);
- for (const s of googleAdsResult.implementation.setupSteps) {
- parts.push(`- ${s}
`);
- }
- parts.push(`
`);
- }
-
- if (googleAdsResult.predictions) {
- const p = googleAdsResult.predictions;
- parts.push(`
Monthly Estimations
`);
- parts.push(`
${p.estimatedClicks || '-'}
Clicks
`);
- parts.push(`
${p.estimatedCtr || '-'}
CTR
`);
- parts.push(`
${p.estimatedConversions || '-'}
Convs
`);
- parts.push(`
`);
- }
- parts.push(`
`);
- }
-
- if (magicWandResult) {
- parts.push(`
🧠 Market Intelligence
`);
- parts.push(`
Strategy Rationale
${magicWandResult.rationale}
`);
- const ma = magicWandResult.marketAnalysis;
- parts.push(`
Market Data
Growth Rate: ${ma?.growthRate || 'N/A'}
Top Competitors
`);
- if (ma && Array.isArray(ma.topCompetitors)) {
- for (const c of ma.topCompetitors) {
- parts.push(`- ${c}
`);
- }
- } else {
- parts.push(`- None identified
`);
- }
- parts.push(`
`);
- }
-
- parts.push(`
`);
-
- const blob = new Blob([parts.join('')], { type: 'text/html' });
- const url = URL.createObjectURL(blob);
- const link = document.createElement("a");
- link.setAttribute("href", url);
- link.setAttribute("download", `google-ads-report-${new Date().toISOString().split('T')[0]}.html`);
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- */
+ downloadFile(`google-ads-intelligence-report-${new Date().toISOString().split('T')[0]}.html`, htmlContent, 'text/html');
};
const sections = [
@@ -1235,10 +1102,10 @@ export default function GoogleAdsGenerator() {
)}
-