-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(perf): create app-loading component + refactor view resolvers
- Loading branch information
1 parent
2392d8e
commit 558e1c1
Showing
23 changed files
with
263 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<template> | ||
<div class="app-loader"> | ||
<BIMDataSpinner /> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.app-loader { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
.bimdata-spinner { | ||
transform: scale(2); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<template> | ||
<transition name="fade" mode="out-in"> | ||
<template v-if="loading"> | ||
<AppLoader /> | ||
</template> | ||
<template v-else> | ||
<slot></slot> | ||
</template> | ||
</transition> | ||
</template> | ||
|
||
<script> | ||
import { useAppLoading } from "./app-loading.js"; | ||
import AppLoader from "./AppLoader.vue"; | ||
export default { | ||
components: { | ||
AppLoader | ||
}, | ||
props: { | ||
name: { | ||
type: String, | ||
required: true | ||
} | ||
}, | ||
setup(props) { | ||
const loading = useAppLoading(props.name); | ||
return { | ||
loading | ||
}; | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ref } from "vue"; | ||
|
||
const state = {}; | ||
|
||
export function useAppLoading(name) { | ||
return state[name] ?? (state[name] = ref(false)); | ||
} | ||
|
||
export async function load(name, promises) { | ||
const loading = useAppLoading(name); | ||
loading.value = true; | ||
await Promise.all(promises); | ||
loading.value = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
/* eslint-disable */ | ||
import { load } from "@/components/generic/app-loading/app-loading.js"; | ||
import { useProjects } from "@/state/projects.js"; | ||
import { useSpaces } from "@/state/spaces.js"; | ||
|
||
const spaces = useSpaces(); | ||
const projects = useProjects(); | ||
|
||
export default async function spaceBoardResolver(route) { | ||
spaces.setCurrentSpace(+route.params.spaceID); | ||
const space = spaces.setCurrentSpace(+route.params.spaceID); | ||
|
||
await projects.loadSpaceProjects(spaces.currentSpace.value); | ||
await spaces.loadSpaceInfo(spaces.currentSpace.value); | ||
await spaces.loadSpaceUsers(spaces.currentSpace.value); | ||
await spaces.loadSpaceInvitations(spaces.currentSpace.value); | ||
spaces.loadSpaceInfo(space); | ||
|
||
load("space-users", [ | ||
spaces.loadSpaceUsers(space), | ||
spaces.loadSpaceInvitations(space) | ||
]); | ||
load("space-projects", [ | ||
projects.loadSpaceProjects(space) | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.