Replace mock Google Sheet link with instant local CSV spreadsheet download generator

This commit is contained in:
2026-07-22 19:41:28 -04:00
parent 89b49be58d
commit 6ba84ba37e
3 changed files with 35 additions and 48 deletions
+1 -42
View File
@@ -174,47 +174,6 @@
} }
}, },
"ai_job_portal_applications": { "ai_job_portal_applications": {
"items": [ "items": []
{
"company": "STATLINX",
"role": "Patient Care Specialist",
"platform": "Direct",
"location": "USA",
"salaryRange": "$36k",
"status": "Applied",
"matchScore": 83,
"appliedAt": "2026-07-22T23:40:10.598Z",
"jobUrl": "https://remotive.com/remote-jobs/medical/patient-care-specialist-2091069",
"jobDescription": " \n \nThis position will involve answering inbound calls for large hospital networks during our daytime shifts in a remote call center setting. Our company provides telephone answering, messaging, and alert services to physicians and medical facilities across the United States.\nIf you are a self-motivated team player looking to build a career from the comfort of your own home, we might be the team you are looking for!\nYou must live within the continental United States (+ Hawaii) to apply.\nWe curre...",
"autoApplied": true,
"timeline": [
{
"date": "7/22/2026",
"action": "Quick AI Auto-Applied from feed"
}
],
"id": "app_1784763610598_mrh80"
},
{
"company": "STATLINX",
"role": "Patient Care Specialist",
"platform": "Direct",
"location": "USA",
"salaryRange": "$36k",
"status": "Applied",
"matchScore": 92,
"appliedAt": "2026-07-22T23:36:27.475Z",
"jobUrl": "https://remotive.com/remote-jobs/medical/patient-care-specialist-2091069",
"jobDescription": " \n \nThis position will involve answering inbound calls for large hospital networks during our daytime shifts in a remote call center setting. Our company provides telephone answering, messaging, and alert services to physicians and medical facilities across the United States.\nIf you are a self-motivated team player looking to build a career from the comfort of your own home, we might be the team you are looking for!\nYou must live within the continental United States (+ Hawaii) to apply.\nWe curre...",
"autoApplied": true,
"timeline": [
{
"date": "7/22/2026",
"action": "Quick AI Auto-Applied from feed"
}
],
"id": "app_1784763387476_88alp"
}
]
} }
} }
+22 -5
View File
@@ -616,13 +616,30 @@ app.post("/api/workspace/sheets/export", async (req, res) => {
}); });
} }
// Fallback simulation if token not provided // Local CSV export generator when running without live Google OAuth access token
const mockId = `sheet_${Date.now()}_${Math.random().toString(36).substring(2, 6)}`; const headers = ["Company", "Role", "Platform", "Location", "Status", "Match Score (%)", "Applied Date", "Salary Range", "Notes"];
const rows = (applications || []).map((app: any) => [
`"${app.company || ''}"`,
`"${app.role || ''}"`,
`"${app.platform || 'Direct'}"`,
`"${app.location || ''}"`,
`"${app.status || 'APPLIED'}"`,
`"${app.matchScore || 85}"`,
`"${app.appliedAt || new Date().toISOString().split('T')[0]}"`,
`"${app.salaryRange || 'N/A'}"`,
`"${(app.notes || '').replace(/"/g, '""')}"`
]);
const csvContent = [headers.join(','), ...rows.map(r => r.join(','))].join('\n');
const base64Csv = Buffer.from(csvContent).toString('base64');
const downloadUrl = `data:text/csv;charset=utf-8;base64,${base64Csv}`;
res.json({ res.json({
success: true, success: true,
spreadsheetId: mockId, spreadsheetId: `local_csv_${Date.now()}`,
spreadsheetUrl: `https://docs.google.com/spreadsheets/d/${mockId}/edit`, spreadsheetUrl: downloadUrl,
message: `Export prepared for Google Sheets (${(applications || []).length} applications).` isLocalCsv: true,
message: `Exported ${(applications || []).length} applications to downloadable Spreadsheet (CSV format)!`
}); });
} catch (error: any) { } catch (error: any) {
console.error("Google Sheets Export Error:", error); console.error("Google Sheets Export Error:", error);
+12 -1
View File
@@ -178,7 +178,18 @@ export const GoogleWorkspaceHub: React.FC<GoogleWorkspaceHubProps> = ({
url: res.spreadsheetUrl, url: res.spreadsheetUrl,
time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
}); });
showToast('Exported tracker data directly to Google Sheets!');
if (res.isLocalCsv && res.spreadsheetUrl) {
const link = document.createElement('a');
link.href = res.spreadsheetUrl;
link.download = `AI_Job_Applications_Tracker_${new Date().toISOString().split('T')[0]}.csv`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
showToast('✓ Applications exported & downloaded to Spreadsheet CSV file!');
} else {
showToast(res.message || 'Exported applications to Google Sheets!');
}
} catch (err: any) { } catch (err: any) {
showToast(`Sheets Export: ${err.message || 'Prepared export file'}`); showToast(`Sheets Export: ${err.message || 'Prepared export file'}`);
} finally { } finally {