Skip to content

Commit

Permalink
add loading & error messages while installing dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gonpombo8 committed Dec 17, 2024
1 parent 4488a17 commit b34f3b1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/renderer/src/modules/store/editor/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ export const slice = createSlice({
state.isInstalledProject = true;
state.isInstallingProject = false;
});
builder.addCase(workspaceActions.installProject.rejected, (state) => {
state.isInstallingProject = false;
});
builder.addCase(workspaceActions.saveAndGetThumbnail.fulfilled, (state, action) => {
if (state.project) {
state.project.thumbnail = action.payload;
Expand Down
23 changes: 23 additions & 0 deletions packages/renderer/src/modules/store/snackbar/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@ export const slice = createSlice({
}),
);
})
.addCase(workspaceActions.installProject.pending, (state, payload) => {
const { requestId } = payload.meta;
state.notifications.push(
createGenericNotification('loading', t('snackbar.generic.installing_dependencies'), {
requestId,
duration: 0,
}),
);
})
.addCase(workspaceActions.installProject.fulfilled, (state, payload) => {
const { requestId } = payload.meta;
state.notifications = state.notifications.filter($ => $.id !== requestId);
})
.addCase(workspaceActions.installProject.rejected, (state, payload) => {
const { requestId } = payload.meta;
state.notifications = state.notifications.filter($ => $.id !== requestId);
state.notifications.push(
createGenericNotification('error', t('snackbar.generic.installing_dependencies_failed'), {
requestId,
duration: 2_000,
}),
);
})
.addCase(workspaceActions.importProject.fulfilled, (state, payload) => {
const { requestId } = payload.meta;
state.notifications = state.notifications.filter($ => $.id !== requestId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@
"duplicate_scene_failed": "Failed duplicating scene",
"delete_scene": "Deleting scene...",
"delete_scene_failed": "Failed deleting scene",
"dependencies_updated": "Scene dependencies were updated"
"dependencies_updated": "Scene dependencies were updated",
"installing_dependencies": "Installing dependencies...",
"installing_dependencies_failed": "Failed installing dependencies"
},
"missing_projects": {
"title": "{scenes} {scenes, plural, one {scene} other {scenes}} could not be loaded due to missing files",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@
"duplicate_scene_failed": "Error al duplicar escena",
"delete_scene": "Borrando escena...",
"delete_scene_failed": "Error al borrar escena",
"dependencies_updated": "Las dependencias de la escena fueron actualizadas"
"dependencies_updated": "Las dependencias de la escena fueron actualizadas",
"installing_dependencies": "Instalando dependencias...",
"installing_dependencies_failed": "Error al instalar dependencias"
},
"missing_projects": {
"title": "{scenes} {scenes, plural, one {escena} other {escenas}} {scenes, plural, one {faltante} other {faltantes}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@
"duplicate_scene_failed": "复制场景失败",
"delete_scene": "删除场景...",
"delete_scene_failed": "删除场景失败",
"dependencies_updated": "場景相依性已更新"
"dependencies_updated": "場景相依性已更新",
"installing_dependencies": "安装依赖项",
"installing_dependencies_failed": "安装依赖项失败"
},
"missing_projects": {
"title": "{scenes} 丢失的 {scenes, plural, one {场景} other {场景}} 成立",
Expand Down

0 comments on commit b34f3b1

Please sign in to comment.