feat(deploy): add deploy alert system for build and deployment status

Introduce a new `DeployAlert` interface and related components to provide visual feedback on build and deployment stages. This includes status updates for Vercel and Netlify deployments, with progress visualization and error handling. The changes enhance user experience by offering real-time updates during the deployment process.
This commit is contained in:
KevIsDev
2025-04-04 11:22:56 +01:00
parent cdbf9ba730
commit 33305c4326
8 changed files with 440 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ import { extractRelativePath } from '~/utils/diff';
import { description } from '~/lib/persistence';
import Cookies from 'js-cookie';
import { createSampler } from '~/utils/sampler';
import type { ActionAlert, SupabaseAlert } from '~/types/actions';
import type { ActionAlert, DeployAlert, SupabaseAlert } from '~/types/actions';
const { saveAs } = fileSaver;
@@ -52,6 +52,8 @@ export class WorkbenchStore {
import.meta.hot?.data.unsavedFiles ?? atom<ActionAlert | undefined>(undefined);
supabaseAlert: WritableAtom<SupabaseAlert | undefined> =
import.meta.hot?.data.unsavedFiles ?? atom<ActionAlert | undefined>(undefined);
deployAlert: WritableAtom<DeployAlert | undefined> =
import.meta.hot?.data.unsavedFiles ?? atom<DeployAlert | undefined>(undefined);
modifiedFiles = new Set<string>();
artifactIdList: string[] = [];
#globalExecutionQueue = Promise.resolve();
@@ -63,6 +65,7 @@ export class WorkbenchStore {
import.meta.hot.data.currentView = this.currentView;
import.meta.hot.data.actionAlert = this.actionAlert;
import.meta.hot.data.supabaseAlert = this.supabaseAlert;
import.meta.hot.data.deployAlert = this.deployAlert;
// Ensure binary files are properly preserved across hot reloads
const filesMap = this.files.get();
@@ -125,6 +128,14 @@ export class WorkbenchStore {
this.supabaseAlert.set(undefined);
}
get DeployAlert() {
return this.deployAlert;
}
clearDeployAlert() {
this.deployAlert.set(undefined);
}
toggleTerminal(value?: boolean) {
this.#terminalStore.toggleTerminal(value);
}
@@ -423,6 +434,13 @@ export class WorkbenchStore {
this.supabaseAlert.set(alert);
},
(alert) => {
if (this.#reloadedMessages.has(messageId)) {
return;
}
this.deployAlert.set(alert);
},
),
});
}