Skip to content

Commit

Permalink
fix(UX): Fade transition while loading page
Browse files Browse the repository at this point in the history
  • Loading branch information
surajshetty3416 committed Dec 29, 2024
1 parent b1f356d commit c06ba30
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
11 changes: 11 additions & 0 deletions frontend/src/components/BuilderCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,14 @@ function selectBreakpoint(ev: MouseEvent, breakpoint: BreakpointConfig) {
const renderedBreakpoints = computed(() => canvasProps.breakpoints.filter((bp) => bp.renderedOnce));
</script>
<style>
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.1s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>
30 changes: 8 additions & 22 deletions frontend/src/components/Icons/Loading.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">
<circle cx="18" cy="12" r="0" fill="currentColor">
<circle
v-for="(begin, index) in [0, 0.33, 0.67]"
:key="index"
:cx="6 + index * 6"
cy="12"
r="0"
fill="currentColor">
<animate
attributeName="r"
begin=".67"
calcMode="spline"
dur="1.5s"
keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8"
repeatCount="indefinite"
values="0;2;0;0" />
</circle>
<circle cx="12" cy="12" r="0" fill="currentColor">
<animate
attributeName="r"
begin=".33"
calcMode="spline"
dur="1.5s"
keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8"
repeatCount="indefinite"
values="0;2;0;0" />
</circle>
<circle cx="6" cy="12" r="0" fill="currentColor">
<animate
attributeName="r"
begin="0"
:begin="begin"
calcMode="spline"
dur="1.5s"
keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8"
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import BlockContextMenu from "@/components/BlockContextMenu.vue";
import router from "@/router";
import { posthog } from "@/telemetry";
import { BuilderSettings } from "@/types/Builder/BuilderSettings";
import useComponentStore from "@/utils/useComponentStore";
import { UseRefHistoryReturn, useStorage } from "@vueuse/core";
import { createDocumentResource } from "frappe-ui";
import { defineStore } from "pinia";
Expand Down Expand Up @@ -155,13 +156,14 @@ const useStore = defineStore("store", {
await this.setPageData(this.activePage);
this.activeCanvas?.setRootBlock(this.pageBlocks[0], resetCanvas);
nextTick(() => {
const componentStore = useComponentStore();
const interval = setInterval(() => {
// if (this.fetchingComponent.size === 0) {
this.settingPage = false;
window.name = `editor-${pageName}`;
clearInterval(interval);
// }
}, 100);
if (!componentStore.fetchingComponent.size) {
this.settingPage = false;
window.name = `editor-${pageName}`;
clearInterval(interval);
}
}, 50);
});
},
async setActivePage(pageName: string) {
Expand Down

0 comments on commit c06ba30

Please sign in to comment.