Eliminate all mock fallbacks in Docs and Drive endpoints with real local file generators

This commit is contained in:
2026-07-22 19:42:35 -04:00
parent 6ba84ba37e
commit c17b82d1e3
2 changed files with 43 additions and 10 deletions
+24 -2
View File
@@ -211,6 +211,18 @@ export const GoogleWorkspaceHub: React.FC<GoogleWorkspaceHubProps> = ({
accessToken || undefined
);
if (res.isLocalDoc && res.documentUrl) {
const link = document.createElement('a');
link.href = res.documentUrl;
link.download = `${docTitle.replace(/[^a-z0-9_-]/gi, '_')}.html`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
showToast('✓ Document compiled & downloaded to local file!');
} else {
showToast('Tailored document exported to Google Docs!');
}
setGeneratedDocs(prev => [
{
title: docTitle,
@@ -222,7 +234,6 @@ export const GoogleWorkspaceHub: React.FC<GoogleWorkspaceHubProps> = ({
setDocTitle('');
setDocContent('');
showToast('Tailored document exported to Google Docs!');
} catch (err: any) {
showToast(`Google Docs: ${err.message}`);
} finally {
@@ -256,7 +267,18 @@ export const GoogleWorkspaceHub: React.FC<GoogleWorkspaceHubProps> = ({
accessToken || undefined
);
showToast('Saved file to Google Drive folder!');
if (res.isLocalFile && res.driveUrl) {
const link = document.createElement('a');
link.href = res.driveUrl;
link.download = uploadFileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
showToast(`✓ ${uploadFileName} saved & downloaded to local workspace!`);
} else {
showToast(`✓ ${uploadFileName} uploaded to Google Drive!`);
}
setDriveFiles(prev => [
{
id: res.fileId,