Skip to content

Commit

Permalink
Merge pull request #641 from madeindjs/async-loader
Browse files Browse the repository at this point in the history
fix(ui): display loader during async loading component
  • Loading branch information
ramedina86 authored Nov 21, 2024
2 parents dfbda55 + 593f159 commit 88f7a77
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 28 deletions.
51 changes: 27 additions & 24 deletions src/ui/src/builder/BuilderApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,31 +105,34 @@ import { isPlatformMac } from "../core/detectPlatform";
import BuilderHeader from "./BuilderHeader.vue";
import BuilderTooltip from "./BuilderTooltip.vue";
import BuilderComponentShortcuts from "./BuilderComponentShortcuts.vue";
import BuilderAsyncLoader from "./BuilderAsyncLoader.vue";
import BuilderCodePanel from "./BuilderCodePanel.vue";
import BuilderLogPanel from "./BuilderLogPanel.vue";
const BuilderSettings = defineAsyncComponent(
() => import("./BuilderSettings.vue"),
);
const BuilderSidebar = defineAsyncComponent(
() => import("./BuilderSidebar.vue"),
);
const ComponentRenderer = defineAsyncComponent(
() => import("@/renderer/ComponentRenderer.vue"),
);
const BuilderInstanceTracker = defineAsyncComponent(
() => import("./BuilderInstanceTracker.vue"),
);
const BuilderInsertionOverlay = defineAsyncComponent(
() => import("./BuilderInsertionOverlay.vue"),
);
const BuilderInsertionLabel = defineAsyncComponent(
() => import("./BuilderInsertionLabel.vue"),
);
const BuilderCodePanel = defineAsyncComponent(
() => import("./BuilderCodePanel.vue"),
);
const BuilderLogPanel = defineAsyncComponent(
() => import("./BuilderLogPanel.vue"),
);
const BuilderSettings = defineAsyncComponent({
loader: () => import("./BuilderSettings.vue"),
loadingComponent: BuilderAsyncLoader,
});
const BuilderSidebar = defineAsyncComponent({
loader: () => import("./BuilderSidebar.vue"),
loadingComponent: BuilderAsyncLoader,
});
const ComponentRenderer = defineAsyncComponent({
loader: () => import("@/renderer/ComponentRenderer.vue"),
loadingComponent: BuilderAsyncLoader,
});
const BuilderInstanceTracker = defineAsyncComponent({
loader: () => import("./BuilderInstanceTracker.vue"),
loadingComponent: BuilderAsyncLoader,
});
const BuilderInsertionOverlay = defineAsyncComponent({
loader: () => import("./BuilderInsertionOverlay.vue"),
loadingComponent: BuilderAsyncLoader,
});
const BuilderInsertionLabel = defineAsyncComponent({
loader: () => import("./BuilderInsertionLabel.vue"),
loadingComponent: BuilderAsyncLoader,
});
const wf = inject(injectionKeys.core);
const ssbm = inject(injectionKeys.builderManager);
Expand Down
19 changes: 19 additions & 0 deletions src/ui/src/builder/BuilderAsyncLoader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<div class="BuilderAsyncLoader">
<LoadingSymbol />
</div>
</template>

<script setup lang="ts">
import LoadingSymbol from "@/renderer/LoadingSymbol.vue";
</script>

<style scoped>
.BuilderAsyncLoader {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
9 changes: 7 additions & 2 deletions src/ui/src/builder/BuilderCodePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@
</template>

<script setup lang="ts">
import { computed, inject, ref, watch } from "vue";
import BuilderEmbeddedCodeEditor from "./BuilderEmbeddedCodeEditor.vue";
import { computed, defineAsyncComponent, inject, ref, watch } from "vue";
import BuilderPanel, { type BuilderPanelAction } from "./BuilderPanel.vue";
import BuilderAsyncLoader from "./BuilderAsyncLoader.vue";
import injectionKeys from "@/injectionKeys";
const BuilderEmbeddedCodeEditor = defineAsyncComponent({
loader: () => import("./BuilderEmbeddedCodeEditor.vue"),
loadingComponent: BuilderAsyncLoader,
});
const wf = inject(injectionKeys.core);
const wfbm = inject(injectionKeys.builderManager);
Expand Down
9 changes: 7 additions & 2 deletions src/ui/src/builder/BuilderSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,19 @@

<script setup lang="ts">
import { marked } from "marked";
import { inject, computed, ref, watch } from "vue";
import { inject, computed, ref, watch, defineAsyncComponent } from "vue";
import injectionKeys from "../injectionKeys";
import BuilderSettingsHandlers from "./BuilderSettingsHandlers.vue";
import BuilderSettingsProperties from "./BuilderSettingsProperties.vue";
import BuilderSettingsBinding from "./BuilderSettingsBinding.vue";
import BuilderSettingsVisibility from "./BuilderSettingsVisibility.vue";
import BuilderCopyText from "./BuilderCopyText.vue";
import BuilderAsyncLoader from "./BuilderAsyncLoader.vue";
const BuilderSettingsHandlers = defineAsyncComponent({
loader: () => import("./BuilderSettingsHandlers.vue"),
loadingComponent: BuilderAsyncLoader,
});
const wf = inject(injectionKeys.core);
const ssbm = inject(injectionKeys.builderManager);
Expand Down

0 comments on commit 88f7a77

Please sign in to comment.