feature/projects-all-the-way-down #3323
|
@ -1,28 +0,0 @@
|
|||
<template>
|
||||
<nav class="menu" v-if="favoriteProjects">
|
||||
<ProjectsNavigation :model-value="favoriteProjects" :can-edit-order="false"/>
|
||||
</nav>
|
||||
|
||||
<nav class="menu">
|
||||
<ProjectsNavigation :model-value="projects" :can-edit-order="true"/>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {computed} from 'vue'
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
import ProjectsNavigation from '@/components/home/ProjectsNavigation.vue'
|
||||
|
||||
const projectStore = useProjectStore()
|
||||
|
||||
const projects = computed(() => projectStore.notArchivedRootProjects
|
||||
.sort((a, b) => a.position - b.position))
|
||||
const favoriteProjects = computed(() => projectStore.favoriteProjects
|
||||
.sort((a, b) => a.position - b.position))
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.menu + .menu{
|
||||
padding-top: math.div($navbar-padding, 2);
|
||||
}
|
||||
</style>
|
|
@ -49,7 +49,15 @@
|
|||
</nav>
|
||||
|
||||
<Loading variant="small" v-if="projectsLoading"/>
|
||||
dpschen marked this conversation as resolved
Outdated
|
||||
<ProjectsNavigationWrapper v-else/>
|
||||
<template v-else>
|
||||
<nav class="menu" v-if="favoriteProjects">
|
||||
<ProjectsNavigation :model-value="favoriteProjects" :can-edit-order="false"/>
|
||||
</nav>
|
||||
|
||||
<nav class="menu">
|
||||
<ProjectsNavigation :model-value="projects" :can-edit-order="true"/>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<PoweredByLink/>
|
||||
</aside>
|
||||
|
@ -64,12 +72,17 @@ import Loading from '@/components/misc/loading.vue'
|
|||
|
||||
import {useBaseStore} from '@/stores/base'
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
import ProjectsNavigationWrapper from '@/components/home/ProjectsNavigationWrapper.vue'
|
||||
import ProjectsNavigation from '@/components/home/ProjectsNavigation.vue'
|
||||
|
||||
const baseStore = useBaseStore()
|
||||
dpschen
commented
Can we put this component inside a Can we put this component inside a `<Suspense>`? Then we can use `await` methods directly and without `onBeforeMount ` hook.
konrad
commented
I've now moved the project navigation into a separate wrapper component so that we can show a loading spinner while projects are loading and still show the other navigation links (overview, labels, etc). I've now moved the project navigation into a separate wrapper component so that we can show a loading spinner while projects are loading and still show the other navigation links (overview, labels, etc).
dpschen
commented
Ok. Will check Ok. Will check
|
||||
const projectStore = useProjectStore()
|
||||
const menuActive = computed(() => baseStore.menuActive)
|
||||
const projectsLoading = computed(() => projectStore.isLoading)
|
||||
dpschen marked this conversation as resolved
Outdated
dpschen
commented
Remove both computed above and use store + property directly instead. Remove both computed above and use store + property directly instead.
konrad
commented
Done Done
|
||||
|
||||
const projects = computed(() => projectStore.notArchivedRootProjects
|
||||
dpschen marked this conversation as resolved
Outdated
dpschen
commented
This seems like something that the store should export instead as a computed. This seems like something that the store should export instead as a computed.
konrad
commented
That makes sense. That makes sense.
konrad
commented
Changed it. Changed it.
|
||||
.sort((a, b) => a.position - b.position))
|
||||
const favoriteProjects = computed(() => projectStore.favoriteProjects
|
||||
dpschen marked this conversation as resolved
Outdated
dpschen
commented
Simplify to
Simplify to
```ts
.sort((a, b) => a.position - b.position)
```
konrad
commented
Done. Done.
|
||||
.sort((a, b) => a.position - b.position))
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
dpschen
commented
This sorts the returned computed of the store Error in vue developer tools:
This sorts the returned computed of the store
=> sort already in store OR create copy (worse performance)
Error in vue developer tools:
> [Vue warn] Set operation on key "0" failed: target is readonly. [...]
konrad
commented
Now sorting in store, that seems to work (or at least there are no errors now) Now sorting in store, that seems to work (or at least there are no errors now)
|
||||
|
@ -126,4 +139,8 @@ const projectsLoading = computed(() => projectStore.isLoading)
|
|||
}
|
||||
}
|
||||
dpschen marked this conversation as resolved
Outdated
dpschen
commented
This changes styles inside the component. If the styles need to be adjusted the component should be changed instead. This changes styles inside the component. If the styles need to be adjusted the component should be changed instead.
konrad
commented
The problem is the component is used in multiple places where this would need different sizes. The way to do this would probably be variants with a prop? The problem is the component is used in multiple places where this would need different sizes. The way to do this would probably be variants with a prop?
dpschen
commented
Correct! The question to ask is also: do we even need so many different sizes or shouldn't they be more unied. For now I guess it's enough to answer this quesion for this usecase here. Correct! The question to ask is also: do we even need so many different sizes or shouldn't they be more unied. For now I guess it's enough to answer this quesion for this usecase here.
konrad
commented
I've now added this as a variant to the component. In doing this I discovered there are more styles and uses of that loader which we should refactor at some point. I would consider that out of scope for this PR though. I've now added this as a variant to the component. In doing this I discovered there are more styles and uses of that loader which we should refactor at some point. I would consider that out of scope for this PR though.
|
||||
}
|
||||
|
||||
.menu + .menu{
|
||||
dpschen marked this conversation as resolved
Outdated
konrad
commented
Done Done
|
||||
padding-top: math.div($navbar-padding, 2);
|
||||
}
|
||||
</style>
|
||||
|
|
Move
v-if
to frontDone